Copy link to clipboard
Copied
I was wondering if someone could help me with a simple bit of action script 3. I need to make a movie clip (single_mc) disappear when the user clicks on the mouse (stop_btn). Here’s what I have so far.
function setProperty(event:MouseEvent):void
|
{
single_mc.alpha=0;
}
stop_btn.addEventListener(MouseEvent.CLICK, setProperty);
Also I was wonder if you could recommend an Action script 3 book for me. I would like one that is not a training book, but has situations and then the script written out. For example: I click a button and a movie symbol disappears from the stage. I am a graphic artist, that from time to time, needs simple interaction in flash, but cant justify the time to learn the script.
Thanks for your time
Copy link to clipboard
Copied
Your code looks fine. IF it is not working for you, are you getting error messages? HAve you assigned those instance names to those objects on the stage?
Copy link to clipboard
Copied
use the snippets panel to help with you with sample code for basic tasks.
function setProperty(event:MouseEvent):void
{
single_mc.visible=false;
}
stop_btn.addEventListener(MouseEvent.CLICK, setProperty);
Copy link to clipboard
Copied
refer the below sample code.
show_btn.addEventListener(MouseEvent.CLICK, showme);
hide_btn.addEventListener(MouseEvent.CLICK, hideme);
function showme(Event:MouseEvent):void
{
your_mc.visible = true;
}
function hideme(Event:MouseEvent):void
{
your_mc.visible = false;
}
or you can hide and show your movieclip using one button also. for this refer the below code.
your_btn.addEventListener(MouseEvent.CLICK, hideshow);
function hideshow(Event:MouseEvent):void
{
if(your_mc.visible == true)
{
your_mc.visible = false;
}
else
{
your_mc.visible = true;
}
}
hope...this will help you
Copy link to clipboard
Copied
Thank you very much the second script did just what I wanted.
Also I was wonder if you could recommend an Action script 3 book for me. I would like one that is not a training book, but has situations and then the script written out. For example: How to click a button and a movie symbol disappears from the stage. I am a graphic artist, that from time to time, needs simple interaction in flash, but cant justify the time to learn the script.
Thanks for your time
Copy link to clipboard
Copied
Though you might like to see the finished product