Wait for DirectMediaXtra Sprite to finish Playing
______________________________________________________________________________________________

-----------------------------------------------------------------Wait for DirectMediaXtra Sprite to finish Playing
-----------------------------------------------------------------this is Similar to the Cue-Points in Temp channel but this ---------------------------------------------------------------------Behavior allows your RolOver Members to Work Correctly
-------------------------------------------------------------------------written on Feb. 21st 2002 12.55 pm IST. by Tushar -------------------------------------------------------------------------------[tushonline@hotmail.com]
-------------------------------------------------------------------------------www.run4Fx.com
------------------------------------------------------------------------------------In case of any suggestions forward this -----------------------------------------------------------------------------------------to run4fx@run4fx.com

---------------------------------------HOW TO USE THIS BEHAVIOR -----------------------------------------------
-- Just drag this behavior on to a Frame Script Channel
--- This Behavior works on ExitFrame Handler,
---- Will return to Stop the Movie if the DirectMedia Xtra Sprite is not chosen
----- Time in MilliSeconds is an Optional Option to choose, If dont want to use leave it as it is.
------ Select Direct Media Xtra Sprite from the Sprite Numbers dropDown Menu
------- Select Marker to Jump after DirectMedia Xtra sprite finishes Playing
---------------------------------------------------------------------------------------------------------------
-- This Behavior Allows you to work you rollovers work properly
---------------------------------------------------------------------------------------------------------------


property pSprite -- DirectMedia Xtra Sprite Number
property pTime -- Optional Time in MilliSeconds for Cue
property pMarker -- Choose MArker to Jump After Cue

on getPropertyDescriptionList me
tSprites = []
repeat with i = 1 to the lastChannel
tSprites.add(i)
end repeat

-- This is for getting Markers
markersList = GetMarkers (me)
if markersList.count() = 2 then -- [[], []]
ErrorAlert (me, #getPDL_DuplicateMarkers, markersList[2])
end if



tLabelList = []
tLabelList.add("next")
tLabelList.add("previous")

repeat with i = 1 to count(the markerList)
tLabelList.add((the markerList).getProp((the markerList).getPropAt(i)))
end repeat

list = [:]
addProp list, #pSprite, [#comment: "Select DirectMedia Xtra Sprite", #format: #string,#default: "1",#Range: tSprites]
addProp list, #pTime, [#comment: "Put Time in MilliSeconds [Optional]", #format: #String,#default: "Not Applicable"]
addProp list, #pMarker, [#comment: "Choose a Marker to Jump after this Cue", #format: #Marker,#default:#getMarkers]
return list
end


-- This Check if DirectMedia Sprite is True or False
On PrepareFrame me
if sprite (pSprite).member.type = #DirectMediaXtra then nothing
else
alert "ERROR : Sprite You selected is not a DirectMedia Xtra Sprite.*_*"
halt
end if
end


-- Error ALert for Duplis
On errorAlert(me)
markersList = GetMarkers (me)
if markersList.count() = 2 then Alert "Duplicate Markers found!!!"
halt
end


--get markers

on GetMarkers me -- as given in PropertyDescription
localMarkerList = []
duplicatesList = []
markerString = the labelList
delete the last char of markerString
markerCount = the number of lines of markerString
repeat with i = 1 to markerCount
theMarker = markerString.line [i]
if localMarkerList.getPos(theMarker) then
-- Duplicate marker name
if not duplicatesList.getPos(theMarker) then
duplicatesList.append(theMarker)
end if
else
localMarkerList.append(theMarker)
end if
end repeat
if duplicatesList.count() then
return [localMarkerList, duplicatesList]
else
return [localMarkerList]
end if
end GetMarkers

-- Actual Event

on ExitFrame me
if pTime = "Not Applicable" then
if the currentTime of sprite (pSprite) < member(sprite(pSprite).member).duration then
go to the frame
else
go (pMarker)
end if
else
if pTime > 0 then

if the currentTime of sprite (pSprite) < (pTime) then
go to the frame
else
go (pMarker)
end if
end if
end if
end if

end

on isOKToAttach (me, aSpriteType, aSpriteNum)

tIsOK = 0
if aSpriteType = #Script then
tIsOK = 1
end if
return(tIsOK)
end on

on getBehaviorDescription me
return "Wait for DirectMediaXtra Sprite to finish Playing" & return & "this is Similar to the Cue-Points in Temp channel but this Behavior allows your RolOver Members to Work Correctly" & return & "Just drag this behavior on to a Frame Script Channel" & return& "In case of any suggestions forward this to run4fx@run4fx.com"
end

on getBehaviorTooltip me
return "Wait for DirectMediaXtra Sprite to finish Playing" & return & "this is Similar to the Cue-Points in Temp channel but this Behavior allows your RolOver Members to Work Correctly" & return & "Just drag this behavior on to a Frame Script Channel"&return&"In case of any suggestions forward this to run4fx@run4fx.com"
end