Is it possible to hide layer in action script

Posted on 2002-06-03
Medium Priority
Last Modified: 2007-12-19
Hello !
I am developing card game , and I have one question
- card rotates around self displaying front side , than back side , and than again front side,
- i put each card in different layer,
- all card layers are in desing mode set to hidden,

in action script I want to show only layer for card of my choice
Is this possible, or should i have another apporach

Thank You, in advance

Ante Blaskovic
Question by:nosleep
LVL 23

Accepted Solution

Zeffer earned 1000 total points
ID: 7052669
I think another approach is the way to go Ante
as you are expecting Flash and ActionScript to
do things it was not designed to do...like control
the visibility of individual layers.

The visiblity of layers in design mode..I assume that
is what "all card layers are in desing mode set to hidden"..means..is only to hide layers while you are working on the content..so the work space doesn't get cluttered and you can easily track the content of an individual layer.(by hiding the others)

ActionScript can control the visibility of an OBJECT
(one of your cards say)in a layer after you have given it a name in the INSTANCE panel.
By refering to this name ActionScript can control
the _alfa properties, by you defining a value between
0-100 or the visibility, by declaring it TRUE or FALSE.

Hope this is a help.



Expert Comment

ID: 7052967
very simple,

You have to create seperate movies for each card(rotetes front, back, front). Give proper name for each movie.

For simplicity, choose present card layer then select frames. Paste these selected frames inside new movie(for each card).

On stage you can call these movies as you needed by 'loadmovie' function(consider levels for each movie while calling). You can hide movie by '_visible' property or you can apply filter 'alpha'.

If you do not needed these movies on stage then you can use function 'unloadmovie'.

As Z said if you hide layers in design mode, still you can see these layers at runtime and you cannot control layers in runtime. To achive this you have to create each card movie as I stated above


Author Comment

ID: 7053625
First, thank You for quick response


Can I solve problem with this approach ?

I have movie Clip Card1 with layers
  back     --inst1--         --inst1--
  front             --inst2--

inst1 is instance of cardback.jpg
inst2 is instance of cardfront.jpg

Now if I have:
instTemp which is instance of cardfront2.jpg (another card)

can I in script assign instTemp to inst2
exmp:  instTemp = inst2 or something like this

Thank You , in advance
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.


Expert Comment

ID: 7054714
nosleep --

You can assign an instance of a movie clip to any variable and it will proceed with correct associativity. So, yes.
LVL 23

Expert Comment

ID: 7054976
Go to Flash Help..ActionScript Reference /working with
movie clips/working with movie clips:Overview..
read this and the subject below it.. About multiple
timelines..and you will get a clearer idea of how to
do what you are asking.

Any movie clip can replace any other movie clip..but
you will need to learn how to call a clip (which requires
an EVENT..leg..on mouseOver....an ACTION..eg..Load Movie...and a TARGET..eg..card1...) so the player knows
when to call a clip, what to do with it and where to put it.
[what I have written above is NOT ActionScript just a
description of it]


Assisted Solution

rootdir earned 1000 total points
ID: 7065683
"can I in script assign instTemp to inst2 "

Yes you can do this inside new flash version flash mx. But you can do this only with jpg files.

Use loadmovie function and set target as 'instTemp'. So it look like(check for full path of jpg file),


That's it


Expert Comment

ID: 10331139
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between Zeffer & rootdir

Please leave any comments here within the next four days.


EE Cleanup Volunteer

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question