|
|
|
Play/ Pause/ Stop/ Rewind a Flash Sprite
Added on 7/6/2000
|
Play/Pause/Stop/Rewind a Flash Sprite
Download PC Source Download Mac Source
----written for Director 8----
----Kumar.K----
----kumark@icode.com----
----Custom Properties----
property FlashSprite,MyAction,WhereTo,Playafterrewind
----Get Behavior description----
on getBehaviorDescription me
return \
"Play/Pause/Stop/Rewind a Flash Sprite " & RETURN & RETURN & \
"This Behavior Play/Pause/Stop/Rewind a Flash Sprite." & RETURN & RETURN & \
"PARAMETERS:" & RETURN & \
"* Flash Sprite" & RETURN & \
"* Action" & RETURN & \
"* Wheteher to Play/Stop after Rewind(use this if action is REWIND)" & RETURN & \
"* Where to assign this script"
end getBehaviorDescription
----Get Behavior description----
----Get Behavior Description List----
on getPropertyDescriptionList me
flashmememberlist = searchflashsprite(me)
propslist=[:]
if flashmememberlist.count() > 0 then
SetaProp propslist, #FlashSprite, [#comment:"Flash Sprite :",#format:#integer,\
#range: flashmememberlist,#default: flashmememberlist[1]]
else
SetaProp propslist, #FlashSprite, [#comment:"Flash Sprite :",#format:#integer,#default: 1]
end if
SetaProp propslist, #MyAction, [#comment: "Action :" ,#format:#String,#range:["Play","Pause","Stop","Rewind"], \
#default:"Play"]
SetaProp propslist, #Playafterrewind, [#comment:"Play after Rewind(Use if Action is REWIND) : ", \
#format:#string,#range:["Yes","No"],#default: "Yes"]
if the currentspritenum = 0 then
SetaProp propslist, #WhereTo, [#comment: "Where To Attach ?" ,#format:#String, \
#range:["On EnterFrame","On ExitFrame"],#default:"On EnterFrame"]
else
SetaProp propslist, #WhereTo, [#comment: "Where To Attach ?" ,#format:#String, \
#range:["On MouseUp","On MouseDown","On MouseEnter","On MouseLeave"],#default:"On MouseUp"]
end if
return propslist
end getPropertyDescriptionList
----Get Behavior Description List----
----Available for both Frame and Sprite Script----
on isOKToAttach (me, aSpriteType, aSpriteNum)
case aSpriteType of
#graphic:
return true
#script:
return true
end case
end isOKToAttach
----Check Whether Flash Member Availabale on the Stage----
----Events----
on EnterFrame me
if WhereTo = "On EnterFrame" then
DoAction
end if
end EnterFrame
on ExitFrame me
if WhereTo = "On ExitFrame" then
DoAction
end if
end ExitFrame
on MouseUp
if WhereTo = "On MouseUp" then
DoAction
end if
end MouseUp
on MouseDown
if WhereTo = "On MouseDown" then
DoAction
end if
end MouseDown
on MouseEnter
if WhereTo = "On MouseEnter" then
DoAction
end if
end MouseEnter
on MouseLeave
if WhereTo = "On MouseLeave" then
DoAction
end if
end MouseLeave
----Events----
----Search for Flash Member on the Stage----
on searchflashsprite me
set theflashmemlist = []
repeat with i=1 to the lastchannel
if sprite(i).member.type = #flash then
theflashmemlist.append(i)
end if
end repeat
return theflashmemlist
end
----Search for Flash Member on the Stage----
----Custom Function to Perform the Action----
on DoAction
if member(sprite(Flashsprite).member).type=#flash then
Case (MyAction) of
"Play":
if not sprite(Flashsprite).playing then
Sprite(Flashsprite).Play()
end if
"Pause":
set the sound of member (the member of sprite Flashsprite) to 0
Sprite(Flashsprite).Hold()
"Stop":
sprite(Flashsprite).frame=0
Sprite(Flashsprite).Stop()
"Rewind":
Sprite(Flashsprite).Rewind()
if Playafterrewind ="yes" then
Sprite(flashsprite).Play()
else
Sprite(flashsprite).stop()
end if
End Case
end if
end
----Custom Function to Perform the Action----
|
|