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
Password Protection in a Projector
Generic behavior to set Wallpaper
Impactica
Making a simple game
Set Castmember properties for DirectMedia member
Fade till done
Bubble Sort for Points and Lists
Relative Links
Rollback - Valentina
Generic behavior to set Screensaver
 

 

 

Behavior ZGTSB-TextScroll

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 ability to scroll.

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

property pMeCount, pMeScroll, pMeLineH, pMeBottom, pMeMemberNum, pMeCastLibNum
property pMeType, pMouseLineNum, pMeSpriteNum, pMeLineCount

on getBehaviorDescription
  return "This applies to the text or field sprite of the 'Ziggi Generic Text Scrolling Behaviours' set and brings text ability to scroll."
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
  pMeScroll = #Null
  pMeLastLine = 0
  pMeSpriteNum = me.spriteNum
  pMeMemberNum = sprite(pMeSpriteNum).memberNum
  pMeCastLibNum = sprite(pMeSpriteNum).castLibNum
  pMeType = member(pMeMemberNum, pMeCastLibNum).type
  if pMeType = #text then
    pMeLineH = linePosToLocV(member(pMeMemberNum, pMeCastLibNum), 1)
  else
    pMeLineH = member(pMeMemberNum, pMeCastLibNum).lineHeight
  end if
  pMeLineCount = member(pMeMemberNum, pMeCastLibNum).line.count
  pMeBottom = (pMeLineCount * pMeLineH) - member(pMeMemberNum, pMeCastLibNum).pageHeight
  member(pMeMemberNum, pMeCastLibNum).scrollTop = 0
end

on scrollUp me
  if pMeScroll = #Null then
    pMeScroll = #Up
    pMeCount = pMeLineH
  end if
end

on scrollDown me
  if pMeScroll = #Null then
    pMeScroll = #Downn
    pMeCount = pMeLineH
  end if
end

on scrollUpMore me
  member(pMeMemberNum, pMeCastLibNum).scrollByLine(-1)
end

on scrollDownMore me
  if member(pMeMemberNum, pMeCastLibNum).scrollTop < pMeBottom then member(pMeMemberNum, pMeCastLibNum).scrollByLine(1)
end

on prepareFrame me
  if pMeCount > 0 then
    if pMeScroll = #Up and member(pMeMemberNum, pMeCastLibNum).scrollTop > 0 then
      member(pMeMemberNum, pMeCastLibNum).scrollTop = member(pMeMemberNum, pMeCastLibNum).scrollTop - 1
    else if pMeScroll = #Downn and member(pMeMemberNum, pMeCastLibNum).scrollTop < pMeBottom then
      member(pMeMemberNum, pMeCastLibNum).scrollTop = member(pMeMemberNum, pMeCastLibNum).scrollTop + 1
    end if
    pMeCount = pMeCount - 1
  else
    pMeScroll = #Null
  end if
end  

 


Contact

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

Send e-mail