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
Acrobat Reader
Import Quicktime Movies
Flash Rotator
Amara Flash Intro and Banner Builder
Get properties in a range of castmembers
Sub Hunt
Sarah"s Multiuser Pages
Move Window [ stage or MIAW ]
Sound Play/Stop
Macromedia Director 8.5 Shockwave Studio for 3D: Training from the Source
 

 

 

Behavior Home, End, Page Up, Page Down with Text Members

Added on 12/29/2005

 

Compatibilities:
behavior D8_5 D9 Mac PC Shockwave

This item has not yet been rated

Author: Chunick (website)

This behavior script can be attached to a field or text member. It will allow the user to use the Home, End, Page Up, and Page Down keys as they were intended when editing a text/field member.

property spriteNum, pSprite, pMem

on beginSprite me
  pSprite = sprite(spriteNum)
  pMem = pSprite.member  
end

on keyDown me
  Case the keyCode of
    115: -- Home  
      aChar = pMem.selection
      theLocV = pMem.charPosToLoc(aChar[2] + 1)[2]
      theChar = pMem.LocToCharPos(point(0, theLocV)) - 1
      pMem.selection = [theChar, theChar]
      
    119: -- End
      aChar = pMem.selection
      theLoc = pMem.charPosToLoc(aChar[2] + 1)
      theChar = pMem.LocToCharPos(point(pMem.width, theLoc[2])) - 1
      if pMem.char[theChar] = " " then theChar = theChar - 1
      pMem.selection = [theChar, theChar]
      
    116: -- Pg Up
      pMem.scrollTop = max(0, pMem.scrollTop - pSprite.height)
      
    121: -- Pg Down
      pMem.scrollTop = min(pMem.height - pSprite.height, pMem.scrollTop + pSprite.height)
      
    otherwise
      pass
      
  end Case
end

 


Contact

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

Send e-mail