Got it...thx Mike. Forgive the subject-line creep but now I need to
add a listener in a parent of the class dispatching the event. The
subcomponent is derieved from UIComponent...shouldn't it's events
bubble by default? Or perhaps my listener syntax is off:
addEventListener("isGreaterChanged", isGreaterChangedHandler)
Am getting no errors just no hits at the parent's event handler method.
thx again
On Thu, Jun 12, 2008 at 9:17 AM, Michael Schmalle
<[EMAIL PROTECTED]> wrote:
> Hi
>
> package my.event.package
> {
>
> public class MyEvent extends Event
> {
> public static const IS_GREATER_CHANGED:String = "isGreaterChanged";
>
> public var isGreater:Boolean;
>
> public function MyEvent(type:String, isGreater:Boolean)
> {
> super(type);
> this.isGreater = isGreater;
> }
> }
> }
>
> // app as file
>
> [Event(type="isGreaterChanged", type="my.event.package.MyEvent")]
>
> ...
>
> var e:MyEvent = new MyEvent(MyEvent.IS_GREATER_CHANGED, true);
> dispatchEvent(e);
>
> ... event handler
>
> private function isGreaterHandler(event:MyEvent):void
> {
> trace(event.isGreater);
> }
>
> Mike
>
> ---------- Forwarded message ----------
> From: justSteve <[EMAIL PROTECTED]>
> Date: Thu, Jun 12, 2008 at 9:51 AM
> Subject: [flexcoders] Understanding Custom Event Creation
> To: flexcoders <[email protected]>
>
>
> The LiveDocs page that is supposed to explain how to create a custom event
> is:
>
> http://livedocs.adobe.com/flex/3/html/ascomponents_7.html#170959
>
> I get it that what I choose for the name parameter is what listeners
> will have to register against. I don't get the 'type' param. Am I
> needing to make that package of the current class?
> [Event(name="itsGreaterThanZero", type="com.foo.bar.whatHere")]
>
> Also, the sample doesn't make clear how to pass custom (runtime) data.
> I'm working with code that needs to dispatch a custom event when a
> given value is found to be > 0. The method in question is in a class
> that extends UIComponent.
>
> Any help much appreciated.
> --steve...
>
>
>
> --
> Teoti Graphix, LLC
> http://www.teotigraphix.com
>
> Teoti Graphix Blog
> http://www.blog.teotigraphix.com
>
> You can find more by solving the problem then by 'asking the question'.
>