Solved

Changing the properties of an object

Posted on 2007-11-20
2
1,087 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 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

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…
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

20 Experts available now in Live!

Get 1:1 Help Now