Solved

Iterative Variables in Actionscript 2

Posted on 2013-12-04
2
303 Views
Last Modified: 2013-12-05
If I copy the currentText output from the trace below and paste it into the code and append a "._visible = false", the item is rendered invisible.

Referring directly to the currentText variable, however, doesn't work. There are no errors. It just doesn't do anything! I suspect I have set up the variable wrong even though the trace output comes out correctly.


stop();
numberOfQuestions = 10;

//safetyExpectations.safetyExpectations1.safetyExpectationsText1._visible = false;
safetyExpectations.safetyExpectations1.mc_check_1._visible = false;
safetyExpectations.safetyExpectations1.check1_btn._visible = false;

for (i = 1; i < numberOfQuestions; i++) {
currentText = ["safetyExpectations.safetyExpectations"+i+".safetyExpectationsText"+i];
trace (currentText);
currentText._visible = false;
}

Open in new window

0
Comment
Question by:Karessa
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39698304
Use the following :
stop();
numberOfQuestions = 10;

//safetyExpectations.safetyExpectations1.safetyExpectationsText1._visible = false;
safetyExpectations.safetyExpectations1.mc_check_1._visible = false;
safetyExpectations.safetyExpectations1.check1_btn._visible = false;

for (i = 1; i < numberOfQuestions; i++) {
	currentText = safetyExpectations["safetyExpectations"+i]["safetyExpectationsText"+i];
	trace (currentText);
	currentText._visible = false;
}

Open in new window

0
 

Author Closing Comment

by:Karessa
ID: 39699028
Thank you!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

758 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

23 Experts available now in Live!

Get 1:1 Help Now