Problem with buttons and events in Flash MX

DreamThrall

Newbie
Joined
Oct 14, 2003
Messages
3,483
Reaction score
0
I'm having an odd problem with my buttons and events...

I have several buttons that all have a keyframe for "onRollOver". However, when they are used as a "Button", they won't fire events (myButton.onPress never gets fired).

When they are used as a "MovieClip", they will respond to the events, but once an event is assigned a function, the rollover animation no longer works.

What is going on here??
 
I really have no idea about flash scripting, but I'd guess buttons have some special methods when they are pressed? try to look it up in the help file.
 
Well the rollover should be automatic.... but movieclips and buttons both have the same events ... onRollOver, onRollOut, onPress, onRelease, etc.... I'm using the onPress event, but it only seems to fire when the button is set to type "MovieClip"
 
Let me get this straight. You have a button (the rollover part isn't important right now), with a ..
Code:
on (press) {   
//bla bla code
}
.. function in it, but the function doesn't fire? Odd, I just made a simple test of a circle converted to a button with a rollover color change, and the following action:

Code:
on (press) {
	trace("banana");
}
And it worked fine. Or is your problem an entirely different one?
 
Hey, thanks for helping out.

I'm not doing event handling per button, I'm doing it all in one place...

so my scripting looks something like this:

_root.onLoad = function() {
//do stuff
}

_root.onEnterFrame = function() {
//do stuff
}

myButton.onPress = function() {
//do stuff
}

etc, etc
 
Heh, nice and tidy way of doing it. I tested it with that method, and it worked fine as well. I think the problem is that you didn't specify 'myButton' as the instance name for the button in question (you can do so in the properties panel if you didn't know that already).
 
Nope, the instance names are specified as well... to the point where if I select "MovieClip", everything will work... but if I select "Button", it won't. I'm totally lost.
 
Hmm... could you upload the .fla somewhere so I could take a look at your specific situation? Perhaps attach it zipped? Doesn't have to be the entire project of course, only the button stuff.
 
Back
Top