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
Vector Shape - Create Sine Wave
Cross Platform Projects
Set Quality of a QTVR Sprite
SMARTSCRIPT
Tools for fulltext searching in Director and Authorware
ChromeLib
Reference Xtra
ProjectorLook Xtra
Play/ Pause/ Stop/ Rewind a Flash Sprite
f3Export
 

 

 

Behavior ZGTSB-TextInteractivity

Added on 5/22/2001

 

Compatibilities:
behavior D8 D8_5 Mac PC Shockwave

This item has not yet been rated

Author: Ziggi

This applies to the text or field sprite of the 'Ziggi Generic Text Scrolling Behaviours' set and brings text interactivity by line.

Download PC Source    Download Mac Source
-- ZIGGI GENERIC TEXT SCROLLING BEHAVIOURS --
-- (C) 2001 Zbigniew Szczesny

property pMeForeColor, pMeAltForeColor, pMouseLineNum, pMeLastLine, pLineClicked, pMeMemberNum, pMeCastLibNum, pMeSpriteNum, pMeType, pMeLineCount

on getBehaviorDescription
  return "This applies to the text or field sprite of the 'Ziggi Generic Text Scrolling Behaviours' set and brings text interactivity by line."
end

on isOKtoAttach me, spriteType, spriteNum
  case spriteType of
    #graphic:
      meType = sprite(spriteNum).member.type
      return meType = #text or meType = #field
    #script:
      return FALSE
  end case
end

on beginSprite me
  pMeSpriteNum = me.spriteNum
  pMeMemberNum = sprite(pMeSpriteNum).memberNum
  pMeCastLibNum = sprite(pMeSpriteNum).castLibNum
  pMeLastLine = 0
  pMeForeColor = member(pMeMemberNum, pMeCastLibNum).foreColor
  pMeAltForeColor = 1 -- here enter the colour number of highlited text in text (not field !) member
  pMeLineCount = member(pMeMemberNum, pMeCastLibNum).line.count
  pMeType = member(pMeMemberNum, pMeCastLibNum).type
end

on mouseWithin me
  if me.pMeType = #text then
    pMouseLineNum = pointToLine(sprite(pMeSpriteNum), the mouseLoc)
    member(pMeMemberNum, pMeCastLibNum).line[pMouseLineNum].foreColor = pMeAltForeColor
    if pMeLastLine <> 0 and pMeLastLine <> pMouseLineNum then
      member(pMeMemberNum, pMeCastLibNum).line[pMeLastLine].foreColor = pMeForeColor
    end if
    pMeLastLine = pMouseLineNum
  else
    pMouseLineNum = the mouseLine
    member(pMeMemberNum, pMeCastLibNum).line[pMouseLineNum].hilite()
  end if
end

on mouseLeave me
  if me.pMeType = #text then
    member(pMeMemberNum, pMeCastLibNum).foreColor = pMeForeColor
    pMeLastLine = 0
  else
    member(pMeMemberNum, pMeCastLibNum).line[pMeLineCount + 1].hilite()
  end if
end

on mouseUp me
  pLineClicked = pMouseLineNum
  -- Here you can enter your code handling onMouseUp event,
  -- or you can call pLineClicked property of this sprite to get the clicked line number.
  put member("ZGTSB-SampleTargetList").line[pLineClicked] -- this is an example.
end  

 


Contact

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

Send e-mail