Now: Tutorial for Web and Software Design > Flash > Action Script > Flash Content
> Create Password Field and Protect Part of the Flash File [Bookmark it]
Create Password Field and Protect Part of the Flash File

This tutorial was written for the Flash Designer software, which allows you to create flash animations in a much easier way than by using Macromedia Flash. You may get Flash Designer here.

Overview

Create edit text field with "password" attribute. Add "OK" button and define button's "OnClick" event.

Minimum Flash Designer version: 5.0.22

1. Launch Flash Designer and create blank animation. Set frame size ("Frame" > "Frame Size") to 300 x 200.

2. Make the first frame static, choose "Frame" > "Frame Delay", check "Stop" and click OK.

3. Choose "Edit Field" tool and draw the edit field. Choose "Item" > "Edit Properties". Check "password" option and click OK.

4. Choose "Button" tool and draw a button. Choose "Item" > "Edit Properties". Change button text to "OK", click OK to confirm.

5. Make sure the button is selected and choose "Item" > "Actions" > "OnClick". Put the following code, select enter key as the "Shortcut" and click OK:

if(Edit1=="password")
      gotoAndPlay("Frame 3"); // password OK
else
      gotoAndPlay("Frame 2"); // wrong password

6. Choose "Frame" > "New" to add "Frame 2" and "Frame 3".

7. Go to Frame 2 and add "Wrong Password" text with the "Text" tool. Choose "Frame" > "Frame Delay". Uncheck "Stop" and put 1 second. Click OK. Choose "Frame" > "Loop" and choose "Frame 1", click OK.

8. Go to Frame 3 and add "Password OK" text with the "Text" tool.

9. Press F9 to preview the animation.

Double password option

If you wish to use more than one password and create different secure areas use the following method:

1. Create 4 frames ("Frame 1", "Frame 2", "Frame 3" and "Frame 4")

2. On Frame 1 draw edit field (Edit1) and OK button

3. OK button "OnClick" action:

framelabel = "Frame 2";
if(Edit1=="password1") framelabel = "Frame 3";
if(Edit1=="password2") framelabel = "Frame 4";
gotoAndPlay(framelabel);

4. Put on Frame 2 "Invalid password" text

5. On Frame 3 put "Content 1" text, on Frame 4 put "Content 2" text, set Frame 3 and 4 duration to "Stop"

6. Set Frame 2 loop to "Frame 1" (select "Frame 2", choose "Frame" > "Loop" command and choose "Frame 1" as the target)

Download source project t1021.zip


[Bookmark][Print] [Close][To Top]
  • Prev Article-Flash:

  • Next Article-Flash:
  • Related Materias
    Introduction to ActionScri
    Examples of ActionScript 2
    Attaching Movie Clips usin
    Creating the Illusion of S
    Create Flying Hearts Effec
    Smooth Scrollbar
    Typewriter Effect
    Simple Authentication Syst
    Creating Sound Control
    Movie and Image Preloader 
    Topics
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Graphic Design Tutorial
     

    Coreldraw Tutorial

      Illustrator Tutorial
      3D Graphics Articles
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial&Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial&Articles
     

    XML Style Tutorial

      AJAX Tutorial
      XML Mobile
    Flash Tutorial&Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial&Articles
     

    Linux Tutorial

      Symbian Tutorial
      MacOS Tutorial