Pause Documentation

Author: Alex Uhlmann
Last Modified: 09/23/05 19:47:21


Summary

Pause class:

- description

Pause Properties:

- duration

Pause Methods:

- run
- animate
- goto
- waitMS
- waitFrames
- stop
- pauseMe
- resume
- lock
- unlock
- isTweening
- getDurationElapsed
- getDurationRemaining
- addEventListener
- removeEventListener
- removeAllEventListeners
- eventListenerExists
- getID
- toString


Pause class

version: Documentation not provided.

description:

Take a break and do something afterwards.

You can invoke any function if you specify the scope param. If you don't specify it, then Pause will invoke the callback to all listeners of APCore. If no listener was specified, Pause will invoke the callback on itself. Pause implements the IAnimatable interface and therefore can be used just like any other IAnimatable class (i.e. in composite classes like Sequence or with constructor initialization, animate and run methods). Nevertheless, the examples below use the waitMS and waitFrames methods to pause with Pause.

Use waitMS to wait a certain amount of time (in milliseconds) and call a function afterwards.

Example 1: subscribe a listener to all events from AnimationPackage (APCore), and setup the onStart and onCallback functions. Use the Pause class to wait one second and send the onStart event. Inside onStart use Pause to wait again and send the onCallback event, this time with two specified parameters. Inside onCallback, wait again. Then, invoke a custom function (fooFunc) in _root scope. Send two parameters.

	
			APCore.initialize();
			var myListener:Object = new Object();
			APCore.addListener(myListener);
			new Pause().waitMS(1000,"onStart");
			myListener.onStart = function() {	
				trace("onStart "+arguments);
				new Pause().waitMS(1000, "onCallback", ["foo", "bar"]);
			}
			
			myListener.onCallback = function(source, params) {
				trace("onCallback "+arguments);	
				new Pause().waitMS(1000, _root, "fooFunc", ["foo", "bar"]);
			}
			
			function fooFunc(bar:String, foo:String) {
				trace("fooFunc "+arguments);
			}
			
Example 2: Do the same like above, just with frames. Use waitFrames to wait a certain amount of time (in frames) and call a function afterwards.
			APCore.initialize();
			var myListener:Object = new Object();
			APCore.addListener(myListener);
			new Pause().waitFrames(10,"onStart");
			myListener.onStart = function() {	
				trace("onStart "+arguments);
				new Pause().waitFrames(10, "onCallback", ["foo", "bar"]);
			}
			myListener.onCallback = function(source, params) {
				trace("onCallback "+arguments);	
				new Pause().waitFrames(10, _root, "fooFunc", ["foo", "bar"]);
			}
			function fooFunc(bar:String, foo:String) {
				trace("fooFunc "+arguments);
			}
			

usage:

var myPause:Pause = new Pause();
var myPause:Pause = new Pause(type, duration, callbackParam);
var myPause:Pause = new Pause(type, duration, callbackParam, param);
var myPause:Pause = new Pause(type, duration, scope, callbackParam);
var myPause:Pause = new Pause(type, duration, scope, callbackParam, param);

parameters:


Pause Properties:

duration

(Number) Duration of animation in milliseconds or frames. Default is milliseconds.


Pause Methods:

run

description: Rotates a movieclip from its the current _rotation property value to a specified amount in a specified time and easing equation.

usage:

myInstance.run();
myInstance.(type, duration, callbackParam);
myInstance.(type, duration, callbackParam, param);
myInstance.(type, duration, scope, callbackParam);
myInstance.(type, duration, scope, callbackParam, param);

parameters:

returns: void

animate

description: similar to the run() method. Offers start and end parameters.

usage:

myInstance.animate(start, end);

parameters:

returns: void

goto

description: jumps to a specific step of the animation and stays there.

usage:

myInstance.goto(percentage);

parameters:

returns: void

waitMS

description: Documentation not provided.

usage:

myPause.waitMS(milliseconds, callbackParam);
myPause.waitMS(milliseconds, callbackParam, param);
myPause.waitMS(milliseconds, scope, callbackParam);
myPause.waitMS(milliseconds, scope, callbackParam, param);

parameters:

returns: void

waitFrames

description: Documentation not provided.

usage:

myPause.waitFrames(milliseconds, callbackParam);
myPause.waitFrames(milliseconds, callbackParam, param);
myPause.waitFrames(milliseconds, scope, callbackParam);
myPause.waitFrames(milliseconds, scope, callbackParam, param);

parameters:

returns: void

stop

description: stops the animation if not locked..

usage: myInstance.stop();

returns: true if instance was successfully stopped. false if instance could not be stopped, because it was locked.

pauseMe

description: pauses the animation if not locked. Call resume() to continue animation.

usage: myInstance.pauseMe();

parameters:

returns: true if instance was successfully paused. false if instance could not be paused, because it was locked.

resume

description: continues the animation if not locked.

usage: myInstance.resume();

returns: true if instance was successfully resumed. false if instance could not be resumed, because it was locked.

lock

description: locks the animation to prevent pausing, resuming and stopping. Default is unlocked.

usage: myInstance.lock();

returns: Void.

unlock

description: unlocks the animation to allow pausing, resuming and stopping. Default is unlocked.

usage: myInstance.unlock();

returns: Void.

isTweening

description: checks if the instance is currently animated.

usage: myInstance.isTweening();

returns: true if instance is tweening, false if instance is not tweening.

getDurationElapsed

description: returns the elapsed time or frames since the current tween started tweening.

usage: myInstance.getDurationElapsed();

returns: Number

getDurationRemaining

description: returns the remaining time or frames since the current tween started tweening.

usage: myInstance.getDurationRemaining();

returns: Number

addEventListener

description: Subscribe to a predefined event. The following standard EventDispatcher events are broadcasted

onStart, broadcasted when animation starts.
onEnd, broadcasted when animation ends.

The even object returned, contains the following properties:

type (String) event broadcasted.
target (Object) event source.

usage:

myPause.addEventListener(event, listener);
myPause.addEventListener(event, listener, handler);

parameters:

returns: Void.

removeEventListener

description: Removes a listener from a subscribed event.

usage:

myPause.removeEventListener(event, listener);
myPause.removeEventListener(event, listener, handler);

parameters:

returns: Void.

removeAllEventListeners

description: GDispatcher specific feature. Removes all listeners for a specific event, or for all events.

usage:

myPause.removeAllEventListeners();
myPause.removeAllEventListeners(event);

parameters:

returns: Void.

eventListenerExists

description: GDispatcher specific feature. Checks if a listener is already subscribed to a certain event.

usage:

myPause.eventListenerExists(event, listener);
myPause.eventListenerExists(event, listener, handler);

parameters:

returns: true if event exists on listener. false if event doesn't exist on listener.

getID

description: returns a unique ID of the instance. Usefull for associative arrays.

usage: myInstance.getID();

returns: Number

toString

description: returns the name of the class.

usage: myInstance.toString();

returns: String




generated with AS2docGenerator beta 0.5.3