Objecte que gestiona la carrega de dades des de qualsevol timeline de flash. És agradable el seu us, perquè enmagatzema les variables d'enviament i recepció dintre un objecte, estructuran la informació d'entrada i sortida.
_global.commOrbital = function(deb) {
if(deb) this._debug = true
}
commOrbital.prototype.send = function(obj, url, handler)
{
this.sendVars = new LoadVars();
this.handler = handler
for(i in obj) { this.sendVars[i] = obj[i] }
this.received = new LoadVars()
this.received.pt = this
this.sendVars.sendAndLoad(url, this.received, "POST")
if(this._debug) trace('Sending variables')
this.received.onLoad = function(estado) {
if(this.pt._debug) trace("Estado Envio:"+estado+"; Objeto:"+this.toString())
this.ret = new Object()
for(i in this) {
if(this.pt._debug) trace('this string:'+this[i]);
if((typeof this[i])=='string') { this.ret[i] = this[i] }
}
this.pt.handler(this.ret)
}
}
Aquí podeu veure un exemple d'us:
test1 = {var1:"jordi", var2:"pere"}
handlerObj = function(obj)
{
trace("Obj process 2:"+obj.resultado)
play()
}
vars = new CommOrbital()
vars.send(test1, "forgotpass.php", handlerObj)