-
Senior Member
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)
-
Is it a basic button, or an instance of the Button component?
K.
-
Senior Member
"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)
-
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.
-
Senior Member
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)
-
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.
-
Senior Member
"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)
-
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.
-
Senior Member
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)
-
No, I mean it is AS 2.0 only...
K.
-
Senior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|