Copy link to clipboard
Copied
I'm trying to create a function to take a snapshot of the state of all objects on the stage for later restoration. It works great for movieclips, text boxes, etc but now I've hit Tweens and MotionTweens and I'm stumped. These are not programatically created tweens, but rather ones created on the timeline.
I see that theoretically, if I could figure out whether there's a tween associated with an object, I could call the position function to find out how far along it is in playing, but that's only if I can figure out how to get to it from the movieclip, which so far I'm stumped on.
Is there any simple way to do this?
Thanks in advance,
Eric.
OK, I accomplished a half-assed workaround.
It turns out that while a Tween always reports back a frame of 1, if you actually put frame labels on, those get reported back correctly. (Go figure!)
So in my save function, I essentially inserted:
if( thisNode.currentFrameLabel !== null ) {
xmlChild.frame = thisNode.currentFrameLabel;
} else {
xmlChild.frame = thisNode.currentFrame;
}
which lets the restore code still function either way, restoring the Tween as it should.
We still have to go back thr
...Copy link to clipboard
Copied
OK, I accomplished a half-assed workaround.
It turns out that while a Tween always reports back a frame of 1, if you actually put frame labels on, those get reported back correctly. (Go figure!)
So in my save function, I essentially inserted:
if( thisNode.currentFrameLabel !== null ) {
xmlChild.frame = thisNode.currentFrameLabel;
} else {
xmlChild.frame = thisNode.currentFrame;
}
which lets the restore code still function either way, restoring the Tween as it should.
We still have to go back through and verify that all manual Tweens are built with frame labels on each keyframe, but close enough for now.