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
ADOXtra
3D games online. New cosmic world of Tensoric.
MMX
Easy Animation
RADStingList (Free Version)
Set ButtonsEnabled Property of a Flash Sprite
Check QuickTime Version
Play different Movies For Different Game Levels
bubbleSortForStrings AND bubbleSortForStringLists
Library dmm_cdext - Audio CD Controller
 

 

 

Behavior Font Style Change

Added on 5/26/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: MediaMacros (website)

This behavior will change the font style fo selected characters in an editable field. Call using sendSprite or sendAllSprites and the fontstyle to toggle.. sendSPrite(1, #toggleStyle, #bold)

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


property spriteNum

on toggleStyle me, whatStyle
  theSelect = sprite(spriteNum).member.selection
  --fix if the selection sstarts with 0
  if theSelect[1] = 0 then
    if theSelect[2] <= 0 then
      exit
    else
      theSelect[1] = 1
    end if
  end if
  if theSelect[1] = theSelect[2] then
    --nothing selected
    exit
  end if
  currentStyle = sprite(spriteNum).member.char[(theSelect[1] + 1)..theSelect[2]].fontstyle
  if currentStyle.getOne(#plain) <> 0 then
    currentStyle = []
  end if
  if whatStyle = #plain then
    currentStyle = [#plain]
  else
    if currentStyle.getOne(whatStyle) <> 0 then
      --already there, remove it
      currentStyle.deleteOne(whatStyle)
    else
      currentStyle.add(whatStyle)
    end if
  end if
  sprite(spriteNum).member.char[(theSelect[1] + 1)..theSelect[2]].fontstyle = currentStyle
end

on getBehaviorDescription me
  describe = "Drop this on an editable text sprite to allow toggling of #bold, #italic, #plain, and #underline."
  describe = describe & return & "Call like this..." & return & "sendSprite(1, #toggleStyle, #bold)"
  return describe
end

 


Contact

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

Send e-mail