Solved

Is it possible to hide layer in action script

Posted on 2002-06-03
8
256 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
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 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),

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Inserting a pop up image to a scanned PDF 5 459
Online Course Not Responding 3 96
video live streaming 1 125
Actionscript in Flash 3 71
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

856 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