[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

*movie clip visible with variable*

Posted on 2004-10-07
9
Medium Priority
?
273 Views
Last Modified: 2008-02-01
var currentComponent = "firewall";
trace (currentComponent);
_root.currentComponent._visible = false;

why can I not use a variable for the instance name?
0
Comment
Question by:gmailrules
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 10

Accepted Solution

by:
muso120999 earned 2000 total points
ID: 12252847
Because it's a string, not a movieclip object.  However, you can reference an object by using a string like:

 var currentComponent = "firewall";
trace (currentComponent);
_root[currentComponent]._visible = false;
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12252877
Another note:

the square brackets enable you to reference anything by:
container[propertyName];

and you can even call a function by:
var functionName = "myFunction";
_root[functionName]();

- the () indicate to Flash that it is a function.
0
 
LVL 1

Author Comment

by:gmailrules
ID: 12252904
Thanks once again Muso :)
0
Industry Leaders: 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!

 
LVL 10

Expert Comment

by:muso120999
ID: 12252925
Glad to help :-)

btw does gmail really "rule" then!?
0
 
LVL 1

Author Comment

by:gmailrules
ID: 12252935
yeah, you want an invite?
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12252950
Sure, interested.  What's involved?
0
 
LVL 1

Author Comment

by:gmailrules
ID: 12252971
just tell me your email and I send you an invite, and you make a free gmail account.
0
 
LVL 10

Expert Comment

by:muso120999
ID: 12252990
muso <at> fusionsite.co.uk

thanks :-)
0
 
LVL 1

Author Comment

by:gmailrules
ID: 12253027
sent!
0

Featured Post

Industry Leaders: 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

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,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
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.

649 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