Solved

Is it possible to hide layer in action script

Posted on 2002-06-03
8
246 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
8 Comments
 
LVL 23

Accepted Solution

by:
Zeffer earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Expert Comment

by:SuperMario
Comment Utility
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
Comment Utility
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 250 total points
Comment Utility
"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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
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 what frame rate is, how to control it and what effect it has on the video.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now