Link to home
Start Free TrialLog in
Avatar of nosleep
nosleep

asked on

Is it possible to hide layer in action script

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
ASKER CERTIFIED SOLUTION
Avatar of Zeffer
Zeffer
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rootdir
rootdir

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

Cheers
RootDir
Avatar of nosleep

ASKER

First, thank You for quick response

Question:

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
nosleep
nosleep --

You can assign an instance of a movie clip to any variable and it will proceed with correct associativity. So, yes.
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]

Z
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

OBCT
EE Cleanup Volunteer