------ Get Behavior Description List ------
on getPropertyDescriptionList me
set description = [:]
filelist=getfilelist(me)
directmedialist=searchDirectMember(me)
if filelist.count > 0 and directmedialist.count > 0 then
addProp description, #themember, [#comment: "Select the DirectMedia Member :", #format:#String,#range:directmedialist,#default:directmedialist[1]]
addProp description, #theFile, [#comment: "Select the File Name for the meber :", #format:#String,#range:filelist,#default:filelist[1]]
addProp description, #Rate, [#comment: "Set the Rate of the member :", #format:#Integer,#range:[#min:0,#max:200],#default:100]
addProp description, #volumeprop, [#comment: "Set the Volume of the member :", #format:#Integer,#range:[#min:-100,#max:0],#default:-10]
addProp description, #cpuboost, [#comment: "Set the Cpu Boost of the member(recomended 40) :", #format:#Integer,#range:[#min:0,#max:95],#default:40]
addProp description, #balance, [#comment: "Set the Balance of the member :", #format:#Integer,#range:[#min:-100,#max:100],#default:40]
addProp description, #medialocated, [#comment: "Set the linkedmedialocated of the member :", #format:#boolean,#default:True]
addProp description, #ToolBar, [#comment: "Set the ToolBar of the member :", #format:#boolean,#default:True]
addProp description, #Loopprop, [#comment: "Set the Loop of the member :", #format:#boolean,#default:True]
addProp description, #adjustdurationbeforeplayback, [#comment: "Set the adjustdurationbeforeplayback of the member :", #format:#boolean,#default:True]
if the currentspritenum = 0 then
SetaProp description, #WhereTo, [#comment: "Where To Attach" ,#format:#String, \
#range:["On EnterFrame","On ExitFrame"],#default:"On EnterFrame"]
else
SetaProp description, #WhereTo, [#comment: "Where To Attach" ,#format:#String, \
#range:["On MouseUp","On MouseDown","On MouseEnter","On MouseLeave"],#default:"On MouseUp"]
end if
return description
else
alertme
end if
end getPropertyDescriptionList
------ Get Behavior Description List ------
-- Get Behavior description --
on getBehaviorDescription
return "This Behavior Sets the Cast member properties for a DirectMedia cast member. " & RETURN & RETURN &\
"This Behavior Requires Buddy API to Get filenames,so please make sure uyou have Buddy API Xtra. " & RETURN & RETURN &\
"This Behavior Requires DirectMedia Xtra,so please make sure you have DirectMedia Xtra. " & RETURN & RETURN &\
"Parameters" & RETURN & \
"* File Name" & RETURN & \
"* Where to attach this script"
end
-- Get Behavior description --
------ Can be attached both frame script and sprite script ------
on isOKToAttach (me, aSpriteType, aSpriteNum)
case aSpriteType of
#script:
return true
#graphic:
return true
end case
end isOKToAttach
------ Can be attached both frame script and sprite script ------
------ Search for DirectMedia Member ------
on searchDirectMember me
directmedialist = []
maxCastLib = the number of castLibs
repeat with theCastLib = 1 to maxCastLib
maxMember = the number of members of castLib theCastLib
repeat with memberNumber = 1 to maxMember
theMember = member(memberNumber, theCastLib)
if theMember.type = #TBDIRECTMEDIA then
if theMember.name = EMPTY then
directmedialist.append(theMember)
else
directmedialist.append(theMember.name)
end if
end if
end repeat
end repeat
return directmedialist
end
------ Search for DirectMedia Member ------
-- give alert message --
on alertme
alert "Supported files not found"
end
-- give alert message --
--- search for supported file ---
on getfilelist me
set mypath=the moviepath
set fileslist=[]
set Folders = baFolderList( mypath )
set Files = baFileList( mypath ,"*.*")
repeat with M=1 to Files.count
findext files[m]
if (result=true) then
fileslist.append(files[m])
end if
end repeat
repeat with i = 1 to folders.count
set subfolders = baFolderList( mypath & "\" & folders[i])
if subfolders.count <> 0 then
repeat with j=1 to subfolders.count
set Files = baFileList( mypath & " \" & folders[i] & "\" & subfolders[j],"*.*")
repeat with k=1 to Files.count
findext files[k]
if (result=true) then
fileslist.append(folders[i] & "\" & subfolders[j] & "\" & files[k])
end if
end repeat
end repeat
set Files = baFileList( mypath & " \" & folders[i],"*.*")
repeat with j=1 to Files.count
findext files[j]
if (result=true) then
fileslist.append(folders[i] & "\" & files[j])
end if
end repeat
else
set Files = baFileList( mypath & " \" & folders[i],"*.*")
repeat with j=1 to Files.count
findext files[j]
if (result=true) then
fileslist.append(folders[i] & "\" & files[j])
end if
end repeat
end if
end repeat
return fileslist
end
--- search for soundfile ---
---Set properties --
on setproperties
if the file of member themember <> the moviepath & theFile then
set the file of member themember = the moviepath & theFile
end if
set the rate of member themember to rate
set the volume of member themember to volumeprop
set the cpuboost of member themember to cpuboost
set the balance of member themember to balance
set the linkedmedialocated of member themember to medialocated
set the hastoolbar of member themember to toolbar
set the loop of member themember to Loopprop
set the pausedatstart of member themember to pausedatstartprop
set the adjustdurationbeforeplayback of member themember to adjustdurationbeforeplayback
end
---Set properties --
-- Events --
on EnterFrame me
if WhereTo = "On EnterFrame" then
setproperties
end if
end EnterFrame
on ExitFrame me
if WhereTo = "On EnterFrame" then
setproperties
end if
end ExitFrame
on MouseUp
if WhereTo = "On MouseUp" then
setproperties
end if
end MouseUp
on MouseDown
if WhereTo = "On MouseDown" then
setproperties
end if
end MouseDown
on MouseEnter
if WhereTo = "On MouseEnter" then
setproperties
end if
end MouseEnter
on MouseLeave
if WhereTo = "On MouseLeave" then
setproperties
end if
end MouseLeave
-- Events --
--- find out extension --
on findext source
result=chars(source,the length of source - 3,the length of source)
if result=".mpg" or result=".avi" or result= ".wav" or result=".mov" or result = ".aif" or result = ".mp2" or result = ".mid" or result = ".mpe" then
result=true
else
result=false
end if
return result
end if
end findnext
--- find out extension --
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA