A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [RESOLVED] Dispatching Events, Custom Event Parameters?

  1. #1
    Senior Member
    Join Date
    Aug 2001
    Posts
    227

    [RESOLVED] Dispatching Events, Custom Event Parameters?

    Is there a way to make the single parameter for the event dispatcher either take a custom class or add arguments into it?

    In other words, when dispatching events, i'd like to pass more data than just the event type. And sometimes i prefer to use the event dispatchers more dynamic setup as apposed to the more static methodology of having function references pass arguments.

    Hope that made sense..

  2. #2
    Senior Member ozmic66's Avatar
    Join Date
    Oct 2005
    Posts
    472
    Usually, all of the arguments you will pass will be included in the event object.. So you'd need to create a custom event class which extends the original Event class, and include all the information you'd like to pass in it

    you'd then use that CustomEvent when dispatching an event
    Pixelwave Flash-based iPhone framework
    iPhone Games: Flyloop | Freedom Run

    Twitter: Oztune

  3. #3
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    you'd just then use a custom event (subclass the event class and use an instance of that class as your event)
    [edit]ozmic66 beat me to it [/edit]

  4. #4
    Senior Member
    Join Date
    Aug 2001
    Posts
    227
    ah duh, extend the event class. Good idea! Thanks

  5. #5
    half as fun, double the price senocular's Avatar
    Join Date
    Feb 2002
    Location
    San Francisco, CA (USA)
    Posts
    4,361
    Note that you should override and reimplement the clone() method, otherwise you may get errors in re-dispatching instances of your custom event.

  6. #6
    Senior Member
    Join Date
    Aug 2001
    Posts
    227
    ah k, interesting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center