Puneet
Puneet

Reputation: 585

How to access/hide/show Layers from ActionScript [Flash CS5]

I have 2-3 layers in my movie clip and i wanto access them using ActionScript code.
I want to show hide and access Elemts(buttons, text box) in that layer.

So how can i do that using ActionScript-3

Thanks.

Upvotes: 2

Views: 15546

Answers (2)

Mnyikka
Mnyikka

Reputation: 1261

This is how I did it,

You cannot hide layers in actionscript.

You can put what you want to hide or show as a movieclip object.

Just go to insert and insert a movieclip object.

After this, put the movieclip object on the layer, just the same way you put images onto a layer.

However you must name this instance inorder to access it.

So if its called Movie1

this is how you access it,

_root.Movie1:MovieClip;

trace(""+_root.Movie1); //Just to be sure its defined

//To hide it just do this _root.Movie1_visible = false;

//To show it just do this _root.Movie1_visible = true;

Upvotes: 0

shanethehat
shanethehat

Reputation: 15570

You can't access the IDE layers programmatically. The best approach would be to group your layer contents into MovieClips with instance names that you can then call though code.

Upvotes: 4

Related Questions