Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How? Loading Image seqences from actionscript

New Here ,
Aug 02, 2011 Aug 02, 2011

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

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 02, 2011 Aug 02, 2011

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).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 02, 2011 Aug 02, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 02, 2011 Aug 02, 2011

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).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 02, 2011 Aug 02, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 02, 2011 Aug 02, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 02, 2011 Aug 02, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 02, 2011 Aug 02, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 02, 2011 Aug 02, 2011

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 03, 2011 Aug 03, 2011
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines