• home
  • forum
  • my
  • kt
  • download
  • Passwords in Flash 5

    Author: 2007-06-14 11:16:59 From:

    Passwords in Flash 5


    Ok, so basically, you want to make a password for a website of another part of a flash movie. I will divide this tutorial into three parts, Part 1 is going to be the text fields. Part 2 will be the button. Part 3 will be the actionscript for the button.

    Part One, TextFields.


    Ok so part one, Open up flash, and make a new movie. The default size will be ok. Ok, This password movie will only take up one frame, on one layer, simple huh.
    Ok, so make a normal 'Static' text box and write 'Password' in it. So it is easier to understand for the viewer. Then in the 'Text Options' box select the sub-tab 'Text Options' and then select the drop box and change it to 'Input Text'. Select the checkbox, 'Border BG' Then change the 'Max Chars.' to 10. Then select every type of 'Embed Font'. Next change the variable name to 'inputPass'.
    "Of course excluding the 's. Also, Make sure it is JUST LIKE THAT. Because flash is CaSe SeNsItIvE. That means that, This is different than tHiS is different than thiS."

    Next make a new text field, only this time change the dropbox to 'Dynamic TextField'. Now UNCHECK the box 'Selectable'. However, Check all the 'Embed Font' Boxes. And this time set the variable to 'display'. "Of course excluding the 's."

    Now we are done with the text fields, now we can move onto the button stage.

    Part Two, Button.


    Ok so now go to Insert > New Symbol or press 'CTRL + F8'. Select the type as Button. Name this button, 'go'.
    In the 'Up' frame, draw your go button, it can be whatever you want. Then in the 'Hit' frame, insert a key frame by pressing 'F6'. Then select your main stage by pressing 'CTRL + E' Or clicking on 'Scene 1' at the top of the movie.
    Then press 'CTRL + L' To open your library, Then drag your new button out onto the stage.

    Now we are done with the button, this step was much easier than the first. Now actionscript!


    Part Three, Actionscript.


    Ok so now you have your button and text fields. Now you just need to make them work.


    So on the button, Right click on it and click the Actions. Then insert the following code, Just copy paste.


    on (release, keyPress "") {
    if (_root.inputPass=="XboX") {
    getURL ("http://www.flashkit.com");
    _root.display = "Right";
    _root.inputPass = " ";
    } else {
    display = "Wrong";
    }
    }


    Ok so now a line by line explaination.
    Ok so the first tells flash, that when the mouse is Released, Or the button Enter is pressed, it does the following code.
    The second line determines whether the user input the correct password.
    _root.inputPass Just tells flash exactly what it is checking.
    _root just tells flash where that text box is located.
    In this case, The box, inputPass MUST equal XboX.

    Remember! Flash is CaSe Sensitive. So the capital X's matter.


    So IF the password in the box inputPass was equal to XboX, then the following code is run, or executed.
    The next line tells flash to run a website, getURL is the command to open a website.
    In another case you could put like gotoAndPlay(5);
    This would tell flash to run the rest of the movie.
    This line sets the bottom display box to say Right, Which tells you, that you got it right.
    Then the next line resets the box that they wrote in. It sets it to nothing, to blank.
    The next line tells flash that IF the password happened not to be XboX then it would execute the following code. Which happens to be display = "Wrong";
    This means that the box would tell you that you got it Wrong.

    Basically that is it. That is the simplest way I could think of to make a password script for flash. I hope this tutorial was of help to you. If you have any questions regarding this or any other subject I will try my best to help. Feel free to email me. Thanks for reading, And thank FlashKit for hosing their great site.

    » Level Intermediate

    Added: : 2002-02-14
    Rating: 7.42 Votes: 44
    Hits: 2106
    » Author
    I am a 16 year old student who wastes his life away learning flash. How fuN! I love it! And I love FK!
    » Download
    Download the files used in this tutorial.
    Download (62 kb)

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      3D (20)
      Math Physics (14)
      3rd Party (5)
      Navigation (60)
      Actionscripting (26)
      Optimization (16)
      Animation (32)
      Projector (9)
      Audio (46)
      Special Effects (112)
      Backend (25)
      Text Effects (65)
      Drawing (18)
      Tips and Techniques (41)
      Dynamic Content (25)
      Tricks (6)
      Games (66)
      Utilities (19)
      Getting Started (71)
      Video (10)
      Interactivity (21)
      Web Design (22)

    New

    Hot