Reproduced with permission from Penworks Lingo User"s Journal
-- Source Code from the Lingo User"s Journal
-- Copyright (c) 1995 by Penworks Corporation
-- ProgressBar script
property ichEmptyBar -- channel number of the outline to be filled in
property ichFilledBar -- channel number of the fill in area
property iLeft -- leftmost pixel of the fill in area
property iTop -- top pixel of the fill in area
property iRight -- rightmost pixel of the fill in area
property iBottom -- bottom pixel of the fill in area
property iWidth -- width of the fill in area
-- Creates a ProgressBar Object
on birth me, chEmptyBar, chFilledBar
set ichEmptyBar = chEmptyBar
set ichFilledBar = chFilledBar
set iLeft = the left of sprite ichEmptyBar + 1
set iTop = the top of sprite ichEmptyBar + 1
set iRight = the right of sprite ichEmptyBar - 1
set iBottom = the bottom of sprite ichEmptyBar - 1
set iWidth = iRight - iLeft
mResetBar(me)
return me
end birth
-- Resets the fill in bar to nothing
on mResetBar me
puppetSprite ichFilledBar, TRUE
spriteBox ichFilledBar, iLeft, iTop, iLeft, iBottom
updateStage
end mResetBar
-- Draws the bar based on percent completion
on mUpdateBar me, thePercent
if (thePercent < 0.0) or (thePercent > 1.0) then
alert("UpdateBar, percent out of range. Percent is:" && thePercent)
return
end if
set lengthInPixels = integer(thePercent * iWidth)
set newRight = iLeft + lengthInPixels
spriteBox ichFilledBar, iLeft, iTop, newRight, iBottom
-- You could easily add an on screen percentage value here also
updateStage
end mUpdateBar
--Cleans up when your done
on mCleanUp me
puppetSprite ichFilledBar, FALSE
updateStage
end mCleanup
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA