PDA

View Full Version : Flash getFrame() method?



bubonic
26 Aug 2010, 02:57 AM
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!

<CrGeary.com/>
26 Aug 2010, 05:09 PM
You can calculate the number of frames, with just this:


var total_frames = _root._totalframes;

And then use some appropriate code to build the script. Only thing im unsure about is how to go about doing it, because im yet to see your code.

How are the images being inserted to the flash? are they dynamically added via XML or something, or have they been hard-coded in.?