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
Flash Rotator
Cells Xtra
Multi Cropper
ADOXtra Lite
simBrowser1.0
Title Name MIAW
Dither Black and White Image - Imaging Lingo
Screen Saver Wizard
OS Control
Royalty Free Music from NEO Sounds
 

 

 

Behavior 80's Arcade High Score Name Entry Behavior

Added on 9/2/2005

 

Compatibilities:
behavior D8 D8_5 D9 Mac PC Shockwave

This item has not yet been rated

Author: Chunick (website)

Attach this behavior to a text or field member. You will have to make sure the member is of the right size and such... I suppose I could add all that into a GPDL for you, but that'd be more work for me. ;-) Anyways, the key here is MAKE SURE TO CHOOSE A MONOSPACED FONT!!!!! If you don't know what I'm talking about then Google it.

- Traditional High Score Name Entry -- and other filters
-- 2005 by Josh Chunick

property spriteNum, pSprite, pMem, pCount

on beginSprite me
  pSprite = sprite(spriteNum)
  pMem = pSprite.member
  pMem.editable = False
  pCount = 1
  pMem.text = "AAA"
  Case pMem.type of
    #text:
      pMem.fontStyle = [#plain]
      pMem.char[pCount].fontStyle = [#underline]
    #field:
      pMem.fontStyle = "plain"
      pMem.char[pCount].fontStyle = " underline"
  end Case
  the keyDownScript = string(pSprite) & ".keyDown()"
end

on keyDown me
  if keyPressed(123) then
    theNum = charToNum(pMem.char[pCount]) - 1
    if theNum < 33 then theNum = 96
    pMem.char[pCount] = numToChar(theNum)
  end if
  
  if keyPressed(124) then
    theNum = charToNum(pMem.char[pCount]) + 1
    if theNum > 96 then theNum = 33
    pMem.char[pCount] = numToChar(theNum)
  end if
  if pMem.type = #field then pMem.char[pCount].fontStyle = "underline"
  if keyPressed(RETURN) then
    if pCount > 3 then
      Case pMem.type of
        #text:
          pMem.fontStyle = [#plain]
        #field:
          pMem.fontStyle = "plain"
      end Case
    else
      pCount = pCount + 1
      Case pMem.type of
        #text:
          pMem.fontStyle = [#plain]
          pMem.char[pCount].fontStyle = [#underline]
        #field:
          pMem.fontStyle = "plain"
          pMem.char[pCount].fontStyle = " underline"
      end Case
    end if
  end if
end

on endSprite me
  the keyDownScript = EMPTY
end

 


Contact

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

Send e-mail