Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 3rd, 2003, 04:14 AM
kwackers kwackers is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 12 kwackers User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old December 3rd, 2003, 08:07 AM
Eye_movement's Avatar
Eye_movement Eye_movement is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: England
Posts: 32 Eye_movement User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 8 sec
Reputation Power: 5
Send a message via MSN to Eye_movement
If you go into your libary area you can delete from there
__________________
<NO DONT LOOK AT ME!>

Reply With Quote
  #3  
Old December 3rd, 2003, 08:56 AM
Tann San Tann San is offline
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,716 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 11326 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 12 h 25 m 15 sec
Reputation Power: 580
Facebook MySpace
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;
__________________
-Tann

-Vote for your favorite ActionScript editor here.

Reply With Quote
  #4  
Old December 3rd, 2003, 10:19 AM
kwackers kwackers is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 12 kwackers User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #5  
Old December 3rd, 2003, 10:38 AM
Tann San Tann San is offline
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,716 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 11326 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 12 h 25 m 15 sec
Reputation Power: 580
Facebook MySpace
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.

Reply With Quote
  #6  
Old December 3rd, 2003, 11:53 AM
kwackers kwackers is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 12 kwackers User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Deactivating buttons which are not visible


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT