Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Changing the properties of an object

Posted on 2007-11-20
2
Medium Priority
?
1,100 Views
Last Modified: 2012-05-05
I am trying to learn Flex, which uses actionscript 3.  Apparently Actionscript 3 does not allow the use of the eval() function.
what i have is an array of strings
private static var gridA:Array = ["b1","b2","b3","b4","b5","b6","b7","b8","b9"];
this is in a file called Word.as
in myApp.mxml i have 9 text inputs with the IDs that correspond to the text in the array(gridA)

when a button is clicked in myApp.mxml it calls a function in Word.as
one of the arguments to the Word.as function is the this scope

so what i am trying to do in Word.as is as follows
take the psuedo function that would be in Word.as

 public function a(objGlobal:Object):void{
  var randNum:int = 1+(Math.random()*9);
  eval("objGlobal."+gridA[randNum]).visible=false;
  //should evaluate to objGlobal.b1.visible=false; but it doesnt cant use eval
}

i cannot use eval() so how can i change the property of a random text input?

0
Comment
Question by:jduawa
2 Comments
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 2000 total points
ID: 20321465
See these

http://www.colettas.org/?p=17
http://www.colettas.org/?p=193


I think this may work for you

objGlobal[ gridA[randNum] ].visible = false;
0
 
LVL 1

Author Comment

by:jduawa
ID: 20321482
thought i tried that...guess not
thanks
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

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

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Aerodynamic noise is the cause of the majority of the noise produced by helicopters. The inordinate amount of noise helicopters produce is a major problem in the both a military and civilian setting. To remedy this problem the use of an aerogel coat…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

824 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