Hi,
Is it possible to dispatch events from a simple call to a method?

I have a view class that extends an abstract view class that contains the EventDispatcher class. I don't have a problem dispatching events from onPress and other handler, but what if I want to dispatch an event when simply calling a method?


class com.test.mvc.AbstractView{

    public var addEventListener:Function;
        public var removeEventListener:Function;
        public var dispatchEvent:Function;
}

class com.test.app.SampleView extends AbstractView{

        public function load_something(t)
        {                       
test_mc = t.attachMovie("test_mc.jpg", "test_mc", t.getNextHighestDepth());

                dispatchEvent({type:"onLoadSomething"}); //this does not work

                test_mc.onPress = function(){
this._parent._parent.dispatchEvent ({type:"onLoadSomething", target:this}); //this works
                 }

        }
}


_______________________________________________
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