Solved

*movie clip visible with variable*

Posted on 2004-10-07
9
270 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 500 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
Independent Software Vendors: 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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
Text To Speech Reader For Adobe Flash Pages 4 962
Java and adobe flash updates 4 58
Play RTMP without Flash 3 752
HTML 5 video and audio or Flash 1 66
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

749 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