variable = movie clip in the array - actionscript-3

I have an array thats contains movie clips, I have a variable selected. I wont when the movie clips is clicked variable selected = this movie clips
in as2 I use
selected = this.getDepth();
How in as3.0?

Related

Hidden objects on one frame need to stay hidden when returning to the frame

I have created point and click games in AS2 but now developing in AS3. When you click an object to add to your inventory the object is .visible=false; Then when you leave a room (frame) and return the object would still remain .visible=false;
I achieved this in AS2 using the following:
(set up of a movieclip instance MCTake)
var MCTakeVisible;
MCTake._visible=MCTakeVisible;
(when I click the movieclip)
MCTake._visible=false;
MCTakeVisible=false;
MCTake._visible=MCTakeVisible;
Now the object is gone no matter how many times I return back to the frame. My question is what is the AS3 equivalent to this behavior.
Also vise-versa. If an object is hidden at first and made to appear like an open door that stays open. I used the following for that in AS2:
if(MCTakeVisible == undefined) MCTakeVisible = false;
Thank you in advance.

As3 flash button in a movie clip

all I am trying to get a button I placed inside a movie clip to change the scene on my main timeline.
this is what I have right now:
on the main timeline,
the scene that has the movie clip is called (girl_tone_control) and the scene that I want to go to is called (girl_outfit_v1)
inside the movie clip on (girl_tone_control), I have a button on a frame with the instant name letsgo_btn.
I then have another layer in the same movie clip as the button called actions
with this code
import flash.events.MouseEvent;
letsgo_btn.addEventListener(MouseEvent.CLICK, letsgo1);
function letsgo1(e:MouseEvent):void
{
MovieClip(root).gotoAndPlay(1,'girl_outfit_v1');
}
I don't know if this is correct every time I test it out hoping to go to scene (girl_outfit_v1) it doesn't work and I get the error
ArgumentError: Error #2108: Scene girl_outfit_v1 was not found.
at flash.display::MovieClip/gotoAndPlay()
at wwe2_girl_tone_control_fla::girl_select_1/letsgo1()
can anyone help?
I would advice you to double check the scene name as it must work, or attach your fla to let me check what's wrong

how do I link a button inside a movie clip into the mainframe (flash CS6 AS3)

i have made a movie clip with some buttons inside. The idea behind this was to allow a scrolling system to be used. The only problem is i can't seem to figure out how to link a button inside a movie clip with a frame from outside of the movie clip and on the main stage.
My code atm is:
stop();
import flash.events.MouseEvent;
sports1.addEventListener(MouseEvent.CLICK,sport1)
function sport1(e:MouseEvent)
{
MovieClip(root).gotoAndStop(sports)
}
What i would like to happen is that each button inside the movie clip will take me to a certain frame on the main stage, like a navigation system. I am really new to flash so i may not understand all the technical terms yet, so be easy on me :)
So if you are creating a Main Movie Clip on the Stage and have inner Movie Clips that are acting as buttons. You want those inner buttons to take you to different frames on the main stage when the user interacts with them.
This is how you would do so.
What you would need to do as you already done give the Main Movie clip holding the inner buttons an instance name sports1 any inner button would also need an instance name say a button has an instance name of mcButton to access that button you would need to call on it like so:
sports1.mcButton.addEventListener(MouseEvent.CLICK,sport1)
sports1.mcButton.buttonMode = true;
then if you want that button when clicked to go to frame 2 on the main stage you would simply do this in the sport1function:
function sport1(e:MouseEvent):void
{
gotoAndStop(2);
}
I threw in the sports1.mcButton.buttonMode = true; that way it shows that it is interactive ie click able

instruct AS3 gotoAndPlay

I have an AS3 movie clip that I want to return to first frame whenever it reaches the last frame.
The movieclip instance name is sym2.
I tried -
_root.sym2.gotoAndPlay(1);
and
sym2.gotoAndPlay(1);
but it doesn't work.
How can I instruct the movie clip to restart playing from first frame ?
regards
Here is a good way of writing it without writing inside frames:
var backToStart:Function = new Function(){
gotoAndPlay(1);
}
yourMovieClip.addFrameScript(yourMovieClip.totalFrames, backToStart);
//place this in the constructor

Actionscript 3 - Toggling visible status of a Movie Clip

I have a MovieClip of instance name BeachMovie.
On the same frame I have another MovieClip, inside this MovieClip is actionscript that will play sounds and toggle pictures on and off. It is also used so that when pressed the .visible status of BeachMovie is toggled on and off.
How can I communicate with BeachMovie MovieClip when the actionscript to do it is used (and is needed) within another Movieclip?
Ideally your instance names should begin with a lowercase letter.
Try
this.parent.beachMovie.visible = false;
or MovieClip(root).beachMovie.visible = false;