home *** CD-ROM | disk | FTP | other *** search
- class ds.transitions.TweenObserver
- {
- var _listeners;
- var observingTween;
- var tweenEnterFrame;
- var nextFrame;
- var _observer;
- var broadcastMessage;
- static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
- static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(ds.transitions.TweenObserver.prototype);
- function TweenObserver()
- {
- }
- static function observeTween(twn)
- {
- var _loc1_ = new ds.transitions.TweenObserver();
- _loc1_.observe(twn);
- return _loc1_;
- }
- static function unobserveTween(twn)
- {
- return Boolean(twn._observer.unobserve());
- }
- function observe(twn)
- {
- if(twn._observer != undefined)
- {
- twn._observer.unobserve();
- }
- this._listeners = [];
- this.observingTween = twn;
- this.observingTween._listeners.unshift(this);
- this.observingTween._observer = this;
- this.tweenEnterFrame = this.observingTween.onEnterFrame;
- this.observingTween.onEnterFrame = function()
- {
- this.nextFrame();
- this._observer.onEnterFrame();
- };
- }
- function unobserve()
- {
- if(this.observingTween._observer == this)
- {
- this.observingTween.removeListener(this);
- this._listeners = [];
- this.observingTween.onEnterFrame = this.tweenEnterFrame;
- return true;
- }
- return false;
- }
- function onEnterFrame()
- {
- this.broadcastMessage("onMotionUpdated",this.observingTween);
- }
- function toString()
- {
- return "[TweenObserver]";
- }
- function onMotionLooped()
- {
- this.broadcastMessage("onMotionLooped",this.observingTween);
- }
- function onMotionYoyo()
- {
- this.broadcastMessage("onMotionYoyo",this.observingTween);
- }
- function onMotionStarted()
- {
- this.broadcastMessage("onMotionStarted",this.observingTween);
- }
- function onMotionFinished()
- {
- this.broadcastMessage("onMotionFinished",this.observingTween);
- }
- function onMotionStopped()
- {
- this.broadcastMessage("onMotionStopped",this.observingTween);
- }
- }
-