Trail Documentation

Author: Alex Uhlmann
Last Modified: 09/23/05 19:45:31


Summary

Trail class:

- description

Trail Properties:

- movieclip
- duration

Trail Methods:

- attach
- remove
- animationStyle
- stop
- pause
- resume
- lock
- unlock
- isTweening
- getDurationElapsed
- getDurationRemaining
- addEventListener
- removeEventListener
- removeAllEventListeners
- eventListenerExists
- getID
- toString


Trail class

version: Documentation not provided.

description:

Simulates a trail effect on animated movieclips. Attaches the trail to a movieclip. If null is specified the animation will be infinite.

Example 1: (Example .swf) Attach a small trail to a back and forth moving movieclip. The trail will expire in 10 seconds.

			
			mc._x = 150;
			mc._y = 200;
			var myMove:Move = new Move(mc);
			myMove.animationStyle(2000,Expo.easeInOut,"onCallback");
			myMove.run(500,mc._y);
			new Trail(mc).attach(50,40,10000);
			myListener.onCallback = function()
			{
				myMove.callback = "onCallback2";
				myMove.run(150,mc._y);
			}
			myListener.onCallback2 = function()
			{	
				myMove.callback = "onCallback";	
				myMove.run(500,mc._y);
			}
			
Example 2: (Example .swf) attaches a longer trail to a rotating movieclip. Note: if no duration property is specified, the default duration property is used. The default property of duration is 1000. See AnimationCore.
	
			new Rotation(mc).run(360);
			new Trail(mc).attach(250,40);
			
Take a look to MoveOnCurve for another example.

There are two ways to use this class. One way is to specify the duration property outside the current method, either with setting the property directly or with the animationStyle() method like it is used in de.alex_uhlmann.animationpackage.drawing.

usage:

var myTrail:Trail = new Trail(mc);

parameters:


Trail Properties:

movieclip

(MovieClip) Movieclip to simulate a trail effect on.

duration

(Number) Duration of animation in milliseconds.


Trail Methods:

attach

description:

usage:

myTrail.attach(decay, startAlpha);
myTrail.attach(decay, startAlpha, milliseconds);

parameters:

returns: void

remove

description: offers the opportunity to remove an attached Trail. In particular, this might be useful if a trail is of infinite length (if null is specified for milliseconds).

usage:

myInstance.remove();

returns: void

animationStyle

description: set animation setting for animation.

usage:

myTrail.animationStyle(milliseconds);

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.

pause

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

usage: myInstance.pause();

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 in milliseconds since the current tween started tweening.

usage: myInstance.getDurationElapsed();

returns: Number

getDurationRemaining

description: returns the remaining time in milliseconds 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:

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

parameters:

returns: Void.

removeEventListener

description: Removes a listener from a subscribed event.

usage:

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

parameters:

returns: Void.

removeAllEventListeners

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

usage:

myTrail.removeAllEventListeners();
myTrail.removeAllEventListeners(event);

parameters:

returns: Void.

eventListenerExists

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

usage:

myTrail.eventListenerExists(event, listener);
myTrail.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