6 Replies Latest reply: Aug 4, 2012 11:11 PM by Pettas RSS

    Components Problem

    Pettas

      Hey guys, i have this code:

       

      var square:Sprite = new Sprite();

                          addChild(square);

                          square.graphics.beginFill(0xFFFFFF);

                          square.graphics.drawRect(0,0,100,100);

                          square.graphics.endFill();

                          square.alpha = 1;

                          square.x = mouseX;

                          square.y = mouseY;

       

                          var itemname:TextFormat = new TextFormat;

                          itemname.x = square.x + 10;

                          itemname.y = square.y + 10;

                          itemname.color = "0xFFFFFF";

                          itemname.text = phpVar1;

       

                          /*var iconimage:UILoader = new UILoader;

                          iconimage.source = phpVar2;

                          iconimage.x = square.x/3;

                          iconimage.y = square.x + 20;*/

       

                          if(phpVar3 != "0"){

       

                          var armor:TextFormat = new TextFormat;

                          itemname.x = square.x + 10;

                          itemname.y = square.y + 30;

                          itemname.color = "0xFFFFFF";

                          itemname.text = phpVar3;

                          }

       

                          if(phpVar4 != "0"){

       

                          var damage:TextFormat = new TextFormat;

                          itemname.x = square.x + 10;

                          itemname.y = square.y + 40;

                          itemname.color = "0xFFFFFF";

                          itemname.text = phpVar4;

                          }

       

                          if(phpVar5 != "0"){

       

                          var critical:TextFormat = new TextFormat;

                          itemname.x = square.x + 10;

                          itemname.y = square.y + 50;

                          itemname.color = "0xFFFFFF";

                          itemname.text = phpVar5;

                          }

       

                          if(phpVar6 != "0"){

                          var life:TextFormat = new TextFormat;

                          itemname.x = square.x + 10;

                          itemname.y = square.y + 60;

                          itemname.color = "0xFFFFFF";

                          itemname.text = phpVar6;

                          }

       

                          var story:TextFormat = new TextFormat;

                          itemname.x = square.x + 10;

                          itemname.y = square.y + 70;

                          itemname.color = "0xFFFFFF";

                          itemname.text = phpVar7;

       

      But the output says that

       


      Access of possibly undefined property [some property] through a reference with static type flash.text:TextFormat.

       

      Whats wrong?