Unable to dispatch custom event in flex mobile application?

You seem confused about event dispatching in general.

You seem confused about event dispatching in general. Events can be dispatched in any Flex class that extends, or has a, EventDispatcher. Most Flex Components, including Application extend EventDispatcher.To dispatch the event, you are on the right track just do: dispatchEvent(new RemoteResultEvent(RemoteResultEvent.

USER_UPDATE_COMPLETE,"test")); That will dispatch the event from your current class. Not that all Flex UI Components, including those made in MXML can be considered a class. What you are trying to do is dispatch the event on the main level application; which is a horrible encapsulation breach, but doable.

You have to cast it as an Application so you do not get a generic object. Like this: (Application. Application as Application).

DispatchEvent(new RemoteResultEvent(RemoteResultEvent. USER_UPDATE_COMPLETE,"test")); This approach is deprecated since Flex 4; and you use the FlexGlobals. TopLevelApplication instead: (FlexGlobals.

TopLevelapplication as Application). DispatchEvent(new RemoteResultEvent(RemoteResultEvent. USER_UPDATE_COMPLETE,"test")) You don't say, but you allude to the fact that you are in a Mobile Project.

If so, I would not expect the mx Application class to be available unless you explicitly added the SWC w/ MX Components to your class. You'll have to access the Spark Application, which does not have an Application property. That could be why you are getting the error.

Be sure to import the proper application you want to use: import spark.components. Application More info on Spark Application class.

Firstly you are right I am confused about event dispatching! I tried the dispatchEvent method you showed but it errors with "Call to a possibly undefined method dispatchEvent" should the class I am trying to run it from extend the eventdispatcher? – JaChNo Nov 10 at 15:42 If you want to dispatch an event from a class; yes it needs to extend the EventDispatcher class; or implement IEventDpatcher.

You may benefit from reading through this: help.adobe. Com/en_US/flex/using/… – URL1 Nov 10 at 15:54 All working now just extended it with EventDispatcher. Thanks for the link on events.

– JaChNo Nov 10 at 17:05.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions