1

Is there a way to access the image data (children/transformation info) of a particular frame in a MovieClip without having to use the gotoAndStop methods.

These methods are part of a rendering pipeline, all I want is access to the data, not to start a chain of asynchronous events that were developed to render things on screen, call multiple event listeners and execute frame actions.

Jono
  • 3,949
  • 4
  • 28
  • 48

1 Answers1

4

Not only can you not do that, but gotoAndStop() doesn't even immediately make that data available. The contents of a frame aren't code accessible until the FRAME_CONSTRUCTED Event is dispatched when that frame is reached, so what you would actually have to do is more like:

var lastFrame:int = currentFrame;

function ready(e:Event):void
{
    if(currentFrame !== lastFrame)
    {
        // In this example, frame 15 is where some image
        // data we want is.
        if(currentFrame === 15)
        {
            // Get image data.
            //
        }

        lastFrame = currentFrame;
    }
}

addEventListener(Event.FRAME_CONSTRUCTED, ready);

Needless to say; storing data you need across frames is not a viable way to structure an application.

Marty
  • 39,033
  • 19
  • 93
  • 162
  • Yeah, I'm aware. If you could suggest another way to store an animation's vector data, created in Flash (in movieclips) I'd be all ears. I'd love to be able to export as a collection of SVG files or similar. My only plausible idea is to write a JSFL script that separates each frame into its own clip and names by frame index. – Jono Jan 17 '14 at 11:11
  • @Jono Why not just break up the parts you want to be able to access into their own MovieClips, exported for use with ActionScript. That way, you can create an instance of whatever you need, whenever you need. – Marty Jan 17 '14 at 13:34