Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / July 2008



Tip: Looking for answers? Try searching our database.

Dynamically named for loops

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
badmonkey91 - 09 Jul 2008 21:23 GMT
I'm trying to dynamically name multiple variables with a for loop and can't get the syntax, can anyone help?

for (var U=1; U>2; U++){
    "test"+String(U)=U;
    }
kglad - 09 Jul 2008 21:40 GMT
use array notation to convert strings to objects:

for (var U=1; U>2; U++){
this["test"+String(U)]=U;
// or this["test"+U]=U;
}
badmonkey91 - 09 Jul 2008 22:08 GMT
kglad - 09 Jul 2008 22:16 GMT
you're welcome.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.