(Flash) Password Tutorial

From Whirled Club Wiki
Jump to navigation Jump to search

Password Tutorial

Layout

Here we'll create a layout for the password. Make sure that you have an idea in mind before reading on about this. Also, along with the idea, have something that the Flash movie will go to if password is entered correctly.


  • Add two text boxes. Add text in one saying "Enter password", the other "Password Here".
    • Click on the "Enter" box and go to properties to set it as Readable Only.
      • Set "Password Here" as an Editable text box.
        • Give different instance names to both boxes. We will need this later.


  • Create a button and give it an instance name, too.

Coding

This coding may vary on how you named the instances, so just change the "buttonOne", "instanceOne", and "instanceTwo" to your assigned instances. YOU CAN GET A BASE THAT WILL HELP GREATLY IN YOUR PRODUCTION HERE


  • Create a layer on top called "Actions", click on it's first frame, and open the coding window.
    • Below will be coding this is needed to be added.
         stop();
         buttonOne.addEventListener (MouseEvent.CLICK, functionOne);
         function functionOne (e:MouseEvent) void: {
{if (instanceOne.text == password) {
         instanceTwo.text = "Correct!";}
         else {instanceTwo.text = "Wrong"}; };


HINTS: If you want to make the password take you to a certain frame add this right next to "Correct!";

         gotoAndPlay(2);

The number in parentheses is the frame number it will take it to.

Troubleshooting Help

  • Make sure that you change "instanceOne" to the instance of your Editable text box.
    • Change "instanceTwo" to the instance of your Readable Only text box.
      • Try experimenting with the coding, but always keep a spare safe copy of the file!
        • If you have any questions that can't be answered here, contact Count


Credits

If you decide to list an item in Whirled shop that was based off this Wiki, please credit me, Count L. Ronnacon. I want an attribution, but only if you used my base.