Solved

*movie clip visible with variable*

Posted on 2004-10-07
9
266 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
  • 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
 
LVL 10

Expert Comment

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

btw does gmail really "rule" then!?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

743 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

10 Experts available now in Live!

Get 1:1 Help Now