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
OpenAtLaunch
Sound slider
Set Screen Size
Twain Xtra
CatCube
Toggle Static Property of a Flash Member
Scriptzorz
Delete one or more items
Bevel Follow Mouse or Sprite-Alphamania
Iconizer
 

 

 

Behavior Progress Bar

Added on 8/26/2002

 

Compatibilities:
D8_5

This item has not yet been rated

Author: sbljx (website)

Prograss Bar Behavior. should assign it to a bitmap sprite. support border settings. step function:Step(StepValue) set position function:SetPos(PosValue) get percent variable :sprite(ThisSprite).Percent

Download PC Source
property PBMin,PBMax,PBPos,StartPos,Percent
property PBSprite,PBMember,OldImage
property bordertype,bordervalue,PBColor
-------
on getBehaviorDescription
  tt=""&return&""
  tt=tt&return&"------     ---进度条行为-----------"
  tt=tt&return&return&"  本行为实现进度条功能!"
  tt=tt&return&"     1.是用于bitmap演员"
  tt=tt&return&"     2.支持倒角效果"
  tt=tt&return&"     3.外部控制进度行进方法:sendsprite(ThisSprite,#Step,StepValue)"
  tt=tt&return&"     4.外部直接控制进度位置方法:sendsprite(ThisSprite,#SetPos,PosValue)"
  tt=tt&return&"     5.外部取得进度百分比方法:sprite(ThisSprite).Percent"
  tt=tt&return&return&"          版权所有:   Sbljx"
  tt=tt&return&"            发布日期:   2002.01.29"
  return tt
end getBehaviorDescription
-----------
on beginSprite me
  PBPos=StartPos
  PBSprite=sprite(the currentspritenum)
  PBMember=PBSprite.member
  OldImage=PBMember.image.duplicate()
  trect=OldImage.rect
  p1=point(trect[1],trect[2])
  p2=point(trect[3],trect[2])
  p3=point(trect[1],trect[4])
  p4=point(trect[3],trect[4])
  case bordertype of
    "none":
    "Up":
      PBMember.image.draw(p1,p2,[#lineSize:bordervalue,#color: rgb(200, 200, 200)])  
      PBMember.image.draw(p1,p3,[#lineSize:bordervalue,#color: rgb(200, 200, 200)])
      PBMember.image.draw(p2-point(bordervalue,0),p4,[#lineSize:bordervalue,#color: rgb(0, 0, 0)])
      PBMember.image.draw(p3-point(0,bordervalue),p4,[#lineSize:bordervalue,#color: rgb(0, 0, 0)])
    "Down":
      PBMember.image.draw(p1,p2,[#lineSize:bordervalue,#color: rgb(0, 0, 0)])  
      PBMember.image.draw(p1,p3,[#lineSize:bordervalue,#color: rgb(0, 0, 0)])
      PBMember.image.draw(p2-point(bordervalue,0),p4,[#lineSize:bordervalue,#color: rgb(200, 200, 200)])
      PBMember.image.draw(p3-point(0,bordervalue),p4,[#lineSize:bordervalue,#color: rgb(200, 200, 200)])
    "Rect":
      PBMember.image.draw(trect,[#shapeType:#rect,#lineSize:bordervalue,#color: rgb(0, 0, 0)])
  end case
  
end

on prepareFrame me
  --SetPos(me,PBPos+1)
  Percent=integer((PBPos-PBMin)*100/(PBMax-PBMin)*1.00)
end

on endSprite me
  PBMember.image=OldImage
end

---

on Step me,FStep
  if PBPos+FStep<=PBMax and PBPos+FStep>=PBMin then
    PBPos=PBPos+FStep
  else
    if PBPos+FStep>PBMax then PBPos=PBMax
    if PBPos+FStep  end if
  TWidth=(PBPos-PBMin)*(OldImage.width-bordervalue*2)/(PBMax-PBMin)*1.00
  TRect=rect(bordervalue,bordervalue,TWidth+bordervalue,OldImage.height-bordervalue)
  TRect2=rect(TWidth+bordervalue,bordervalue,OldImage.width-bordervalue,OldImage.height-bordervalue)
  PBMember.image.copyPixels(OldImage,TRect2,TRect2)
  PBMember.image.fill(TRect,[#lineSize:0,#color: PBColor])  
end

on SetPos me,FPos
  if FPos<=PBMax and FPos>=PBMin then
    PBPos=FPos
  else
    if FPos>PBMax then PBPos=PBMax
    if FPos  end if
  TWidth=(PBPos-PBMin)*(OldImage.width-bordervalue*2)/(PBMax-PBMin)*1.00
  TRect=rect(bordervalue,bordervalue,TWidth+bordervalue,OldImage.height-bordervalue)
  TRect2=rect(TWidth+bordervalue,bordervalue,OldImage.width-bordervalue,OldImage.height-bordervalue)
  PBMember.image.copyPixels(OldImage,TRect2,TRect2)
  PBMember.image.fill(TRect,[#lineSize:0,#color: PBColor])  
end
---
on getPropertyDescriptionList
  vPDList = [:]
  set num=the memberNum of sprite the currentspritenum
  setaProp vPDList, #PBColor, [#comment: "Color",
    #format: #color, #default:rgb(28,7,143)]
  setaProp vPDList, #PBMin, [#comment: "Min Value",
    #format: #integer, #default:1]
  setaProp vPDList, #PBMax, [#comment: "Max Value",
    #format: #integer, #default:100]
  setaProp vPDList, #StartPos, [#comment: "Start Value",
    #format: #integer, #default:1]
  setaProp vPDList, #BorderValue, [#comment: "Border Value",
    #format:#integer  , #default:1,#range: [#min:0, #max:5]]  
  setaProp vPDList, #BorderType, [#comment: "Border Type",
    #format:#string  , #default:"Down",#range: ["None", "Down","Up","Rect"]]  
  return vPDList
end getPropertyDescriptionList

 


Contact

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

Send e-mail