Solved

Changing the properties of an object

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

15 Experts available now in Live!

Get 1:1 Help Now