Flash wait time until,,,
- Started
- Last post
- 11 Responses
- Utopianacht
I want to make a movie in flash and need that in some keyframes hold for some seconds, there is an actionscript? thats because I dont want to add keyframes. to make time...
- ********0
onClipEvent(load){
_parent.stop();
fcount=4*36;
cnt=0;
}onClipEvent(enterFrame){
cnt++;
if(fcount==cnt){
_parent.play();
}}
- honda0
Download the timers.fla
- Utopianacht0
wow.. thats fast... but how I can do it stops on a determinated frame, and do the wait... and then go to the next keyframe and continue,...?
I've to admit Im new on action script...
- autonoma0
Don't use an onEnterFrame. Put this on the frame you want to pause:
stop();
function wait() {
play();
clearInterval(waiting);
}
var waiting = setInterval(wait,5000);Just change the "5000" to however many milliseconds you want it to pause. 5000 is 5 seconds.
- honda0
Utopianacht, I've included instructions in the Flash file. Double click the yield sign on stage, then select it again and view its actions. It's explained in there. Good luck.
- CyBrainX0
I've been using this for years. I have a mental block with getTimer scripts. I still don't understand this one completely, but I know it works every time.
- Utopianacht0
ok its beggining to work thanx
- unfittoprint0
wait=function(time){
stop();
clearInterval(waitloop);
waitloop= setInterval(function(){
play();
clearInterval(waitloop);
}, time);
}//just use this on a frame
//[5 seconds example]:wait(5000);
- Jerry0
Probably, the proprt key to the issue is called "event based programming". Flash has some nice undocumented features for this. Called "ASbroadCaster". Wait and let me fix you up an example.
I've written the class below.
////////////////////////////////...
//
// PAUSE CLASS, v1.1
// Jerry van Heerikhuize, 2004
//
////////////////////////////////...
//
// EXAMPLE :
//
//------------------------------...
// MyListener = {};
//
// MyListener.idle = function (ID, state, msg) {
// if (state) {
// trace ("asset" + ID + ": " + msg);
// } else {
// trace ("asset" + ID + " error: " + msg);
// }
// };
//
// asset1 = new PAUSE (5000, "idle", 1);
// asset1.addListener (MyListener);
//
////////////////////////////////...
//
// Method (Public): PAUSE (ID, t, listener, cbf)
//
// ID = instance id (number)
// t = time (number) in microseconds
// listener = listener (obj)
// cbf = callBackFunction (string)
//
_global.PAUSE = function (ID, t, listener, cbf) {
ASBroadCaster.initialize (this);
this.addListener (listener)
//
this.ID = ID;
this.cbf = cbf;
this.timeout = t;
this.starttime = getTimer ();
this.interval = setInterval (this.go, 1, this);
};
////////////////////////////////...
//
// Method (Private): go (obj)
//
// obj = object referance (object)
//
PAUSE.prototype.go = function (obj) {
//
obj.currenttime = getTimer ();
//
var idle = obj.currentTime - obj.starttime >= obj.timeout;
if (idle) {
clearInterval (obj.interval);
obj.broadcastMessage (obj.cbf, obj.ID, true, "done");
}
};
//
//
actionLog.addEntry ("The module \"PAUSE\" was successfully included.");Have fun with it.
cheers,
Jerry
- honda0
Nice one Jerry!
*saved
- Utopianacht0
thanx has be done....