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
Movie Slider Control
cXtraWindowsConf
Adventure
Prevent Hour Glass Cursor after AVI Ends
Opening and closing a CD-door behaviour
Add a unique property to a property list
Binary Convertor
Text Search Engine
Move MIAW
Button - De-Xploding behaviour
 

 

 

Behavior Hilite Line

Added on 7/31/1999

 

Compatibilities:
behavior D7 D8 PC Shockwave

This item has not yet been rated

Author: RainerÖhman

This behavior uses a small shape for hiliting lines in a field. It also generates a property list with the line number and the text of the lines. The line text is returned on a mouseUp event.

-- HiLine behavior
-- Rainer Öhman, May 1999


property spriteNum
property pFieldSpriteNum
property pHiliteSpriteNum
property pColor
property pInk
property pBlend
property pNumLines
property pLineHeight
property pFieldWidth
property pLeftSideField
property pTopSideField
property pHiliteRect
property pCurrentLine
property pLineIndexList


on getPropertyDescriptionList
  
  set propList = [:]
  
  addProp propList, #pFieldSpriteNum, [¬
          #default: 1, ¬
          #format: #integer, ¬
          #comment: "Enter field sprite number:"]
  
  addProp propList, #pHiliteSpriteNum, [¬
          #default: 2, ¬
          #format: #integer, ¬
          #comment: "Enter hilite sprite number:"]
  
  addProp propList, #pColor, [¬
          #default: "Yellow", ¬
          #format: #string, ¬
          #range: ["Red", "Blue", "Yellow", "Green", "Grey", "Black"], ¬
          #comment: "Pick hilite color:"]
  
  addProp propList, #pInk, [¬
          #default: 32, ¬
          #format: #ink, ¬
          #comment: "Select hilite ink:"]
  
  addProp propList, #pBlend, [¬
          #default: 20, ¬
          #format: #integer, ¬
          #range: [#min: 10, #max: 100], ¬
          #comment: "Set hilite blend value:"]
  
  return propList
end

on getBehaviorDescription
  set description = ¬
"This behavior uses a small shape for hiliting lines in a field. ¬
It also generates a property list with the line number and the text of the lines. ¬
The line text is returned on a mouseUp event." & RETURN & RETURN &¬
¬
  "Create a small shape cast member and drop in a score channel higher then ¬
the field sprite channel. While selected, go to Modify --> Tweak and ¬
enter -1000 in the horisontal field. This will put the sprite a thousand pixels outside¬
the stage. When the mouse is over the field, the shape sprite used for hilite, will ¬
appear over the line under the mouse, and return off stage when the mouse ¬
leaves the field." & RETURN & RETURN &¬
¬
  "Then drop this behavior on the field on stage and enter the color, ink and blend values, ¬
used to set the hilite mode. Default is a pale yellow color. Use it as a starter."
  
  return description
end

----------------------------------------------

on beginSprite me
  pFieldMember    = sprite(pFieldSpriteNum).member
  pFieldMemberNum = member(pFieldMember).number
  pLineHeight     = member(pFieldMemberNum).lineHeight
  pFieldWidth     = member(pFieldMemberNum).width + (member(pFieldMemberNum).margin * 2)
  pLeftSideField  = sprite(pFieldSpriteNum).left + member(pFieldMemberNum).border
  pTopSideField   = sprite(pFieldSpriteNum).top + 2
  pNumLines       = member(pFieldMemberNum).lineCount
  pHiliteRect     = rect(0, 0, pFieldWidth, pLineHeight)
  
  pColorIndex = [¬
                 "Red": color(#rgb 255, 0, 0), ¬
                 "Blue": color(#rgb 0, 0, 255), ¬
                 "Green": color(#rgb 0, 136, 0), ¬
                 "Yellow": color(#rgb 255, 255, 0), ¬
                 "Grey": color(#rgb 160, 160, 164), ¬
                 "Black": color(#rgb 0, 0, 0)]
  
  sprite(pHiliteSpriteNum).color = pColorIndex[pColor]
  sprite(pHiliteSpriteNum).ink = pInk
  sprite(pHiliteSpriteNum).blend = pBlend
  
  pLineIndexList = [:]
  repeat with i = 1 to pNumLines
    pLineIndexList["Line" & i] = member(pFieldMemberNum).line[i]
  end repeat
end

on mouseEnter me
  if the mouseLine > 0 then
    sprite(pHiliteSpriteNum).rect = pHiliteRect
  end if
end

on mouseWithin me
  if the mouseLine > 0 then
    pCurrentLine = the mouseLine
    vLineLoc = pTopSideField + (pLineHeight * (pCurrentLine - 1))
    newLoc = point(pLeftSideField, vLineLoc)
    sprite(pHiliteSpriteNum).loc = newLoc
    updateStage
  end if
end

on mouseLeave me
  sprite(pHiliteSpriteNum).locH = - 1000
end

on mouseUp me
  getThisLine = "Line" & pCurrentLine
  put pLineIndexList[getThisLine]
end

 


Contact

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

Send e-mail