Groups | Blog | Home
all groups > flash actionscript > january 2006 >

flash actionscript : is there a way cancelling a button if a mc is over it?


Captain Ahab
1/5/2006 11:57:54 PM
Hello Everyone,
this is my first post here, I'm somewhat new to flash, altough I'm quite
satisfied with the way things are going for me as a complete newbie.
still, i have a question. now i'm working on a site, and at some point the
user may click on a button, and an external swf is lodaed into an empty mc.
problem is, the loaded mc is (almost)fullscreen, so it is over some of the
buttons. i manged to create an 'if' condition so when a mc like it is open, the
buttons are inactive, but when the mouse rolls over, the cursor still changes
to the indexing finger icon. i wanted to know if there's a way the the cursor
won't change?
(i tried making in the if condition that other than not activating the script
if the mc is loaded, there's a Mouse.hide and a caption of a cursor, but it's
unsetisfing for my customer).

i would be happy to get some suggestions, and i apologise in advance if this
kind of a question has already been asked.

with king regards to you all
captain ahab.
Rothrock
1/6/2006 12:04:18 AM
myButtonName.enabled=false;

I think that is what you might want?

Check the help files for the Button class. It will show you all the methods,
properties, etc. that go with buttons. Always a good place to look when ever
you want to try and do something with a given class.
NSurveyor
1/6/2006 12:09:15 AM
A better way to make them disabled, is to use the enabled property of a button.
For example, say you have the buttons, b1, b2, b3, button4,btn5 you can use:

b1.enabled = false;
b2.enabled = false;
b3.enabled = false;
button4.enabled = false;
btn5.enabled = false;

to reenable them, you can do the same thing, but use true instead of false. If
you have a lot of buttons, you can put all these buttons into an Array (sorta
like a list). Then, you can use ActionScript to loop through this array and set
the enabled property to what you want. For example:

var buttonsArray = [b1,b2,b3,button4,btn5];
for(var btn in buttonsArray){
buttonsArray[btn].enabled = false;
}
}

------------------------

Another way to make this work is to give your loaded movieclip a mouse event
handler. For example, say you have the clip external_mc over some buttons. You
could have:

external_mc.onPress = null;
//even if this is null, the event handler still exists, so it will basically
//"inctercept" the mouse events.
external_mc.useHandCursor = false;//stops the hand cursor from showing

However, this will stop the mouse click events that occur in your movie, so
using the first method I suggested is safer.

OR you could use the same idea, but place a MovieClip big enough to fill the
Stage (inside the external clip) and put it on the lowest layer. Then, just
stick this code directly on the clip:

onClipEvent(load){
_alpha = 0;
onPress = null;
useHandCursor = false;
}

or if you gave it the instance name, blockMouse_mc, you could put this in the
frames actions:

blockMouse_mc._alpha = 0;
blockMouse_mc.onPress = null;
blockMouse_mc.useHandCursor = false;
Captain Ahab
1/6/2006 12:12:41 AM
wow,
NSurveyor
1/6/2006 12:12:47 AM
NSurveyor
1/6/2006 2:52:34 AM
AddThis Social Bookmark Button