Link to home
Start Free TrialLog in
Avatar of jpav
jpav

asked on

HOw can I pass a variable parameter in the geturl function?

I am using flash with asp, using flash to display the results of a query to a DB done via ASP. Everything works fine except for the geturl function of a button . When running the geturl is assigning the same value to all of the button instances. The code where to populate the instances is as follows:

 /*
Populate date into duplicate movie clips
*/
for (i=0;i<=tmi-1;i++){
this["button"+i].marca.text = _root["marca_"+i];
this["button"+i].modelo.text = _root["modelo_"+i];
this["button"+i].km.text = _root["km_"+i];
this["button"+i].year.text = _root["year_"+i];
this["button"+i].precio.text = _root["precio_"+i];
myphoto ="gallery/thumbnails/"+_root["photo_"+i];
myurl = "detalle_auto.asp?prod=" +_root["autoID_"+i]
this["button"+i].autoid.text = _root["autoID_"+i];
loadMovie(myphoto, this["button"+i].containerfoto);
this["button"+i].btnvd.onRelease = function(){
      getURL(myurl ,"_blank")
}

}

To see the flash in action I uploaded a test version here
http://s216301558.onlinehome.us/autoseuropeos/scrollingfeature2Debug.swf

The output of the asp that is sent back to flash is:
http://s216301558.onlinehome.us/autoseuropeos/fetchmain.asp

What I need to be done is for the code to assign the value of the variable autoID_i  where i loops from  0 to 5
Avatar of go4ejjohn
go4ejjohn

It is a simple problem.

your URL is set to the last value, because you just have one variable for storing all the values it get over written and that last value stays there... you will have to store it separately and you will have to use it also according to the selected button.

Regards,
JON
Avatar of jpav

ASKER

Thanks for your response Jon, but can you show me how can I do it?  Should I se myurl as an array that stores all of the URLs . I you show me how would the script be for that it would be great
ASKER CERTIFIED SOLUTION
Avatar of go4ejjohn
go4ejjohn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
this["button"+i].btnvd.onRelease = function()
{
    xyz = this._name.split(",")[1]
      getURL(this._parent._parent["myurl_"+xyz] ,"_blank")
}

need to check this as well because you your "i" is set in the parent....

Regards,
JON