Jude, good point about generic event dispatchers, however that makes you
reliant on either static classes or singletons that care about state.

I'm in the 'singletons are evil' camp.
On Jan 16, 2013 12:52 AM, "jude" <flexcapaci...@gmail.com> wrote:

> On Tue, Jan 15, 2013 at 1:30 PM, Tianzhen Lin <tang...@usa.net> wrote:
>
> > I told the whiners of Flash if they hate Flash ads, they can disable the
> > plugin by default with the browser, and there are plenty of those
> add-in's.
> > But once the same Flash ad producers start making the same crappy ads in
> > HTML 5, there is no more block HTML 5 feature.  :)
>
>
> Exactly! They should want Flash back specifically *because* you can disable
> it.
>
> @Avi - Sortof. You can dispatch events from any object that extends
> IEventDispatcher. If that object is a display object and is on the display
> list that event will bubble up through it (if bubbles are set to true). If
> it's a regular object you would just add an event listener to it to to
> handle any of it's events. Also, as for singletons, they don't get as much
> MXML love as the rest of the SDK but that doesn't mean you have to give up
> on them. A few months ago I made a Singleton Enforcer class so that *any*
> class can be a Singleton and referenced in MXML.
>
> The way it works is you declare in the root application or a document an
> instance of your class /singleton in MXML (yes MXML). This can be any class
> with instance variables on it (they don't have to be static and you don't
> need to create a getInstance() method except if you want to reference it in
> AS). Next, you add a RegisterSingleton MXML class and bind it to that
> instance. That registers it in Flex's global singleton manager. Then in any
> component you need it you can declare your singleton class (in MXML) and
> add a SingletonEnforcer class next to it. When you run your application the
> Singleton Enforcer class will ensure that that instance is the same
> instance across the application. Reading previous discussions it sounds
> like AOT accomplishes the same thing.
>

Reply via email to