Link to home
Start Free TrialLog in
Avatar of rgarimella
rgarimella

asked on

Dynamic Variables

Hi,

How do I assign dynamic variables in a loop??    

q1Answered = 0
q2Answered = 0

var frameArray = [320, 1260, 1700, 2211, 2810]
         for (var i = 0; i<frameArray.length; i++){
          if ((frameArray[i] == vdload._currentframe) && (Q[i+1]+Answered == 0)){
               _parent.popup.gotoAndPlay("L"+[i+1]+"_Incorrect");
                 vdload.stop();
                          q[i+1]+Answered = 1;
                }
           }
 
In this case the popup does not fire up. But if it is written as Q1Answered == 0 and q1Answered = 1;then the popup fires up.

Any ideas
Avatar of Drakkon
Drakkon

for the Q[i+1]+Answered instead do _root["Q"+(i+1) + "Answered"]
ASKER CERTIFIED SOLUTION
Avatar of muso120999
muso120999

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgarimella

ASKER

In This case both the answers do not work

Okay, firstly it is case sensitive, so you will need to use "q" rather than "Q".  Secondly, I don't know where your loop resides, so try my code with _root rather than this (as in Drakkin's suggestion)...
Oops you are right

It was case sensitive

Thanks
My bad