Solved

Changing the properties of an object

Posted on 2007-11-20
2
1,092 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 500 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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

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…
Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

734 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