Hello I am having a really strange problem here.

I have a boolean property in my class and I am trying to set its value to true as it should be, but it looks like it didn't get even instantiated in the class. Briefly in my class first sendVar method gets call from outside and pass two Number value to two properties (_current, _previous). According to those values I do instantiate openCanvas() method from outside which calls a delegated function canvasOpenFinished(). So it triggers openSection() and with the help of closeButton function (which is also delegated from onPress() inside of canvasOpenFinished ()) I trigger closeSection() method and then things get funky here. I call an outside function which after done triggers closeCanvas() in this class. And closeCanvas() triggers canvasClosedFinished() method and this is where I check if my property(this.flag) is true or false. Only the trace tells me it is undefined!

What is it I am missing here? I am looking for your advices!!
ilteris.

Here is my class:

import mx.transitions.Tween;
class Canvas {
        private var tween1:Tween;
        private var tween2:Tween;
        public var mc:MovieClip;
        public var closeBtn:MovieClip;
        private var _level:Number;
        private var flag:Boolean; // this is the property I am talking about
        public var _current:Number;
        public var _previous:Number;
        

        // Constructor
        public function Canvas(timeline:MovieClip, level:Number, y_:Number) {
mc = timeline.attachMovie("canvas", "kanvas", level, {_x:158, _y:y_, _width:0});
                mc.obj = this; //
                _level = level;
        }
        public function openCanvas() {
tween1 = new Tween(mc, "_width", mx.transitions.easing.Strong.easeOut, 0, 673, 1, true); tween1.onMotionFinished = mx.utils.Delegate.create(this, canvasOpenFinished);
        }
        public function closeCanvas() {
tween2 = new Tween(mc, "_width", mx.transitions.easing.Strong.easeOut, 673, 0, 1, true); tween2.onMotionFinished = mx.utils.Delegate.create(this, canvasCloseFinished);
        }
        public function canvasOpenFinished() {
                trace("canvas is open");
                // we add our button on the right up corner.
closeBtn = this.mc.attachMovie("closebtn", "_closeBtn", _level+1, {_x:657, _y:4});
                //closebutton is a method to call when we want to close the 
section
                // and the canvas without opening new one.
                closeBtn.onPress = mx.utils.Delegate.create(this, closeButton);
                // check if there is already an opened section here
                if (_previous == null) {
                        openSection();
                } else {
                        // method to close an already opened link and canvas 
here!
                }
        }
        public function canvasCloseFinished() {
                // trace("current: " + this._current);
                // trace("previous: " + this._previous);
                if (!this.flag) {
                        this.openCanvas();
                } else {
                        _root.main.prevMovie.gotoAndStop(1);
                        _root.main.prevMovie.teks.textColor = 0xffffff;
                }
        }
        public function openSection() {
                _root.main["container"+_current]._visible = true;
                _root.main["container"+_current].main.startAnimation();
        }
        public function closeSection() {
                // if(_previous != _current) {
                // trigger closeCanvas inside of loaded swf's method 
finishAnimation!
                // I must find a better way of doing this.
                _root.main["container"+_current].main.finishAnimation();
                // else {
                //_root.main["container"+ _previous].main.finishAnimation();
                // }
        }
        public function closeButton() {
                trace("flag: " + this.flag);  // undefined
                 this.flag = true;
                // call closesection function
                // which will call finishAnimation() of a loaded mc!
                closeSection();
                this.mc._closeBtn.removeMovieClip();
                _root.main.prev = null;
        }
        public function sendVar(cur_:Number, prev_:Number) {
                _current = cur_;
                _previous = prev_;
        }
}

_______________________________________________
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