Skip to main content
Participating Frequently
January 17, 2008
Question

Make a button go away after it is pressed

  • January 17, 2008
  • 8 replies
  • 722 views
Hi everyone,

I am brand new to Flash and I am working on my first project and need some help. I have a play button that starts a video when pressed (similar to those youtube videos, like the one on this page
http://www.engadget.com/2006/12/01/screen-flickering-problem-plagues-macbooks/)

The only problem is that after my play button is pressed, it stays there, over the video and I was wondering if there was a script (or any other solution) to make it go away.

Thanks in advance!
This topic has been closed for replies.

8 replies

FreddyUAuthor
Participating Frequently
January 18, 2008
Never mind! My mistake, I didn't replace one of the myButtons with my actual instance name. It works perfectly now.

Thanks so much!
FreddyUAuthor
Participating Frequently
January 18, 2008
I'm sorry, I'm just so confused! :-(

I don't even really know ActionScript, I haven't taken any tutorials or anything, I'm just kind of trying things out (which would probably be the problem!)

I put in the code that you critchlow showed and it came up with an error: 1120: Access of undefined property myButton_btn.
funkysoul
Inspiring
January 17, 2008
you need to put that line of code inside the button handler, so that the button only disappears when the user clicks on it.
FreddyUAuthor
Participating Frequently
January 17, 2008
What I am trying to do is make a play button that a user can press. That activates the video and the button disappears to allow the user to see the video without the play button blocking their view.

I don't know if the commands that have been suggested will work for that situation, what they seem to do for me is just remove the button right from the start. They do a great job removing the button, but I am looking for a way to stop that from happening before the user actually hits it.

Thanks for all the help!
Known Participant
January 17, 2008
Freddy,

To do what you are trying to do (and what funkysoul is saying) is something like the following:

FreddyUAuthor
Participating Frequently
January 17, 2008
oops, didn't see r_critchlow's reply before I responded to funkysoul.

Let me try that removeChild command
FreddyUAuthor
Participating Frequently
January 17, 2008
Thanks for the reply, but I seem to be completely clueless with ActionScript. How would I make that work only after the play button has been pressed?
Known Participant
January 17, 2008
It depends on if you want it to hide and reappear later or to be removed from the stage permanently. If you want it gone-gone, use the AS3 removeChild(myButton); command. If you just want it to hide and come back later, use the method outlined by funkysoul.

I'm not certain what the equivalent command in AS2 would be.

Note: If you are using AS3, modify funkysoul's example and drop the underscore before the word visible.

Hope this helps.
funkysoul
Inspiring
January 17, 2008
instanceNameOfyourClip._visible = false;
does the trick :)