?
Solved

Is it possible to hide layer in action script

Posted on 2002-06-03
8
Medium Priority
?
263 Views
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
0
Comment
Question by:nosleep
7 Comments
 
LVL 23

Accepted Solution

by:
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.

Z



0
 
LVL 6

Expert Comment

by:rootdir
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

Cheers
RootDir
0
 

Author Comment

by:nosleep
ID: 7053625
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
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:SuperMario
ID: 7054714
nosleep --

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

Expert Comment

by:Zeffer
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]

Z
0
 
LVL 6

Assisted Solution

by:rootdir
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),

loadmovie("cardfront2.jpg","instTemp")

That's it

Cheers,
RootDir
0
 
LVL 9

Expert Comment

by:OBCT
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

OBCT
EE Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

807 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