3 Replies Latest reply on Oct 1, 2010 4:27 PM by Ned Murphy

    Some variable problems.

    kyzn

      I have a question, so I'd appreciate your helping if you do. So, here is the problem. It is AS2.0 btw.

       

      s=0;
      
      if(s == 0){
      //action here.
      }
      

       

      This is quite normal, no problem here. s is a variable. But what I was trying code was,

       

      s0=0;
      s1=0;
      
      q=random(2);
      
      if("s"+q == 0){
      //action here.
      }
      

       

      Of course, it didn't work. I wanted flash to check if s0 (or s1 according to random) equals to 0 or not. Then I tried to define another variable,

       

      s0=0;
      s1=0;
      
      q=random(2);
      
      qq="s"+q
      
      if(qq==0){
      //action here
      }
      

       

      Unfortunately, I got nothing again. Because qq is not s1 (or s0 according to random function), it was "s1" (or "s0", whatever.)

       

      So, that's where I'm stuck. Can anyone help me?