Copy link to clipboard
Copied
Hi all!
I've searched all over and I can't find what I need. if you can help me out I would very much appreciate it.
I have a movie clip named "ContentClip." Every 5 frames in this clip is a keyframe(classic tween) where an image or content moves from right to left (like as if you are swiping it).
Each key frame has a Stop(); on it so it can hold on that frame showing it's content.
I can play it forward no problem, but I am trying to reverse play back i.e replicate swiping right to go back 5 frames. Currently I have something similar to this -
e.target.parent.addEventListener(Event.ENTER_FRAME, playMe);
function playMe(e:Event):void
{
if(currentFrame == 1)
{
e.target.stop();
e.target.removeEventListener(Event.ENTER_FRAME, playMe);
}
else
{
e.target.prevFrame();
}
}
that is activated on one of the buttons. However, it doesn't stop when it reaches a frame with "stop();" which is an issue as I only want it to reverse for 5 frames.
How Can I -
Make it reverse only 5 frames?
Or make it reverse and stop to only when a frame has a 'label' (no specific label, just 'a' label)?
THank you!
Copy link to clipboard
Copied
currentFrame is referencing the current movieclip. ie, the one containing that code.
if you're trying to control the timeline of e.target, you should be using e.target.currentFrame (and you probably need to cast that as a movieclip, MovieClip(e.target).currentFrame).
and you can use the currentFrameLabel property of movieclips to determine if a frame has a label.
Copy link to clipboard
Copied
Thanks for clearing that part up. I just copied that code from else where, and didn't(and still don't) understand what e.target means.
Anyways, the question is still there, how do I reverse.
Copy link to clipboard
Copied
your code is will work if the references are correct. the stop() is superfluous but doesn't hurt anything.
to debug, trace the name of the movieclip you want to reverse and e.target. they're probably not the same. usually e.currentTarget is the correct reference when you're trying to reference a clicked movieclip.
Copy link to clipboard
Copied
Thanks for the replies, but I don't think you are understanding my question and problem.
How can I make it reverse playback (a movieclip) -
1. Only 5 frames?
or
2. Whenever it goes to a frame with a stop(); action on it?
or
3. Whenever it hits a frame with a label on it?
Copy link to clipboard
Copied
1. use a variable to track how many frame have been reversed
2. no way that i know
3. mentioned in message 1, use currentFrameLabel
Copy link to clipboard
Copied
1. How would you use a variable to track it?
2. --
3. so will it be -
function playMe(e:Event):void
{
if(currentFrameLabel)
{
e.target.stop();
e.target.removeEventListener(Event.ENTER_FRAME, playMe);
}
else
{
e.target.prevFrame();
}
}
?
Copy link to clipboard
Copied
e.target is probably wrong, as explained before.
var framesReversed:int=0;
function playMe(e:Event):void
{
if(e.currnetTarget.currentFrameLabel)
{
e.curentTarget.removeEventListener(Event.ENTER_FRAME, playMe);
}
else
{
e.currentTarget.prevFrame();
framesReversed++;
if(framesReversed==5){
e.currentTarget.removeEventListener(...
}
}
}
?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now