Copy link to clipboard
Copied
I'm currently working on a project which requires me to pause the timeline, without pause being selected manually, and then play again with a button being pressed. I've done a fair bit of searching and can't find any answer, could anyone here help please?
use stop()
Copy link to clipboard
Copied
use stop()
Copy link to clipboard
Copied
hi there
how do you do that with A.S.3 ??
thanks
J
Copy link to clipboard
Copied
Hi.
Do you want to just stop the timeline manually or do you want a button to do it?
Copy link to clipboard
Copied
Oh thank you so much to help me.
Let me explain.
I am showing an audience the animation directly running on Animate. But it needs to stop somtimes so I can draw and then i press on 'enter' and it plays the rest of the timeline.
Very simple.
I used to do it on Flash CS4 by puting a key frame with F7 and then but an action "stop" and allowing the timeline to activate simple images action.
Do you see what i mean.
I've been stuck on this question since a long time.
Copy link to clipboard
Copied
Here we go!
Notes:
- Just put in the main timeline the stops and frame labels you need (see the FLA);
- You have to test the SWF outside Animate CC (e.g.: from the OS file explorer) for the enter key to work;
- I also added code for the left and right arrows so you can navigate between the labels.
FLA download:
animate_cc_as3_stop_play_timeline.zip - Google Drive
I hope it helps.
Regards,
JC
Copy link to clipboard
Copied
Joao, you are very kind to help me.
I may not have been clear on what i was looking for.
I don't export the animation. I don't use swf.
I am showing the software as itself to show my animation. I need to play the animation and it stops with a key frame with a stop key.
Copy link to clipboard
Copied
Do you want to play and pause the timeline inside of Animate CC in authoring time?
Doesn't pressing the enter key to play and the enter key again to pause work for you?
Copy link to clipboard
Copied
well it works to play but i need it to stop by itself on very specific frames.
Copy link to clipboard
Copied
Here we go! I managed to do it using JSFL.
Preview:
Usage:
- Run the script once. Then you only have to press enter to play the timeline and hopefully the playhead will stop at a frame label.
- To run JSFL script files, double click them or drag and drop over Animate or go to Commands > Run Command...
Details:
- Create frame labels where you want the timeline to stop (see the FLA in the download link);
- The labels names don't matter. The script will stop the playback as long as there is a frame with some name;
- If you need to change something in the code, you'll have to save and run it again everytime you make some change;
- The first two variables on the top of the script can be adjusted:
var frames = []; // put frame numbers here to add extra stop points. For example: var frames = [10, 15, 80, 112];
var active = true; // if you decide to stop the script without closing the FLA and/or Animate, set this value to false. Remember to save the script and run it again for the changes to take effect.
Control Timeline JSFL script download:
animate_cc_jsfl_control_timeline.zip - Google Drive
Code (for reference only):
var frames = [];
var active = true;
var doc;
var timeline;
var layers;
var labels;
var previousLabel;
var currentLabel;
var frameChangedID;
function onFrameChanged()
{
if (!doc)
return;
currentLabel = checkLabel();
if (frames.indexOf(timeline.currentFrame) > -1 || previousLabel != currentLabel)
timeline.stopPlayback();
previousLabel = currentLabel;
}
function checkLabel()
{
for (var i = 0, total = layers.length; i < total; i++)
if (layers.frames[timeline.currentFrame].name != "")
return layers.frames[timeline.currentFrame].name;
}
function start()
{
doc = fl.getDocumentDOM();
if (!doc)
return;
timeline = doc.getTimeline();
layers = timeline.layers;
if (frameChangedID)
fl.removeEventListener("frameChanged", frameChangedID);
if (!active)
return;
frameChangedID = fl.addEventListener("frameChanged", onFrameChanged);
}
start();
I hope this helps.
Regards,
JC
Copy link to clipboard
Copied
Wow I didn't think it would be so complicated. I thought you would just reply in the control panel press this and that.
Thank you sooo much for taking the time to help me on this, i apreciate.
So, when I run your fla with the JSFL command it works perfect. It's a real pleasure to see the cursor stop !
But when I copy the code in my old fla it doesn't work. It still doesn't stop.
Copy link to clipboard
Copied
You're welcome.
That's the way I could managed to do it.
Never heard of another way. Maybe there is!
And you don't have to copy the code. You just open your FLA and run the script with your FLA open. The script is not something you copy and paste into the FLA. Got it?
If you still can get it to work, please share your FLA and I'll take a look.
Copy link to clipboard
Copied
And you don't have to copy the code. You just open your FLA and run the script with your FLA open. The script is not something you copy and paste into the FLA. Got it?
No Sorry, i don't understand... How do i get the script in my fla ? I am lost here.
Copy link to clipboard
Copied
May be you need this code
unction fl_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
{
gotoAndStop(nextFrame);
}
Ref to gotoAndStop to a previous and next keyframe discussion
Copy link to clipboard
Copied
Thanks for trying to help
As I said, i am not using button or swf.
It just has to stop by itself while reading the timeline in the software.
Copy link to clipboard
Copied
You open your FLA, run the script (e. g.: double-clicking it) and play the timeline.
If you need to control another FLA, open this new FLA, run the script again and play the timeline from this new document.
Copy link to clipboard
Copied
It WORKS !!!!!!!!!
Oh god thank you SOOO MUUUCH
What a releave.
My mistake was I had forgotten to name the key with the label "stop"
I am so grateful to you. Thanks for spending time on solving my problem.
Have a good day
Copy link to clipboard
Copied
This is wonderful!!!
You're welcome!
It's awesome that this script can help you achieve what you need.
Best,
JC