Hello,
As far as I understood your scenario, you should call
CustomClass's addEventListener() instead of
Application.application in the Controller class. That
is, the Controller class init() should look like that
In the Controller Class {
public function init() {
customClassInstance.addEventListener
("menuitemClicked",
menuitemClickHandler);
}
Regards,
Jehanzeb
--- duncan mcmillan <[EMAIL PROTECTED]> wrote:
> Folks
>
> Maybe I'm interpreating all the docs wrong but, I
> have a Custom Class which is one of several View
> Classes as part of an MVC model I'm using. I have an
> associated Controller class.
>
> I want the Custom class to dispatch custom Event to
> the COntroller class, the Custom class is embedded
> somewhere in the Display list under a Base View
> Class.
>
> [Event(name="menuitemClicked",
> type="flash.events.Event")]
> Custom Class {
>
> private function onClick(event:Event) {
> var e:Event = new Event("menuitemClicked", true,
> false);
> dispatchEvent(e);
> Alert.show("Event Dispatched");
> }
> }
>
> In the Controller Class {
>
> public function init() {
>
>
Application.application.addEventListener("menuitemClicked",
> menuitemClickHandler);
> }
>
> //This MVC EventHandler
> public function menuitemClickHandler(event:Event)
> {
> Alert.show("Event received by COntroller");
> }
> }
>
> I've tried not using Application.appication and
> still get nothing, what am I not understanding about
> receiving events from another Class.
>
> Cheers
>
> Duncan
>
>
>
>
___________________________________________________________
> Yahoo! Answers - Got a question? Someone out there
> knows the answer. Try it
> now.
> http://uk.answers.yahoo.com/
>
____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now.
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ