Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-08-2010, 06:07 PM   #1
jwolfe
Registered User
 
Join Date: Dec 2009
Posts: 9
Red face How to make an object disappear and stay hidden

I'm currently working on a game that has multiple 'scenes' located on each frame. In one scene, if you click on an object it disappears. I did this using the visible = false method. However, anytime you return the scene after, the object is visible again. How would I write the code so that it stays invisible permanently when you click it, regardless of whether or not you leave and later return to the scene? Any advice would be great! Thanks

(I'm working in AS3 on Flash cs4)
jwolfe is offline   Reply With Quote
Old 02-08-2010, 08:58 PM   #2
sparX
!Senior Member
 
Join Date: Jan 2010
Posts: 1,675
Default

Maybe this,

ActionScript Code:
var byebyeButton:Boolean; if (!byebyeButton) {      button.visible = true;      byebyeButton = true; } else      button.visible = false;

Last edited by sparX; 02-08-2010 at 11:26 PM. Reason: forgot the else dummy....
sparX is offline   Reply With Quote
Old 02-08-2010, 11:36 PM   #3
jwolfe
Registered User
 
Join Date: Dec 2009
Posts: 9
Default

it works! thanks so much
jwolfe is offline   Reply With Quote
Old 02-08-2010, 11:57 PM   #4
sparX
!Senior Member
 
Join Date: Jan 2010
Posts: 1,675
Default

If u want the button back,just set byebyeButton = false; before u are going to run through that code block again.

If the button is never going to make a reappearance then just remove it in your clickHandler,

ActionScript Code:
function clickHandler (e:MouseEvent):void {      //do something....go somewhere...      this.removeChild(button); }
sparX is offline   Reply With Quote
Old 02-09-2010, 01:20 AM   #5
jwolfe
Registered User
 
Join Date: Dec 2009
Posts: 9
Default

great! this was really helpful, thanks a bunch
jwolfe is offline   Reply With Quote
Reply


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:41 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.