Ultrashock Forums > Flash > Flash Newbie
problem with a button inside a movieclip

You are currently viewing our website as a guest which gives you limited access to forums, files and other resources.

Click here to join now for free, and start interacting with our members, download files and much more!

Click here if you are looking for our Flash files and other professional assets.
 
Post Reply | View first unread | Rate Thread Search this Thread | Thread Tools | Display Modes

#1
Bookmark and Share!
problem with a button inside a movieclip
Old 2005-10-24

Hi everybody,

I have a button inside a movieclip, with which I am using a onRollOver, onRollOut and onRelease. I want to be able to access the button inside the movieclip, after I have used the onRollover for the mc. Right now it is just ignoring the onRollOver of the button.

Can anyone please tell me how I could do this?

Thanks a lot
peace,
Cayo Hueso
postbit arrow 14 comments | 1801 views postbit arrow Reply: with Quote   
Registered User
cayohueso is offline
seperator
Posts: 103
2005-01-11
seperator

Ultrashock Member Comments:
vesco vesco is offline 2005-10-24 #2 Old  
yourMCName.yourButtonName.onRollOver = function() {
//doSomething
}
Reply With Quote  
cayohueso cayohueso is offline 2005-10-24 #3 Old  
No, the problem is that the MC has an onRollOver event applied to it, so it overrides the onRollOver of the button.
Thanks anyway,
Reply With Quote  
 Mime 2005-10-24 #4 Old  
You could always build some more keyframes into the MC timeline. In your rollOver function - you could then tell the player head to go to another keyframe where some actionscript tells the mc to become disabled (mc._enabled = false; )
However this would stop the rollover function from continuing.
Then you could have the button work.

The only thing then you need to do is have the MC become enabled somehow. Maybe over time with more keyframes or by adding the mc._enabled = true; via the button release or rollOut funtions.

An fla would help to try and nail it.

Feel free to mail it to me if you want any help.

Grant.

Secondly - if you are using actual buttons (F8 Button) try to use movieclips instead.
They are generally easier to work with, especially with actionscript.
Reply With Quote  
Ben Ben is offline Ben lives in United States 2005-10-24 #5 Old  
mmm nested rollovers. I have a solution for you
Reply With Quote  
cayohueso cayohueso is offline 2005-10-24 #6 Old  
Thanks guys. I have found a temporary solution, which is that I am using the onrollover on another button inside the mc. When I press this button, the timeline within that mc advance until it reaches a frame where the previously problematic button is. And that solves the problem.
Thanks a lot for your help.
Reply With Quote  
Ben Ben is offline Ben lives in United States 2005-10-24 #7 Old  
ActionScript Code:
  1. mc.onRollOver = mc_over;
  2.  
  3. function mc_over() {
  4. this.onEnterFrame = something;
  5. delete this.onRollOver;
  6. }
  7.  
  8. var b = bounds_mc.getbounds (_root);
  9.  
  10. function something() {
  11. if (_xmouse<b.xMin  || _xmouse>b.bMax || _ymouse<b.yMin || _ymouse>b.yMax {
  12. this.onRollOver = mc_over;
  13. delete this.onEnterFrame;
  14. }
  15. }

edit: Im always too Slow !!!!
Reply With Quote  
cayohueso cayohueso is offline 2005-10-24 #8 Old  
Thanks a lot Bentropy,

I am going to give your code a try.
Reply With Quote  
Ben Ben is offline Ben lives in United States 2005-10-24 #9 Old  
... If you need further explanation.. just ask.

Seems like your AS savvy enuf to figure it out though, hope it works.
Reply With Quote  
cayohueso cayohueso is offline 2005-10-25 #10 Old  
As a matter of fact, Bentropy, you got me lost with the bounds_mc. I am assuming that mc is the movieclip that contains the button. Which is bound_mc?

Thanks a lot for your help
Reply With Quote  
Ben Ben is offline Ben lives in United States 2005-10-25 #11 Old  
well.. bounds_mc is a mc with the dimensions of the function..

You can make a new one, or use the dimensions of your button..
Reply With Quote  
cayohueso cayohueso is offline 2005-10-25 #12 Old  
I am sorry, Bentropy, I don't understand how could I apply this to my button inside the mc

Thanks,
Reply With Quote  
Ben Ben is offline Ben lives in United States 2005-10-25 #13 Old  
...

you dont have to use getbounds.

the idea is to kill the mcOnRollOver .. onRollOver, so the buttonRollOver can work..(what a mouthfull)

and then when you roll out (getbounds) to reset it...
Reply With Quote  
cayohueso cayohueso is offline 2005-10-25 #14 Old  
Ok, I got it now. Thanks a lot for all your help.
Reply With Quote  
Ben Ben is offline Ben lives in United States 2005-10-25 #15 Old  
Reply With Quote  
Thread Tools
Display Modes Rate This Thread
Rate This Thread: