Solved

AS2 name passing

Posted on 2010-09-23
2
311 Views
Last Modified: 2012-05-10
I am updating multiple calls from hard-coding to a function, passing a variable

var th:String = "round";
var thMask = thSh+"mask";
thisBox.attachMovie(thMask,thMask,70);

The above works as expected. The following is what I have when hard coded:
//gCollisionMask = _level0.workBox.roundmask;

However, I want to pass the value using the following code (which is not correct):
gCollisionMask = _level0.workBox.thMask;

Ican't remember what it should be - should there be brackets around part of it?
0
Comment
Question by:msukow
2 Comments
 
LVL 2

Accepted Solution

by:
phodges4 earned 500 total points
ID: 33748402
you can use eval if you want:

gCollisionMask = eval("_level0.workBox." + thMask);
0
 

Author Comment

by:msukow
ID: 33748826
I also found this works:
gCollisionMask = _level0.workBox[thMask];
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
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 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 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.

776 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