1 Reply Latest reply on Nov 26, 2007 5:23 AM by Greg Dove

    Array Problem

    Yue_Hong Level 1
      yellow_btn.onRelease=function(){
      setShip("yellow");
      }
      red_btn.onRelease=function(){
      setShip("red");
      }
      function setShip(color:String){
      var newColor:Color =new Color(ship_mc.shipColor_mc)
      trace(dataLoader[color+"[0]"]
      newColor.setRGB(dataLoader[color+"[0]"])
      ship_mc._xscale =dataLoader[color+"[3]"]
      ship_mc._yscale =dataLoader[color+"[3]"]
      }

      Why is that this function is not working? How should I write to make it works?
        • 1. Array Problem
          Greg Dove Level 4
          I'm not sure exactly what you're trying to do.

          is dataLoader an object with color properties for each "ship/color"

          like :
          dataLoader.red = [0x00ff00,"?","?",50,50]

          if yes, then maybe you should be doing it like this:
          trace(dataLoader[color][0])
          newColor.setRGB(dataLoader[color][0]);

          etc.

          if not, then you'll need to explain what dataLoader is.