home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 2 / boot-disc-1996-10.iso / Demo.dir / 00039_Script_VideoBtnClass < prev    next >
Text File  |  1996-08-09  |  4KB  |  142 lines

  1. property spritenum,castname,videoBtnPlay,videoBtnPlayDown
  2. property videoBtnStop,videoBtnStopDown,videoBtn,videosprite
  3. property canVideoPlay,IsPlaying,IsPending,videocast
  4.  
  5. on new me,myvideosprite,mycastname
  6.   set videosprite=myvideosprite
  7.   if not (the visible of sprite videosprite) then
  8.     set the visible of sprite videosprite to false
  9.   end if
  10.   global videoBtns
  11.   set videoBtns=me
  12.   if voidP(mycastname) then
  13.     set castname="videoBtn"
  14.   else
  15.     set castname=mycastname
  16.   end if
  17.   set canVideoPlay to false
  18.   set IsPlaying to false
  19.   set spritenum=castsprite(me,castname)
  20.   puppetsprite spritenum,true
  21.   set videoBtnPlay=the number of member (castname&"Play")
  22.   set videoBtnPlayDown=the number of member (castname&"PlayDown")
  23.   set videoBtnStop=the number of member (castname&"Stop")
  24.   set videoBtnstopDown=the number of member (castname&"StopDown")
  25.   set videoBtn=the number of member castname
  26.   set olddelimiter=the itemdelimiter
  27.   set the itemdelimiter=quote
  28.   repeat with index=1 to count(the actorlist)
  29.     set obj=getat(the actorlist,index)
  30.     if item 2 of string(obj)="VideoBtnClass" then
  31.       deleteat the actorlist,index
  32.       exit repeat
  33.     end if
  34.   end repeat
  35.   set the itemdelimiter=oldDelimiter
  36.   add the actorlist,me
  37.   return me
  38. end
  39.  
  40. on setstate me,canMyVideoPlay
  41.   set canVideoPlay=canMyVideoPlay
  42.   set IsPlaying=false
  43.   set IsPending=true
  44. end
  45.  
  46. on stepframe me
  47.   if canVideoPlay then
  48.     if IsPlaying then
  49.       if the mousedown and rollover(spritenum) then
  50.         if not IsPending then
  51.           if the membernum of sprite spritenum<>videoBtnStopDown then
  52.             set the membernum of sprite spritenum to videoBtnStopDown
  53.             updateStage
  54.             set IsPending to true
  55.           end if
  56.         end if
  57.       else
  58.         if IsPending then
  59.           if the membernum of sprite spritenum<>videoBtnStop then
  60.             stopVideo me
  61.             set the membernum of sprite spritenum to videoBtnStop
  62.             updateStage
  63.             set IsPending to false
  64.           end if
  65.         end if
  66.       end if
  67.     else
  68.       if the mousedown and rollover(spritenum) then
  69.         if not IsPending then
  70.           if the membernum of sprite spritenum<>videoBtnPlayDown then
  71.             set the membernum of sprite spritenum to videoBtnPlayDown
  72.             updateStage
  73.             set IsPending to true
  74.           end if
  75.         end if
  76.       else
  77.         if IsPending then
  78.           if the membernum of sprite spritenum<>videoBtnPlay then
  79.             PlayVideo me
  80.             set the membernum of sprite spritenum to videoBtnPlay
  81.             updateStage
  82.             set IsPending=false
  83.           end if
  84.         end if
  85.       end if
  86.     end if
  87.   else
  88.     if the membernum of sprite spritenum<>videoBtn then
  89.       set the membernum of sprite spritenum to videoBtn
  90.       set the visible of sprite videosprite to false
  91.       updateStage
  92.       set isPending=false
  93.       set isPlaying=false
  94.     end if
  95.   end if
  96.   global gStatus
  97.   status gStatus
  98. end
  99.  
  100. on playVideo
  101.   set IsPlaying to true
  102.   set the visible of sprite videosprite to false
  103.   set the movietime of sprite videosprite to 0
  104.   set the movierate of sprite videosprite to 0
  105.   global resources
  106.   set the targetticks of resources to the shortinterval of resources+the ticks 
  107. end
  108.  
  109. on stopVideo
  110.   set IsPlaying to false
  111.   puppetsound 0
  112.   set videocast=the membernum of sprite videosprite
  113.   global resources
  114.   set the filename of member videocast to getBasePath(resources)&(the dvpath of the activerec of resources)
  115.   set the movietime of sprite videosprite to 0
  116.   set the movierate of sprite videosprite to 1
  117.   set the visible of sprite videosprite to true
  118.   global resources
  119.   set the targetticks of resources to (the duration of member videocast)+the ticks 
  120.   -- halt the video
  121. end 
  122.  
  123. on dispose me
  124.   set the visible of sprite videosprite to false
  125.   set the membernum of sprite spritenum to videoBtn
  126.   updateStage
  127.   puppetsprite spritenum,false
  128. end
  129.  
  130. on castsprite me,whichcast
  131.   set curcast=the number of member whichcast
  132.   set spritenum=0
  133.   if curcast>0 then
  134.     repeat with index=1 to 48
  135.       if the membernum of sprite index=curcast then
  136.         set spritenum=index
  137.         exit repeat
  138.       end if
  139.     end repeat
  140.   end if
  141.   return spritenum
  142. end