Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Pretty Script
Cursor trails
Lingo MarkUp Xtra
Stop Projector After Eject CD
Searching Through Text
Text Pop Up
Prime Number Xtra
Retrun Properties on a Sprite
email send with attach file
Version
MediaMacros Xtras Mall
 

 

 

Behavior import and play sound file (during runtime)

Added on 9/13/2003

 

Compatibilities:
behavior D8_5 D9 PC

Required Xtras:
Buddy API

This item has not yet been rated

Author: paenil1

Use this behaviour to import and play an external sound file (mp3 or wav) into your director movie during runtime. It will allow you to choose which sound channel to use and whether to loop it or not. *You can choose to have a different cast lib for this

--created by Lomi Paeniu
--with help from media man (MultimediaHelp Forum)
--feel free to use this script as you like
--drop me an email on paenil1@hotmail.com
--for any questions, feedback or suggestions

property pDirectory, pLoop, pSoundchannel, pFiletype, pCastlib

on getpropertyDescriptionList
  set description = [:]
  addprop description #pDirectory, [#format : #string, #comment :"Sound folder relative to the movie (include  after):", #default : ""]
  addprop description #pFiletype, [#format : #string, #comment :"File Type:", #default : "*.mp3", #range : ["*.mp3","*.wav"]]
  addprop description #pLoop, [#comment : "Loop (1 for yes, 0 for no):", #format : #integer, #default : "0", #range : [0,1]]
  addprop description #pSoundchannel, [#comment : "Sound channel:", #format : #integer, #default : 1, #range : [1,2,3,4,5,6,7,8]]
  addprop description #pCastlib, [#comment : "Which Cast Lib:", #format : #string, #default :""]
  return description
end


on beginsprite me
  --list and count files
  f = baFileList(the moviePath & pDirectory,pFileType)
  pFileCount = f.count
  --randomly select a file from the list
  r = random(f.count)
  --get the file name
  pName = f[r]
  --then import it
  pMember = new(#sound, castlib pCastlib)
  pMember.importFileInto(the moviePath & pDirectory & f[r])
  --apply the file name to the new member
  member(pMember).name = pName
  --loop the sound file
  member(pName).loop = pLoop
  --play the imported file
  sound(pSoundchannel).play(pMember)
  --fade in sound
  sound fadeIn pSoundchannel
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail