Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
preloadNetThing Behavior
Find CD Drive - Using Wierd File
Gallery navigator
Vdig Xtra for Windows by Abstract Plane
TAGGuard
Official Adobe Photoshop 5.0 Studio Techniques
The Director Podcast
Get OS Language
Move MIAW
Windows NT and Audio
 

 

 

Behavior Password Field

Added on 7/8/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

Rating:

Author: MediaMacros (website)

Use this on a field to require password access to a projector. Paramaters include the correct password, where to go if correct, and the number of allowed attempts.

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know.  :-)

property spriteNum, password, theMarker, tries, currentword, totaltries

on beginSprite me
  tries = 0
  currentword = ""
  sprite(spriteNum).member.text = ""
  sprite(spriteNum).member.editable = true
end

on keyDown me
  if tries = void then tries = 0
  if the key = return then
    dontpassevent
    if currentword = password then
      go theMarker
    else
      alert "Incorrect password."
      tries = tries + 1
      if tries >= totaltries then
        alert "Invalid User"
        quit
      end if
      currentword = ""
      sprite(spriteNum).member.text = ""
    end if
  else
    dontpassevent
    if the keycode = 51 then
      if currentword.char.count > 1 then
        howMany = (currentword.char.count - 1)
        put howmany
        currentword = currentword.char[1..howmany]
      else
        currentword = ""
      end if
    else
      if "1234567890abcdefghijklmnopqrstuvwxyz-. " contains the key then
        currentword = currentword & the key
      end if
    end if
    theText = ""
    if currentword.char.count > 0 then
      repeat with x = 1 to currentword.char.count
        thetext = thetext & "*"
      end repeat
    end if
    sprite(spriteNum).member.text = thetext
  end if
  
end

on getPropertyDescriptionList me
  p_list = [:]
  addProp p_list, #password, [#format : #string, #default : "myPassword", #comment : "The password:"]
  addProp p_list, #theMarker, [#format : #marker, #default : #next, #comment : "Where to go if correct:"]
  addProp p_list, #totaltries, [#format : #integer, #default : 4, #comment : "Number of tries:"]
  return p_list
end

on getBehaviorDescription me
  return "Use this on a field to require password access to a projector.  Paramaters include the correct password, where to go if correct, and the number of allowed attempts."
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail