3 Replies Latest reply on Jan 10, 2010 5:01 AM by Ned Murphy

    Load package in AS2

    destroyerk

      Hi,

       

      I have some problem loading my package in AS2.0. Can someone help me?

       

      Here's my code. At Frame 1

       

      var myTest:test = new test();

      addChild(myTest);

       

      My test.as

       

      package {
        import flash.display.Sprite;
        import flash.text.TextField;
        import flash.text.TextFieldType;
        import flash.text.TextFormat;
       
        public class test extends Sprite {
          protected const INFMT:TextFormat = new TextFormat("_sans", 12, 0x505050);
          protected var nameTF:TextField;
          protected var phoneTF:TextField;
          protected var emailTF:TextField;

          public function test() {
            nameTF = makeInputTextField();
            nameTF.text = "Your name";
            nameTF.maxChars = 40;
           
            phoneTF = makeInputTextField();
            phoneTF.text = "Your phone number";
            phoneTF.maxChars = 20;
            phoneTF.restrict = "0-9()\\-";
           
            emailTF = makeInputTextField();
            emailTF.text = "Your email address";
            emailTF.maxChars = 40;
            emailTF.restrict = "a-zA-Z0-9_\\-+=~!@#$%\\^.";
          }
         
          protected function makeInputTextField():TextField {
            var tf:TextField = new TextField();
            tf.type = TextFieldType.INPUT;
            tf.border = true;
            tf.defaultTextFormat = INFMT;
            tf.width = 300;
            tf.height = 18;
            tf.y = numChildren * 26;
            addChild(tf);
            return tf;
          }
        }
      }

       

      Thanks.

       

      Regards,

      Destroyerk