A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: onRelease and event listeners

  1. #1
    Senior Member sprout74's Avatar
    Join Date
    Oct 2000
    Posts
    134

    onRelease and event listeners

    Ok, having a real problem with this:

    I have a movie clip.

    In that movie clip is a Button.

    The movie clip's onLoad method trys to add an event listener for the onRelease method of the button.

    It does not work.

    I tried addListener and addEventListener methods and nothing.

    My listener object has a onRelease method, but the button is not broadcasting the event to the listener.

    ??

    thanks for the help,

    sprout
    "If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea."
    from The Zen of Python (by Tim Peters)

  2. #2
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Is it a basic button, or an instance of the Button component?

    K.

  3. #3
    Senior Member sprout74's Avatar
    Join Date
    Oct 2000
    Posts
    134
    basic button
    "If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea."
    from The Zen of Python (by Tim Peters)

  4. #4
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Yeah, there's your problem...basic buttons don't broadcast events in the way that the components do...

    If you want to use listeners with a button, you'll need to roll your own button code which implements EventDispatcher...here's a good article on it:

    http://www.gskinner.com/blog/archives/000023.html

    K.

  5. #5
    Senior Member sprout74's Avatar
    Join Date
    Oct 2000
    Posts
    134
    thanks for the reply.

    So the info from that link will show me how to set up event listeners for basic button handlers? cool!

    Why would MM get so excited about addListener and addEventListener, boast about the improvements to AS 2.0, and not roll that functionality accross to all input widgets?

    thanks,

    sprout
    "If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea."
    from The Zen of Python (by Tim Peters)

  6. #6
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Originally posted by sprout74
    So the info from that link will show me how to set up event listeners for basic button handlers? cool!
    Well, more accurately, it will give you an idea how to write some button code that will broadcast events and add listeners to those button events...

    Are you using MX or MX2004?

    K.

  7. #7
    Senior Member sprout74's Avatar
    Join Date
    Oct 2000
    Posts
    134
    MX2004 Pro

    why?
    "If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea."
    from The Zen of Python (by Tim Peters)

  8. #8
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Just because eventDispatcher is an AS 2 concept...

    Didn't want you to get frustrated trying to implement something which wouldn't work if you were using MX...

    K.

  9. #9
    Senior Member sprout74's Avatar
    Join Date
    Oct 2000
    Posts
    134
    you mean that code example is AS 1.0 only?
    "If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea."
    from The Zen of Python (by Tim Peters)

  10. #10
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    No, I mean it is AS 2.0 only...

    K.

  11. #11
    Senior Member sprout74's Avatar
    Join Date
    Oct 2000
    Posts
    134
    Well, thanks for the help.

    I am going to try and an a class like the one in the example you posted.

    Thanks for all your help!!

    sprout
    "If the implementation is hard to explain, it's a bad idea.
    If the implementation is easy to explain, it may be a good idea."
    from The Zen of Python (by Tim Peters)

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