A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Adding images to an Array

  1. #1
    Junior Member
    Join Date
    Oct 2009

    resolved [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.

    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.

  2. #2
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    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];
    Wile E. Coyote - "Clear as mud?"

  3. #3
    Junior Member
    Join Date
    Oct 2009
    thanks <3

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

Click Here to Expand Forum to Full Width

HTML5 Development Center