How? Loading Image seqences from actionscript
Copy link to clipboard
Copied
Hi,
I need to load about 60 images where hese images are three animation sequences each 20 frames long. The first is the idel sequence which runs constanly until a key is pressed.Once the key is pressed the second animation sequence is run and so on.
As animation now consists of a series of images, I dont know how to load all these images into flash using actionscript and how to run the the animation and switch to different animation when a button is pressed.
Does anybody kno whow to do this?
thanks
Copy link to clipboard
Copied
Your best bet is either 'merging' all of the individual images into MovieClips, one for each animation set (idle, walking, etc), you could than just use simple commands thru code (myIdleAnimation.gotoAndPlay(1)); and loop this until input is detected, than change MC's.
Alternatively you could use a sprite sheet and animate things on your own.
More over head work, but performance is a bit better (might not be noticable in your case).
Copy link to clipboard
Copied
Hi,
Both seem good ideas except that I dont have any experience of using either of them from actionscript.
If using MCs, how do I merge images a MC and how do I switch between MC at runtime?
thanks

Copy link to clipboard
Copied
Do you have to load them as images or can you import them in flash and just use them? So this would you save you a lot of code (just need some goto button scripts).
Copy link to clipboard
Copied
Hi,
I have to load the files as I am using flex not Flash (CS4 or CS5) and hence the need to do it in actionscript.

Copy link to clipboard
Copied
You could look for some tutorial about Slideshow and AS3 in google. Or start at the Flash help for 'falsh.display.Loader' - down there is example code for loading one imge. If you load multiple images and add them to the stage then just make one visible at a time (maybe with setInterval), there is your animation. Well step by step of course
Copy link to clipboard
Copied
Thanks, I have looked at that but it does not tell you how to store an image sequence and run it as animation. I thought something like this was fairly standard in flash, but it does not seem to be that way.

Copy link to clipboard
Copied
You would programm it by yourself or be lucky and find a class someone made and published on the internet. As you see in the help code it uses the addChild to hang the graphic to a visible element (stage). Put each element into an Array and use setInterval function or Enter_Frame Event to update the visible sprite.
Copy link to clipboard
Copied
Ok, so I end up with lots of images hanging off the "stage" objectwhich makes the code a little untidy. I am sure there might be a better way of doing this.
Is there a way of creating a movieclip from a sequence of images? I can then create a few MCs and run them as required.

Copy link to clipboard
Copied
You didn't say tidy
Of course you can make it more tidy by removing and adding the sprite on every frame. A movieclip with a timeline in Flash (afaik) does make it this way too - except you don't see the code for it. But I don't know if you have any benefits by removing them compared to make them visible and invisible (for your static graphics).
Or make it real tidy and build a quick animation+loader class which you can use in your main class.

