-
Mouse events in CS3
I used to play around with flash during the early days of action script 1.
but now i can't seem to find my way around it. Used to be able to add the script to the button itself.
here is my problem.
I have 2 object movie clip instance
object_red and object_blue
and I have 2 buttons
show_switch and hide_switch
what I want to do is to have a toggle button show and hide
the objects on the movie.
how do i do this? please help.
thank you
-
Developing For Dunkets
With AS3 you cannot put actionscript on objects anymore. The reasons why are numerous and overall it's a really great thing but I can totally understand how confusing that is if you haven't used it in a while.
The simplest method of doing what you are wanting to do is by giving each object on the stage an instance name. If you click the object and then go to the properties panel in you can add an instance name there. Name the objects object_red and object_blue. I'm sorry if you already know this but I'm trying to start at the beginning!
Then, create a blank layer and call it something like actions or code or scripts, it doesn't matter. The instance names also don't matter but for the sake of the example.
To apply actions to the objects now you click on the blank layer, open the actions window, and type in something like:
PHP Code:
object_red.addEventListener(MouseEvent.MOUSE_DOWN, RedDown);
function RedDown(e:Event){ object_blue.alpha = 0; }
That will make your blue object turn completely opaque when you click the red button. I'm not understanding exactly what you are wanting and which button should show what or hide what but this should get you started again. Let me know if this helps or if you need more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|