Is it possible to hide layer in action script

Posted on 2002-06-03
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 250 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 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" only to hide layers while you are working on the 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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 Movie...and a 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 250 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Video sharing with user login 3 215
Adobe indesign suite cs5.5   How to enable "indesign" capability? 2 215
Text Transformation using ActionScript 3 5 172
flash professional 3 31
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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 how to load their YouTube profile onto Flash Media Live Encoder.

685 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