-
[RESOLVED] Adding images to an Array
I'm making a slideshow with 7 pictures in it, what i want to do is add the images to the array.
image names/class(?) are image1, image2, image3, ... image7 and I'm adding them in a loop.
Code:
var arrayName:Array = new Array();
for(var i:int=0;i<6;i++){
arrayName[i] = //this is where I'm stuck
}
need help with that one line of code, and how to get the name right while using numbers in the array elements and, if possible, the class.
I've never done this before, but I'm prety sure its possible to store almost anything in an array.
-
Senior Member
Is the array populated at this point and you're trying to cycle through the indices? Or is that what you're trying to accomplish here? In any case, try something like this and see if it works for you.
Actionscript Code:
var arrayName:Array = new Array(6);
for(var i:int = 0; i < arrayName.length; i++) { arrayName[i] = "image"+(i+1); var nm = arrayName[i]; trace(nm); }
Wile E. Coyote - "Clear as mud?"
-
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|