Groups | Blog | Home
all groups > flash actionscript > may 2005 >

flash actionscript : help with Loadvars


sly one
5/26/2005 12:00:00 AM
Try to simplify your LoadVars and then test it to make sure you can connect
with your ASP file.

Once you can connect, then add more functionality.

To test, you might want to append a string to your URL to send the variables:

Tmed.sendAndLoad("http://127.0.0.1/unf_balance.asp?accion="totalmedidores&d_diag
rama=_root.li_diagrama","GET");

Also, test for the load before you do anything, like so:

Tmed.onLoad=function(success){
if(success){
//do something
}else{
trace("load error!");
}


}


Rick
5/26/2005 1:15:57 PM
hi guys i have this code, but i cant obtain the rigth behaviour

var tmp1;

tmp1=Test();
trace (tmp1);

function Test()
{
var Tmed = new LoadVars();
var li_med;
li_med="nothing";
Tmed.accion="totalmedidores";
Tmed.id_diagrama=_root.li_diagrama;
Tmed.sendAndLoad("http://127.0.0.1/unf_balance.asp",Tmed,"GET");
Tmed.onLoad = function() {
li_med = this.tmedidores; // if this.tmedidores was 5 i want to
return that value
//_root.li_med = this.tmedidores; it doesn't works =(
return li_med;
}

//return li_med; if i unmark this line it returns "nothing"
}

i want to obtain the li_med value to display it on screen but it doesn't
works, i've tried to debug it, and flash runs until Tmed.onLoad line, then
jumps the code in, and returns undefined to tmp1 variable (because i have //
before return), how can i get the value, if i delete // on return line flash
returns "nothing"
how can i fix it??

thanks a lot by your suggestion =)

--


"Lo verdadero es demasiado sencillo, pero siempre se llega a ello por lo más
complicado."

http://spaces.msn.com/members/rickwhite/

Rick's Blog

Rick
5/26/2005 3:21:17 PM
thats rigth, i can connect to my server, and it runs but i cant get the
value, as i wrote, flash "jumps" the execution of onLoad
and i cant get the value =(
asp returns a value, but flash doesn't wait for, when flash completes full
script then i got the value, but not when i need it =(
--


"Lo verdadero es demasiado sencillo, pero siempre se llega a ello por lo más
complicado."

http://spaces.msn.com/members/rickwhite/

Rick's Blog

"sly one" <webforumsuser@macromedia.com> escribió en el mensaje
news:d757ql$jkc$1@forums.macromedia.com...
[quoted text, click to view]

Daniel Montero
5/26/2005 4:10:07 PM
Rick,
onLoad is executed asynchronously, so you basically can't
return li_me from your Test() function.
perhaps you can return Tmed.tmedidores, as sendAndLoad is synchronous.

you can always do a trace(Tmed) or trace(this) in order to check what
value are you getting into Tmed.

-danim


[quoted text, click to view]
AddThis Social Bookmark Button