Skip to main content
October 29, 2010
Question

Urgent help in AS3

  • October 29, 2010
  • 1 reply
  • 271 views

Hi

I'm new in new in this Forum and to As3.

I would really appreciate it if you guys could help me with nuisance that have been bothering for a while now.

I'm trying to make a simple registration page - where the user when typing the right password will go the next page - where he/she can fill in there name and E-mail.

And once they do that and click on the (myNext) button they will be taken to a new page where - Name, Email and any other information is outraced in a new TextField.

If the user would press the (myClear) button instead - then all TextFields should be reset.

I have tried many different ways to solve this and yet I would always get the same error: [TypeError: Error #1009:]

Hence I don't even know where to start to fix this.

I have added my code below

Please help

package
{//01
    import flash.display.MovieClip;
    import flash.events.*;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import flash.text.*;

    public class Flash15 extends MovieClip
    {//02
        private var mypassWordField:TextField;
        private var myNext:Next;

        private var myClear:Clear;

        private var mypassWordFormat:TextFormat = new TextFormat();

        private var myNamn:Namn;
        private var myMail:Mail;

        private var myNamnField:TextField;
        private var myMailField:TextField;
        private var myInfoField:TextField;

        private var myNamnFormat:TextFormat = new TextFormat();
        private var myMailFormat:TextFormat = new TextFormat();
        //private var myInfoFormat:TextFormat = new TextFormat();


              public function Flash15()
              {//03
                  //***
                  mypassWordField = new TextField();
                  addChild(mypassWordField);
                  mypassWordField.width = 100;
                  mypassWordField.height = 24;
                  mypassWordField.border = true;
                  mypassWordField.borderColor = 0xFFFFFF;
                  mypassWordField.background = false;
                  mypassWordField.backgroundColor = 0xFFFFFF;
                  mypassWordField.textColor = 0x99FFCC;
                  mypassWordField.selectable = true;
                  mypassWordField.multiline = false;
                  mypassWordField.wordWrap = true;
                  mypassWordField.type = TextFieldType.INPUT;
                  mypassWordField.maxChars = 6;
                  mypassWordField.restrict = "0-9";
                  mypassWordField.displayAsPassword = true;
                  stage.focus = mypassWordField;
                  mypassWordFormat.font = "Verdana";
                  mypassWordFormat.color = 0xFF0000;
                  mypassWordFormat.size = 23;
                  mypassWordField.defaultTextFormat = mypassWordFormat;
                  mypassWordField.x = stage.stageWidth * .51;
                  mypassWordField.y = stage.stageHeight * .21;
                  //***
                  //********************************************//
                  //***
                  myNext = new Next();
                  myNext.alpha = 0;
                  addChild(myNext);
                  myNext.x = stage.stageWidth * .5;
                  myNext.y = stage.stageHeight * .7;
                  //***

                  myClear = new Clear();

                  myClear.alpha = 0;

                  addChild(myClear);

                  myClear.x = stage.stageWidth * .5;

                  myClear.y = stage.stageHeight * .9;

                  //***
                  stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownEvent);
                  myNext.addEventListener(MouseEvent.CLICK, onNext);

                  myClear.addEventListener(MouseEvent.CLICK, onClear);
              }//03
 
             private function onKeyDownEvent(p_evt:KeyboardEvent):void

             {
                 //trace(p_evt.keyCode);

                 if(mypassWordField.text == "123456" && p_evt.keyCode == 13)              

                 {
                     trace("You are Logged in");
                     myNext.alpha = 1;

                     myClear.alpha = 1;
   
                     CheckIn();
                     CheckEnter();
                     stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDownEvent);
                  }
                 else
                 {
                     trace("WRONG");
                  }
              }
   
              private function CheckIn():void
              {
                  //***
                  var myNamn = new Namn();
                  addChild(myNamn);
                  myNamn.x = 250;
                  myNamn.y = 420;
                  //***
                  var myMail = new Mail();
                  addChild(myMail);
                  myMail.x = 250;
                  myMail.y = 570;
                  //***
               }
 
               private function CheckEnter():void

               {
                   var myNamnField = new TextField();
                   addChild(myNamnField);
                   myNamnField.width = 110;
                   myNamnField.height = 23;
                   myNamnField.border = true;
                   myNamnField.borderColor = 0xFFFFFF,
                   myNamnField.selectable = true;
                   myNamnField.multiline = false;
                   myNamnField.wordWrap = true;
                   myNamnField.type = TextFieldType.INPUT;
                   myNamnField.maxChars = 20;
                   myNamnFormat.font = "Verdana";
                   myNamnFormat.color = 0xFFFFFF;
                   myNamnFormat.size = 15;
                   myNamnField.defaultTextFormat = myNamnFormat;

                   myNamnField.text = "Enter";

                   myNamnField.x = 550;
                   myNamnField.y = 351;
                   //***

                   var myMailField = new TextField();
                   addChild(myMailField);
                   myMailField.width = 200;
                   myMailField.height = 23;
                   myMailField.border = true;
                   myMailField.borderColor = 0xFFFFFF,
                   myMailField.selectable = true;
                   myMailField.multiline = false;
                   myMailField.wordWrap = true;
                   myMailField.type = TextFieldType.INPUT;
                   myMailField.maxChars = 70;
                   myMailFormat.font = "Verdana";
                   myMailFormat.color = 0xFFFFFF;
                   myMailFormat.size = 15;
                   myMailField.defaultTextFormat = myMailFormat;

                   myMailField.text = "Enter";
                   myMailField.x = 550;
                   myMailField.y = 401;
                   //***
               }
 
               private function onNext(evt:MouseEvent):void
               {
                   // New code here!
               }
 
    }//02

}//01

Message was edited by: Tray0001

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
October 29, 2010

click file/publish settings/flash and tick "permit debugging".  the problematic line number will be in the error message.

if that's not enough info for you to solve the problem, highlight the problematic line of code.