Skip navigation
Currently Being Moderated

how do i load a sequence of numbered images using AS3.0?

Jun 16, 2012 4:08 AM

Tags: #loader #image_sequence

To avoid importing loads of images into a Flash file and putting them on the timeline, i should like to simulate a movie clip by using an image-sequence, that is, by sequentially loading a series of still images, to& then, to "activate" - or view the sequence upon mouse-click, .

 

i figure this involves a loop and array, but i can't figure out the code.

Plz help.

thanks.

 
Replies
  • Currently Being Moderated
    Jun 16, 2012 4:35 AM   in reply to minimalcomfort

    To sequentially load anything you need to use a functional loop (and the array and a counter variable).  The basics of it are outlined below, but not in actual coding syntax, mainly descriptive...

     

    var array:Array = new Array(your array of images); (if these are numerically named, then you may not need the array, just a count value so you know when to stop)

     

    var count:int = 0;

     

    function loadCurrentI mage(){

         loader.load(array[count])

         loader.contentLoaderInfo.addEventListener(COMPLETE,loadComplete)

    }

     

    function loadComplete(evt...){

     

         // first process loaded image, then...

     

        count++;

        if(count < array.length){

            loadCurrent();  // load the next image

        } else {

            // sequencial loading complete, carry on to next activity

        }

           

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2012 5:53 AM   in reply to minimalcomfort

    I can't help with the 1067 error without seeing the code.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 16, 2012 1:59 PM   in reply to minimalcomfort

    var url:String = "D:/flash cs5.5/image_sequence/twirl_test/"+imageArray;

     

    That array being added to the end isn't going to do much for you.  I am guess you really just wanted one element of the array, not the array itself.

    
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 17, 2012 5:19 AM   in reply to minimalcomfort

    If you only want one element, then only specify one element.  Using "imageArray" like you show is attempting to assign an array to a string.  One element involves specifying an index value... imageArray[index]

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 17, 2012 5:53 AM   in reply to minimalcomfort

    YOu've already provided the example, you just need to realize what you have written versus what you want to write.

     

    var url:String = "D:/flash cs5.5/image_sequence/twirl_test/"+imageArray;

    

     

    What do you imagine that "imageArray" is doing at the end of your line of code there?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 17, 2012 10:00 AM   in reply to minimalcomfort

    If that is what you think you want to do, then that is the problem.  You only want to ask for one image at a time.  By appending the entire array to the url, your attempting to add apples (an array) to oranges (a string)... they are two different classes of objects.  You want to add strings to strings... and your array contains individual strings.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points