home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 165 / XENIATGM165.ISO / cddata / main.dxr / 00032.ls < prev    next >
Encoding:
Text File  |  2003-05-29  |  4.4 KB  |  120 lines

  1. property pDuration, pMovieTime, videoSprite, extentSprite, hiliteMember, tracking, newLocH, newLocV, dynamic, min, max, valrange, minScreen, maxScreen, currentScreenVal, extentlength, CurrentVal
  2.  
  3. on getPropertyDescriptionList
  4.   if the currentSpriteNum = 0 then
  5.     memdefault = 0
  6.   else
  7.     memref = the member of sprite the currentSpriteNum
  8.     memdefault = member(member(memref).memberNum + 1)
  9.   end if
  10.   description = [:]
  11.   addProp(description, #videoSprite, [#default: 1, #format: #integer, #comment: "Video Sprite:"])
  12.   addProp(description, #extentSprite, [#default: 1, #format: #integer, #comment: "Extent Sprite:"])
  13.   addProp(description, #hiliteMember, [#default: memdefault, #format: #graphic, #comment: "Hilite Member:"])
  14.   addProp(description, #dynamic, [#default: 1, #format: #boolean, #comment: "Dynamic:"])
  15.   return description
  16. end
  17.  
  18. on getBehaviorDescription
  19.   return "Drag to slider 'handle' to enable control of video play time. Requires additional 'extent' member which limits the handle travel range." & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Video Sprite - Enter the number of sprite channel in which video is displayed." & RETURN & "ΓÇó Extent Sprite - Enter the number of sprite channel that contains the 'extent' sprite." & RETURN & "ΓÇó Hilite Member - Member to display while handle is being dragged." & RETURN & "ΓÇó Dynamic - If set, video time will be updated while handle is dragged, else when handle is released."
  20. end
  21.  
  22. on compute_val me
  23.   val = 0.0
  24.   val = float(me.currentScreenVal) / float(me.extentlength)
  25.   val = val * me.valrange
  26.   val = val + me.min
  27.   return val
  28. end
  29.  
  30. on send_the_val me, val
  31.   pMovieTime = val * pDuration
  32.   videoseek(sprite(videoSprite), pMovieTime)
  33. end
  34.  
  35. on beginSprite me
  36.   pDuration = sprite(videoSprite).duration
  37.   me.min = 0.0
  38.   me.max = 1.0
  39.   handle = me.spriteNum
  40.   me.tracking = 0
  41.   me.newLocH = the locH of sprite handle
  42.   me.newLocV = the locV of sprite handle
  43.   me.newLocV = the locV of sprite me.extentSprite
  44.   me.minScreen = the left of sprite me.extentSprite
  45.   me.maxScreen = the right of sprite me.extentSprite
  46.   set the locH of sprite handle to me.newLocH
  47.   set the locV of sprite handle to me.newLocV
  48.   me.valrange = me.max - me.min
  49.   me.extentlength = me.maxScreen - me.minScreen
  50. end
  51.  
  52. on prepareFrame me
  53.   if tracking then
  54.     handle = me.spriteNum
  55.     extent = me.extentSprite
  56.     me.newLocH = the mouseH
  57.     me.newLocV = the locV of sprite extent
  58.     if me.newLocH < the left of sprite extent then
  59.       me.newLocH = the left of sprite extent
  60.     end if
  61.     if me.newLocH > the right of sprite extent then
  62.       me.newLocH = the right of sprite extent
  63.     end if
  64.     me.currentScreenVal = me.newLocH - me.minScreen
  65.     set the locH of sprite handle to me.newLocH
  66.     set the locV of sprite handle to me.newLocV
  67.     if me.dynamic then
  68.       send_the_val(me, compute_val(me))
  69.     end if
  70.   else
  71.     if float(pDuration) = 0 then
  72.       pDuration = sprite(videoSprite).duration
  73.     end if
  74.     if float(pDuration) <> 0 then
  75.       x = float(sprite(videoSprite).currentTime) / float(pDuration)
  76.     end if
  77.     handle = me.spriteNum
  78.     extent = me.extentSprite
  79.     ScreenX = the left of sprite extent + (x * (the right of sprite extent - the left of sprite extent))
  80.     me.newLocH = ScreenX
  81.     me.newLocV = the locV of sprite extent
  82.     if me.newLocH < the left of sprite extent then
  83.       me.newLocH = the left of sprite extent
  84.     end if
  85.     if me.newLocH > the right of sprite extent then
  86.       me.newLocH = the right of sprite extent
  87.     end if
  88.     me.currentScreenVal = me.newLocH - me.minScreen
  89.     set the locH of sprite handle to me.newLocH
  90.     set the locV of sprite handle to me.newLocV
  91.   end if
  92. end
  93.  
  94. on mouseDown me
  95.   tracking = 1
  96.   temp = the member of sprite me.spriteNum
  97.   set the member of sprite the spriteNum of me to member(me.hiliteMember)
  98.   me.hiliteMember = temp
  99. end
  100.  
  101. on mouseUp me
  102.   global volgen, channel, svolgen
  103.   tracking = 0
  104.   temp = the member of sprite me.spriteNum
  105.   set the member of sprite the spriteNum of me to member(me.hiliteMember)
  106.   me.hiliteMember = temp
  107.   if sprite(videoSprite).mediaBusy <> "Media not loaded" then
  108.     sound(channel).volume = 0
  109.     sendSprite(44, #mSetConstrainPos, 1 - (sound(channel).volume / 255.0), 0)
  110.   end if
  111.   videoplay(sprite(videoSprite))
  112. end
  113.  
  114. on mouseUpOutSide me
  115.   tracking = 0
  116.   temp = the member of sprite me.spriteNum
  117.   set the member of sprite the spriteNum of me to member(me.hiliteMember)
  118.   me.hiliteMember = temp
  119. end
  120.