Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing property of dynamic instance name 1

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
CA
Yo,

I need to use getValue() with this

Code:
"question0"+i+"_a"+j

but cannot quite figure out how.

Danke.

frozenpeas
 
not quite sure what you mean but

i = 0;
j = 1;
var something = eval("question0"+i+"_a"+j).getValue()
trace(something)

returns false for a checkbox i placed on stage with instance name question00_a1

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Thanks for the reply, Bill. I had tried eval() but it did not work in my application.

But
Code:
this["question0"+i+"_a"+j].getValue()
works for me.

Here is the new problem. This works except for the fact that
Code:
_root.score
is not being incremented; it just stays at 0.

Code:
_root.score = 0;
function onSubmit(){
	for(i=1;i<6;i++){
		for(j=1;j<5;j++){
			((this[&quot;question0&quot;+i+&quot;_a&quot;+j].getValue())==&quot;true&quot;)?_root.score++:null;
		}
	}
	scoreDisplay = &quot;You scored &quot;+_root.score+&quot; out of 5.&quot;;
}

True is returned from that test but score is not being added to. Ideas? Thanks.

frozenpeas
 
code looks fine but for one thing

== &quot;true&quot;

i am sure should be

== true

as its not a string but a boolean being returned

_______________________________________
You know you're old if you can remember when bacon, eggs and sunshine were good for you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top