Jump to content
  • Advertisement
Sign in to follow this  
plywood

[web] Getting the image in the last frame of a SWF file

This topic is 2850 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to make some heavy modifications to an open source Flash-based graphing utility called FusionCharts Free.

For my particular application, I need a way (in ActionScript) to access the last frame of the animation, and get at the actual image file/pic that was used for that last frame. I am not an ActionScript developer, and all my attempts to find an answer on my own have been futile. The closest methods I was able to find were gotoAndPlay(scene,frame) and gotoAndStop(scene, frame). Both return nothing and simply advanced the playhead to a specific scene or frame.

To reiterate, let's say I have 100 images that I want to put into a Flash animation (.SWF file) at the rate of 10 fps (with their being a 1:1 image:frame ratio, of course). Then we would have a 10-second animation, with 10 fps, and in the first second we might see the following images "scroll through":
1. ./images/frame00.gif
2. ./images/frame01.gif
3. ./images/frame02.gif
4. ...
10. ./images/frame09.gif

In this example, we might expect the last frame to be ./images/frame99.gif (the 100th image in the 100th frame). I need a way to get at that frame99.gif in ActionScript!

Because I'm not an ActionScripter, here is some pseudo-code that summarizes what I need to do; I'm not really worried about the semantics/syntax of AS right now as I'm confident I can figure the mechanics out once I know what methods to call:


// Obtain the image file
var imageFile = getLastFrame();



Thanks for any suggestions or input - thanks!

Share this post


Link to post
Share on other sites
Advertisement
Flash doesn't use a sequence of frames in the way you are describing. So what you are asking for doesn't actually exist. Instead you would presumably have to find some way at the desired frame to draw out the entire stage to a bitmap, and then save that bitmap.

Share this post


Link to post
Share on other sites
The approach is:
1)You take an scene object (which is called a "display object" in flash/AS) at the last frame
2) you use BitmapData.Draw(): http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html#draw()

the DisplayObject is a tree of other display objects a nd represents all the items used to draw your graph. Think of it as a collection of photoshop layers, when composed together- they make an image.
FusionCharts itself when animating, draws lots of small items, so just wait till animation completes, and then somehow call BitmapData.Draw() on root of your movie, and get the screenshot of graph.

Hope that helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!