0
votes

What I'm trying to do is grab an instance's coordinates from a different keyframe and store it, perhaps in an array if there are multiple keyframes.

I then want to be able to tween between these positions, probably using the greensock's Tweenlite class.

I've read in other posts that objects, or even instances don't technically exist until the playhead is at that specific frame. Is there anyway to get these coordinates anyway, before this object exists? Possibly by creating a separate DisplayObjectContainer off screen that will play through these frames and store the coordinates.

I'm using Flash 5.5 and AS3.

Anyone have any ideas?

1
I'm trying to make it easy for an artist to set these coordinates via keyframes, and let the code handle the tweening between them. Especially since the end user may navigate between these positions non-linearly, ie: from position 1 to position 4, etc...Luis

1 Answers

0
votes

You could try something like this. This assumes you have a MovieClip that contains one MovieClip per frame.

var current:int = 1;
var points:Array = new Array();

while(current < myMc.totalFrames){
     myMc.gotoAndStop(current);
     var child:MovieClip = myMc.getChildAt(0) as MovieClip;
     var p:Point = new Point();
     p.x = child.x;
     p.y = child.y;
     points.push(p);
     current++;
}