Dear List,
I am trying to use tween's onMotionFinished method in order to make use of this, only when I try to call it normally (see closeCanvas method below) and trace(mc) it traces undefined. So when I tried to delegate onMotionFinished, I stumbled accross another problem. This time since tween1 is instantiated insideof the openCanvas method, delegating it in the constructor doesn't help at all.

So what should I do to workaround this? Basically I am trying to trigger an event when the motionFinished. IS using tween inside classes is a bad habit, should I take the code to the timeline? I really appreciate advices and helps!!


best,
ilteris.


import mx.transitions.Tween;
class Canvas {
        private var tween1:Tween;
        private var tween2:Tween;
        public var mc:MovieClip;
        // Constructor
        public function Canvas(timeline:MovieClip, level:Number, y_:Number) {
mc = timeline.attachMovie("canvas", "canvasS", level, {_x:158, _y:y_, _width:0}); this.tween1.onMotionFinished = mx.utils.Delegate.create(this, this.mcMotionFinished);
        }
        public function openCanvas() {
tween1 = new Tween(mc, "_width", mx.transitions.easing.Strong.easeOut, 0, 673, 3, true);
                mcMotionFinished(); // this doesn't scope to the class          
        }

        public function mcMotionFinished() {
                        trace(this); // I am assuming this should scope to
                                                // the class only I am not able 
to call this method.
                }

        public function closeCanvas() {
tween2 = new Tween(mc, "_width", mx.transitions.easing.Strong.easeOut, 673, 0, 2, true);
                tween2.onMotionFinished = function() {
                        trace(mc) // nope, this scope to the tween itself.
                        // check which one is pressed for next!
                }
        }
}

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to