Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Robin Hood Xtra
Script Interface Tool
write/append to text file
Get CD ROM Drive letter
Emulator
Find angles of a right triangle
Havok Skittles / Bowling Game source code
Digital Clock Puzzle
Add all to the search path
AutoRez Monitor Resolution Switcher
 

 

 

Behavior Ultimate karaoke behavior.

Added on 2/25/2005

 

Compatibilities:

Rating:

Author: zkos (website)

This is karaoke behavior which highlights Line or the Word of the lyrics.

Download PC Source
-- Karaoke By Zoran Kos
-- 07. 01. 02

-- If you find this behaviori useful pleas write me.
-- Also send me suggestions.
-- Zoran Kos
-- Emalil : zoran@kos.co.yu


property pHilite
property pSounChanal
property pSound

property pkarText
property pOrigColor
property pWordOrLine



on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #graphic:
      return getPos([ #text],
        sprite(aSpriteNum).member.type) <> 0
    #script:
      return FALSE
  end case
end isOKToAttach
on getPropertyDescriptionList  
  if not the currentSpriteNum then exit -- behavior has been attached to script channel  
  set d = [:]
  
  addProp d, #pHilite, [#default:rgb( 255, 0, 0 ) , #format: #color, #comment: "Highlite color "]
  addProp d, #pSounChanal, [#default: 3, #format: #integer, #range: [#min: 1, #max: 5], #comment: "Puppet sound canal"]
  addProp d, #pSound, [#default: 0, #format: #sound, #comment: "Sound member"]
  addProp d, #pWordOrLine, [#default: "Line", #format: #string, #range: ["Line", "Word"], #comment: "Karaoke type"]
  return d
end


on beginSprite me
  
  sound(pSounChanal).STOP()    
  
  -- Pokretanje zvuka
  
  puppetSound pSounChanal, pSound  
  
  -- Definisanje originalnog sprajta i boje teksta
  
  pkarText=sprite(me.spriteNum).member
  pOrigColor  = pkarText.color
  
  --  if soundBusy( pSounChanal) then go loop
  
end beginSprite

on endSprite  
  pkarText.color= pOrigColor  
end


on enterFrame me  
  if pWordOrLine = "Line" then    
    --    Odavde ide ako je odabrano da bude karakoe za Linije    
    ItemNumber = (pkarText).text.Line.count    
    myRed  =  sound(pSounChanal)  .mostRecentCuePoint
    
    -- menjanje boje teksta
    
    if myRed >0 then
      pkarText.Line[myRed].color=  pHilite
    end if
    -- Vracanje originalne boje
    if myRed >= 2 then
      pkarText.Line[1..myRed-1].color=  pOrigColor
      
      -- Sprecavanje da nastavi da mneja boju ako ima vise pointa nego redova
      if myRed > ItemNumber then nothing
    end if
    
    -- Sigurnost za vracanje boje
    if soundBusy(pSounChanal)=FALSE then pkarText.color= pOrigColor
    
    
    
    ---Odavde ide ako je odabrano da bude karakoe za reci
  else
    ItemNumber = (pkarText).text.word.count
    
    myRed  =  sound(pSounChanal)  .mostRecentCuePoint    
    
    if myRed >0 then
      pkarText.word[myRed].color=  pHilite
    end if
    if myRed >= 2 then
      pkarText.word[1..myRed-1].color=  pOrigColor
      if myRed > ItemNumber then nothing
    end if    
    if soundBusy(pSounChanal)=FALSE then pkarText.color= pOrigColor
  end if  
end enterFrame

on exitFrame
  if soundBusy( pSounChanal) then
    go to the frame
  
  end if
  
end



on getBehaviorDescription
  
  
  set description = "This is karaoke behavior which highlights Line or the Word of the lyrics." & RETURN & "Use it only with text members." & RETURN & "Sound has not to be in the sound canal it plays puppet sound in the chosen canal. You can put some background sound in the sound canal."  & RETURN  & "You can put some background sound in the sound canal." & RETURN  & "- The Text member should contain no empty lines" & RETURN & "- None of the lines should wrap" & RETURN   & "- Each word is associated with a cuePoint, so punctuation must not be bordered by spaces (making them words)" & RETURN  & "- This behavior is designed to work for a text member that either fits completely on stage"  
  
  return description
end

on getBehaviorTooltip me
  return
    " This is karaoke behavior which highlights Line or the Word of the lyrics."
end getBehaviorTooltip

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail