News

Log In Sponsors
Partner Sites





Simple Javascript variable problem



Sorry for actually asking this as it's a ridiculously simple problem, but I'm brand new to JavaScript. I know how to do what I want to in ActionScript, but I'm not sure what the syntax is to accomplish it in JavaScript. In ActionScript I've written a chunk of code that looks something like this: [i:2w2ad2pt]--------------- var currentNumber = 1; var picture1Video = " firstVideo.jpg"; var picture2Video = " secondVideo.jpg"; placeHolder1.loadMovie(this["picture"+(currentNumber)+"video"]) currentNumber++; placeHolder2.loadMovie(this["picture"+(currentNumber)+"video"]) ---------------[/i:2w2ad2pt] So basically I'm incrimenting currentNumber to change what variable placeHolder1 and placeHolder2 are looking at. How do I write that in Javascript, so that a variable name being called is made up of a string and the contents of another variable, like ["picture"+currentNumber+"video"] ? Cheers for any help!

Click here to read the whole forum topic