Solved

Iterative Variables in Actionscript 2

Posted on 2013-12-04
2
320 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Writing .htaccess to redirect only the index page 3 87
Problem to get function 52 106
Summernote required 3 141
Detailed steps to upload 6 37
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…
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…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The goal of the tutorial is to teach the user how to how to record live broadcast.

777 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