Solved

AS2 name passing

Posted on 2010-09-23
2
307 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
Comment Utility
you can use eval if you want:

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

Author Comment

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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The viewer will learn how to count occurrences of each item in an array.
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

763 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

12 Experts available now in Live!

Get 1:1 Help Now