|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Deactivating buttons which are not visible
Hi, I'm currently working on a project in Flash 5 and have come across the problem where buttons that are still in my movie, but behind another movie clip are still active. ie. I can still click on them even though I can't see them. Is there an easy way to stop this happening without manually removing the buttons when I don't want them? I seem to remember having solved this at one point, but can't remember how to do it.
Thanks. |
|
#2
|
||||
|
||||
|
If you go into your libary area you can delete from there
__________________
<NO DONT LOOK AT ME!> |
|
#3
|
|||
|
|||
|
Hi, ok two definate methods to do are:
Method 1) Move the buttons off stage when not in use i.e: myButton._x = -500; then when you want them back: myButton._x = 25; Method 2) Place the buttons in their own two frame movie. Place stop() actions on both frames. Then when you want buttons: myButtonMovie.gotoAndStop(1); and: myButtonMovie.gotoAndStop(2); to turn them off. Should point out the above is assuming the buttons are in frame 1 and frame 2 is a blank keyframe. There is a third option which I dont remember trying but probably will now I've noticed it: myButton.enabled = false; |
|
#4
|
|||
|
|||
|
Thanks Tann. I was hoping there was an easier way to do it. I will be duplicating alot of movies so now I will have to keep track of them just so I can disable them.
![]() |
|
#5
|
|||
|
|||
|
Theres an easier way then keeping track manually. This kinda depends on your setup, it works well if you have one button that you reuse alot or a limited number of buttons or even with dynamic buttons.
OK so down to the nitty gritty. :¬) put each button into its own movie clip, giving each button the instance name "aButton"(no quotes). Use that movie instead of the button on stage. In the onClipEvent(enterFrame) function use: if(_root.buttonsOn) { aButton.enabled = true; } else { aButton.enabled = false; } Now in root, at load time use: buttonsOn = true; to get the buttons to show initially, unless you dont want them to then set it to false. To make things clear if you have 1 button then you need 1 movie clip. if you have 10 buttons then you need 10 movie clips. As I said this works fine if you make your buttons dynamically or use a limited number say 10-20. Becomes a pain if you have to setup loads of buttons like this, but then isnt it a pain anyways! Theres loads of ways to smarten this up but this seems like the easiest solution to me. You may need to have two frames in the button movie, the second having gotoAndPlay(1), otherwise the onclipevent bit might not work i.e. if the button movie is stopped then the check wont continue. |
|
#6
|
|||
|
|||
|
Thanks heaps for the extra feedback. I think I'll stick with having a list of all buttons though, I will need it anyway when I want to destroy the extra buttons I have created.
|
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Deactivating buttons which are not visible |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|