I don’t think the example is going
to work since you’re trying to dispatch an anonymous object instead of an
Event. Flex 2 requires an Event to be dispatched.
There is mx.events.DynamicEvent which is a
subclass of Event that is dynamic. The constructor does take the “bubbles”
parameter so you can do with it what you will. I don’t know if any of
the events that the components dispatch are dynamic, I think probably not.
Matt
I still can't set bubbles =
true, though... bleh....
----- Original Message -----
From: "Renaun Erickson"
<[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, November 10, 2005 7:39 PM
Subject: [flexcoders] Re: Dynamic Events (Flex2
Custom Events?)
To add arbitrary properties ...
Getting tired ;)
Renaun
--- In [email protected],
"Renaun Erickson" <[EMAIL PROTECTED]> wrote:
>
> FLEX 2:
> To added Arbitary properties to the Event object
what you can do is
> create your custom Event class that extends
the flash.events.Event like:
>
> package
org.nevis.cairngorm.samples.store.view.checkout {
> import flash.events.Event;
>
> public class ShippingCostChangeEvent extends
Event {
> public var cost : Number;
> }
> }
>
> Then in the MXML you access it like:
>
> <mx:Metadata>
> [Event( name =
"shippingCostChange", type =
>
"org.nevis.cairngorm.samples.store.view.checkout.ShippingCostChangeEvent"
> )]
> </mx:Metadata>
>
> <mx:Button label="Continue"
click="dispatchEvent( { type :
> "shippingCostChange", cost : cost}
);" />
>
> You could also instantiate your custom class
first and pass that
> through the dispatchEvent.
>
> Not sure if this is what you were asking
about.
>
> Renaun
>
> --- In [email protected],
"Mark Wales" <[EMAIL PROTECTED]> wrote:
> >
> >
> > Has anyone used them? I've been a bit
confused by several things:
> >
> > DynamicEvent is a subclass (according to
the documentation) of
> > flash.events.Event but is actually found
in mx.events.
> >
> > In addition, the documentation describes
how you can add arbitrary
> > properties at runtime. However,
experimenting with it, it does not
> > appear this works.
> >
> > Is this simply a function of it being an
alpha, am I doing something
> > wrong, or is something else amiss??
> >
> > -Mark
> >
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS