Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
ZGTSB-TextScroll
Digital Clock Puzzle
VCap
Multimixer Xtra
Round floating point numbers off to nearest ten
Setup Anim
Blend given sprite from 0 to given value
Creating a Marquee Tool
List Maker
Generic behavior to create a Shortcut
MediaMacros Xtras Mall
 

 

 

Behavior Sound Slidebar

Added on 10/17/2002

 

Compatibilities:
behavior

Rating:

Author: Roti (website)

Sound Slidebar Attach this behavior to a horizontal orientationed sprite. This behavior let you make a slidebar to a sound. You have to specify a sound channel number, a spritenumber that will be the dragger (you can't drag it), and a sound castmember, which has to be played. You can click on this slidebar to move the sound to that point.

-- Sound Slidebar ; 2002.10.x
-- Author: Roti ; roti@al.pmmf.hu

on getBehaviorDescription me
  return "Sound Slidebar"&RETURN&RETURN&"Attach this behavior to a horizontal orientationed sprite. This behavior let you make a slidebar to a sound. You have to specify a sound channel number, a spritenumber that will be the dragger (you can't drag it), and a sound castmember, which has to be played."&RETURN&"You can click on this slidebar to move the sound to that point."
end getBehaviorDescription

on getBehaviorTooltip me
  return "Use this behavior to make a Sound slidebar"
end getBehaviorTooltip



property myButton -- which sprite indicates the position
property mySprite -- my spritenumber
property mySoundchannel -- which soundchannel to manipulate
property mySoundduration -- my soundchannel's duration
property mySoundmember -- Which member is the soundmember
property myClicked -- where did you click

on beginsprite me
  
  if mySprite=Void then
    mySprite=me.spritenum
  end if
  
  -- If we handn't got button, we will use the next sprite
  if myButton=Void then
    myButton=mySprite+1
  end if
  sprite(myButton).editable=1
  
  -- If we handn't got soundchannel, we will use the first
  if mySoundchannel=Void then
    mySoundchannel=1
  end if
  
  -- If we handn't got soundmember, we will use the first member
  if mySoundmember=Void then
    mySoundmember=1
  end if
  
  -- This is the initialization of this property
  if myClicked=Void then
    myClicked=sprite(mySprite).left
  end if
  
  -- Set my cursor
  sprite(mySprite).cursor=280
  
  -- My mySoundmember's duration
  mySoundduration=member(mySoundmember).duration
  
end


on exitframe me
  
  if soundbusy(mySoundchannel)=0 then
    myClicked=sprite(mySprite).left
  end if
  
  -- Calculate the button's new position
  if integer(mySoundduration)=0 then
    newloch=sprite(mySprite).left
  else
    newloch=(sound(mySoundchannel).elapsedTime/ mySoundduration)*(sprite(mySprite).width)+myClicked
  end if
  
  -- Sincronize the button to the sound
  sprite(myButton).loc=point(newloch,sprite(mySprite).locv)
  
end


on mouseUp me
  -- Store the mouseclick
  myClicked=the mouseh
  
  -- calculate the new soundposition
  jump=((myClicked-sprite(mySprite).left).float/sprite(mySprite).width.float).float*mySoundduration
  
  -- Start the sound over
  puppetsound mySoundchannel,0
  
  -- Start the sound from the new position
  sound(mySoundchannel).queue([#member: member(mySoundmember), #startTime: jump])
  sound(mySoundchannel).play()
end

on getPropertyDescriptionList
  if the currentSpriteNum = 0 then exit
  
  return [ #myButton: [#comment: "Spritenumber of sprite, which indicates the position (Dragger)",   #format: #integer,   #default:  the currentSpriteNum+1],   #mySoundchannel: [#comment: "Which soundchannel to manipulate",   #format:  #integer,   #default: 1 ],   #mySoundmember: [#comment: "Which member is the soundmember",   #format:  #sound,   #default: 255 ]]
  
end getPropertyDescriptionList

 


Upload Provided by ABCUpload ASP

Contact

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

Fax - (206) 339-5833

Send e-mail