How do I handle incremented varibles inside of URLRequest()
i trying set series of url links inside cycling button. however, when try use variable, link sends me variable name instead of url. below snippet of code:
//url variables
var lk1="http://www.firstlink.com";
var lk2="http://www.secondlink.com";
var lk3="http://www.thirdlink.com";
//
var mycount:number=1;
//
navigatetourl(new urlrequest(lk[mycount]);
//
if use above code error "error #1010: term undefined , has no properties."
navigatetourl(new urlrequest(lk+[mycount]);
if use code error "1120: access of undefined property lk."
navigatetourl(new urlrequest("lk"+[mycount]);
and if use code links me "lk1" rather variable value of link.
what proper code incremented variable work inside of urlrequest ????
try using:
navigatetourl(new urlrequest(this["lk"+string(mycount)]);
when use bracket notation build whole variable/instance name string inside brackets.
More discussions in ActionScript 3
adobe
Comments
Post a Comment