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
Puzzler II - Slide Puzzle
Moka Xtra
Rollover Swirl-Alphamania
Apples
Glu32
Digital Clock Puzzle
XML Parser List Converter
Face Mouse-Alphamania
Snow-Alphamania
Push Dial-Alphamania
 

 

 

Behavior JTMR KoolMarquee

Added on 7/5/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: ElianChrebor

Well, this is just another marquee behavior for D7/8... but a cool one!! Hummm, it works only with field member.

Download PC Source    Download Mac Source
-- JTMR
-- KOOL
-- MARQUEE
-- ==================================================
--
-- ==================================================
-- ) 2000 - JTMR
-- http://www.jtmr.fr.st
-- ==================================================

-- globals

-- properties
property status
property contentMember, currentLetter, marqueeWidth
property deltaScroll, initialLocH, currentDeltaScroll

-- scripts
on beginSprite me
  -- checks whether sprite(me.spriteNum).member is a valid member
  if sprite(me.spriteNum).member.type <> #Field then
    alert "JTMR KoolMarquee" & Return & "Use this behavior with a field member."
    me.status = #error
    return 0
  end if

  me.currentLetter = 0
  me.marqueeWidth = sprite(me.spriteNum).member.width
  me.deltaScroll = 0
  me.initialLocH = sprite(me.spriteNum).locH
end beginSprite

on endSprite me
  if me.status = #error then return 0
  me.contentMember.text = ""
  sprite(me.spriteNum).member.text = ""
end endSprite

on prepareFrame me
  if me.status = #error then return 0
  if me.deltaScroll <= 1 then
    sprite(me.spriteNum).locH = me.initialLocH
    sprite(me.spriteNum).member.text = JTMRgetMarqueeText(me)
  else
    sprite(me.spriteNum).locH = me.initialLocH - me.currentDeltaScroll
    me.deltaScroll = me.deltaScroll - 1
    me.currentDeltaScroll = me.currentDeltaScroll + 1
  end if
end prepareFrame

on JTMRgetMarqueeText me
  if me.status = #error then return 0
  myCC = me.contentMember.text.length
  me.currentLetter = JTMRturningNumber(me.currentLetter+1, 1, myCC)
  myStartPos = charPosToLoc(me.contentMember, me.currentLetter)[1]
  myLastLetter = min(me.currentLetter+1, myCC)
  repeat while charPosToLoc(me.contentMember, myLastLetter)[1]-myStartPos < me.marqueeWidth
    myLastLetter = myLastLetter + 1
    if myLastLetter > myCC then
      exit repeat
    end if
  end repeat
  me.deltaScroll = charPosToLoc(me.contentMember, min(me.currentLetter+1, myCC))[1] - myStartPos
  me.currentDeltaScroll = 1
  return me.contentMember.text.char[me.currentLetter..myLastLetter]
end JTMRgetMarqueeText

on JTMRsetMarqueeText me, pText
  if me.status = #error then return 0
  me.contentMember.text = pText
  i = 1
  repeat while charPosToLoc(me.contentMember, i)[1] < me.marqueeWidth
    me.contentMember.text = " " & me.contentMember.text
    i = i + 1
  end repeat
end JTMRsetMarqueeText

-- =================
-- MISC.
-- =================
on JTMRturningNumber pNumber, pMin, pMax
  case JTMRisBetween(pNumber, pMin, pMax) of
    0 : return pNumber
    -1 : return pMax
    1 : return pMin
  end case
end JTMRturningNumber

on JTMRisBetween pNumber, pMin, pMax
  if pNumber < pMin then
    return -1
  end if
  if pNumber > pMax then
    return 1
  end if
  return 0
end JTMRisBetween

-- ==================================================
on getPropertyDescriptionList
  myPropertylist = [:]
  addProp myPropertyList, #contentMember, [#Comment: "Choose a clone field of your 'marquee' field ", #format: #field, #default: 0]
  return myPropertyList
end getPropertyDescriptionList

on getBehaviorDescription
  return "JTMR Behavior Library" & RETURN &") 2000 - JTMR" & RETURN &"jtmr@worldnet.fr" & RETURN & "http://www.jtmr.fr.st" & RETURN & RETURN & "JTMR KoolMarquee Behavior"  & RETURN & RETURN & "This behavior works only with field member." & RETURN & RETURN & "use sendSprite(x, #JTMRsetMarqueeText, " & QUOTE & "Blah Blah Blah Blah..." & QUOTE & ")" & RETURN & RETURN & "This behavior is free software; you can redistribute it and/or modify "  & "it under the terms of the GNU General Public License as published by "  & "the Free Software Foundation; either version 2 of the License, or (at "  & "your option) any later version. "  & "This program is distributed in the hope that it will be useful, but "  & "WITHOUT ANY WARRANTY; without even the implied warranty of "  & "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU"  & "General Public License for more details."  & "You should have received a copy of the GNU General Public License"  & "along with this program; if not, write to the Free Software "  & "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
end getBehaviorDescription

-- ==================================================

 


Contact

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

Send e-mail