APCore Documentation

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


Summary

APCore class:

- description

APCore Methods:

- APCore.initialize
- APCore.getAnimationClip
- APCore.setAnimationClip
- APCore.watchFPS
- APCore.unwatchFPS
- APCore.getFPS
- APCore.setFPS
- APCore.milliseconds2frames
- APCore.addListener
- APCore.removeListener
- toString


APCore class

version: Documentation not provided.

description:

Most classes in AnimationPackage subclass the singelton APCore, either directly or indirectly. It implements listener functionality and common used methods and creates the animationClip (apContainer_mc) in _root timeline, which is a movieclip that contains everything made by AnimationPackage unless you explicitly prevent this. For example if you use the classes of de.alex_uhlmann.animationpackage.drawing you are able to specify a movieclip of any timeline that will be used to draw the shape. If you don't specify anything, a new movieclip, created in _root.apContainer_mc will be used to draw the shape.

usage:

private class constructor

Event handling

There are basically two ways to handle events in AnimationPackage. One way is using callbacks. (based on the internal AsBroadcaster) The other is using com.gskinner.events.GDispatcher or mx.events.EventDispatcher. Take a look into the readme.htm under "usage" for more information. Since you need the static initialize(), addListener(), and removeListener() methods of APCore to use callbacks, here is an example using the callback structure to handle custom events.

To subscribe an object to events use APCore.addListener(obj); i.e. if you want a movieclip to move back and forth, you can do it like:

               
			APCore.initialize();
			var myListener:Object = new Object();
			APCore.addListener(myListener);
			var myMove:Move = new Move(mc);
			myMove.animationStyle(2000,Expo.easeInOut,"onCallback");
			myMove.run(500,200);
			myListener.onCallback = function()
			{
				myMove.callback = "onCallback2";
				myMove.run(100,200);
			}
			myListener.onCallback2 = function()
			{		
				myMove.callback = "onCallback";	
				myMove.run(500,200);
			}
(Example .swf)

Controlling your frame rate

APCore offers some methods concerning your movie's frame rate (fps = frames per second). As soon as you use a class of AnimationPackage the APCore.initialize method is called and calculates your movie's fps. This calculation takes one second till it gets the only result. Then, due to performance reasons, the calculation will not be continued. If you still want to calculate your fps you can do so by calling APCore.watchFPS(). Stop watching the fps with APCore.unwatchFPS(). For duration mode "MS" in tween mode "FRAMES" you might even set the fps with APCore.setFPS(). Note, that this will not modify your movie's actual fps (this is not possible with ActionScript). See AnimationCore class and AnimationCore.setDurationMode for details.


APCore Methods:

APCore.initialize

description: static, Initializes AnimationPackage including the internal broadcaster. Every class that needs listener functionality will call this method. Needed if no other class of AnimationPackage that needs listener functionality was constructed before or if you want to access the only APCore instance (i.e. for getNextDepth() or createClip() methods). APCore is a Singelton [GoF].

usage: APCore.initialize();

returns: (APCore) the only instance of APCore. Singelton [GoF]

APCore.getAnimationClip

description: static, residence of the animationClip. See class documentation and APCore.setAnimationClip.

usage: APCore.getAnimationClip(target);

returns: (MovieClip) movieclip in which the apContainer_mc has been created.

APCore.setAnimationClip

description: static, allow to set the timeline for the animationClip (apContainer_mc). Default is _root timeline. The animationClip is a movieclip that contains everything made by AnimationPackage unless you explicitly prevent this. See class documentation.

usage: APCore.setAnimationClip(target);

parameters:

returns: Void.

APCore.watchFPS

description: static, watches your movie's frame rate (fps = frames per second). Each second it receives a new result.

usage: APCore.watchFPS();

returns: Void.

APCore.unwatchFPS

description: static, stop watching your movie's frame rate (fps = frames per second). Since watching your fps costs a little performance, I recommend to stop watching your fps if you don't need to anymore.

usage: APCore.unwatchFPS();

returns: Void.

APCore.getFPS

description: static, returns the last calculated value of your movie's frame rate (fps = frames per second).

usage: APCore.getFPS();

returns: Number that specifies the number of frames your movie plays in one second.

APCore.setFPS

description: static, sets the frame rate (fps = frames per second) stored in AnimationPackage. For duration mode "MS" in tween mode "FRAMES" you might set the fps with APCore.setFPS(). Note, that this will not modify your movie's actual fps (this is not possible with ActionScript). See AnimationCore class and AnimationCore.setDurationMode for details.

usage: APCore.setFPS();

parameters:

returns: Void.

APCore.milliseconds2frames

description: static, converts milliseconds to frames according to the current fps (frames per second) stored in AnimationPackage.

usage: APCore.milliseconds2frames();

parameters:

returns: Number of frames that are expected to run in one second.

APCore.addListener

description: To subscribe an object to all events from AnimationPackage.

usage: APCore.addListener(obj);

returns: true if subscription was successful, false if not successful.

APCore.removeListener

description: To unsubscribe an object to all events from AnimationPackage.

usage: APCore.removeListener(obj);

returns: true if successful, false if not successful.

toString

description: returns the name of the class.

usage: myInstance.toString();

returns: String




generated with AS2docGenerator beta 0.5.3