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
Color Palette Info
Colour Conversions Galore!
AutoRez Monitor Resolution Switcher
Copy matching Pixels
Director 8 and Lingo Bible
Faux Marquee Tool
Sharpen Filter - Imaging Lingo
password field
robotduck.com
MediaMacros Blog
 

 

 

Behavior Text scrolling effect

Added on 7/31/2001

 

Compatibilities:
behavior D8 D8_5 Mac PC Shockwave

This item has not yet been rated

Author: alliax (website)

Work on text and field members. Will add a scrolling effect to both side of the text. Customizable.

Download PC Source    Download Mac Source
-- Author: http://go.to/alliax
-- Date  : July 01

property sequenceLeft, sequenceRight
property charLeft, charRight
property lengthLeft, lengthRight
property timerLeft, timerRight
property textDisplay

on getPropertyDescriptionList
  vPDlist = [:]
  setaProp vPDList, #charLeft, [#comment: "Left Fixed Characters", #format: #string, \
    #default: "["]  
  setaProp vPDList, #sequenceLeft, [#comment: "Left Sequence to scroll", #format: #string, \
    #default: "     ...."]  
  setaProp vPDList, #lengthLeft, [#comment: "Left Length", #format: #integer, \
    #default: 13]
  setaProp vPDList, #timerLeft, [#comment: "Left Speed (milliseconds)", #format: #integer, \
    #default: 33]
  setaProp vPDList, #textDisplay, [#comment: "Text to Display (if empty then use text of member)", #format: #string, \
    #default: "Cool Text Here"]  
  setaProp vPDList, #charRight, [#comment: "Right Fixed Characters", #format: #string, \
    #default: "]"]  
  setaProp vPDList, #sequenceRight, [#comment: "Right Sequence to scroll", #format: #string, \
    #default: "     ...."]  
  setaProp vPDList, #lengthRight, [#comment: "Right Length", #format: #integer, \
    #default: "13"]
  setaProp vPDList, #timerRight, [#comment: "Right Speed (milliseconds)", #format: #integer, \
    #default: 33]
  return vPDList
end getPropertyDescriptionList

on getBehaviorDescription me
  return \
    "[EASY]" & RETURN & RETURN & \
    "Use this behavior to make a nice scroll effect around a text. " & \
    "Drag this behavior onto any sprite with a text or field member. " & \
    "You can write something in the member, the initial value will be restored on endsprite."
end getBehaviorDescription

on getBehaviorTooltip me
  return \
    "[EASY] Use this behavior to make a nice scroll effect around a text. " & \
    "Drag this behavior onto any sprite with a text or field member. " & \
    "You can write something in the member, the initial value will be restored on endsprite."
end getBehaviorTooltip

property pntLeft, pntRight
property pntTimerLeft, pntTimerRight
property tempLeft, tempRight
property my, oldText

on beginsprite me
  my = sprite(me.spritenum).member
  oldText = my.text
  
  -- fill in member with text
  repeat with i = 1 to lengthLeft
    tempLeft = tempLeft & textDisplay.char[random(textDisplay.length)]  
  end repeat  
  repeat with i = 1 to lengthRight
    tempRight = tempRight & textDisplay.char[random(textDisplay.length)]
  end repeat
  my.text = charLeft & tempLeft & textDisplay & tempRight & charRight
  
  if textDisplay = "" then textDisplay = oldText
  
  pntLeft = 1
  pntRight = 1
  pntTimerLeft = the milliseconds + timerLeft
  pntTimerRight = the milliseconds + timerRight
end

on endsprite me
  my.text = oldText
end

on newtext me  
  if the milliseconds > pntTimerLeft then
    tempLeft = my.text.char[2+charLeft.length..lengthLeft+charLeft.length] \
& sequenceLeft.char[pntLeft]
    
    if pntLeft < sequenceLeft.length then
      pntLeft = pntLeft + 1
    else
      pntLeft = 1
    end if
    
    pntTimerLeft = the milliseconds + timerLeft
  end if
  
  if the milliseconds > pntTimerRight then
    tempRight = my.text.char[my.text.length-(lengthRight-2+charRight.length)..my.text.length-(lengthRight-lengthRight+charRight.length)] \
& sequenceRight.char[pntRight]
    
    if pntRight < sequenceRight.length then
      pntRight = pntRight + 1
    else
      pntRight = 1
    end if
    
    pntTimerRight = the milliseconds + timerRight
  end if
  
  my.text = charLeft & tempLeft & textDisplay & tempRight & charRight
end

on exitframe me  
  newtext
end

 


Contact

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

Send e-mail