Solved

Changing the properties of an object

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

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…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 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