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
De-Xplode that text position relative
WinGroup Xtra
MPEG Xtra Controller Button
Installed Fonts
Rotate Vertexlist
OpenAtLaunch
BinFileIO Xtra
Sound shifting
Star Parent Script
TrackThemColors
 

 

 

Behavior Movie Slider Control

Added on 9/17/1999

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC

This item has not yet been rated

Author: AntonioMonteiro

Drop on the movie, the slider bar, and the control dragger. Cna optionally be used with a field to report the time as well.

--Copyright 1999 Antonio Claudio Quixadá Monteiro
--quixada@ax.apc.org
--If you find this code helpful, send me an e-mail and let me know.  :-)

on getBehaviorToolTip me
  return "This script shall be assigned to a video sprite,"&RETURN&" rectangular shape sprite (the constraint),"&RETURN&¬
"bitmap sprite (the slider), and field sprite (to display video time)."
end

property thisSprite, spriteVideo, spriteLimit, spriteText, displayCount

on getPropertyDescriptionList
  set list = [:]
  if the type of the member of sprite the currentSpriteNum = #bitmap then
    addProp list, #displayCount, [#format:#boolean,#default:FALSE,¬
#comment:"Would you like to display the video time counting while dragging the slider?"¬
&RETURN&"If you do, please put a text field in the stage and assign it this script."]
  end if
  return list
end

--*********************
on beginSprite me
  set thisSprite = the spriteNum of me
  if the type of the member of sprite the currentSpriteNum = #bitmap then
    set the moveableSprite of sprite thisSprite to TRUE
  else if the type of the member of sprite the currentSpriteNum = #shape then
    sendAllSprites(#whichSpriteLimit, thisSprite)
    set the height of sprite thisSprite to 1
  else if the type of the member of sprite the currentSpriteNum = #digitalVideo then
    sendAllSprites(#whichSpriteVideo, thisSprite)
  else if the type of the member of sprite the currentSpriteNum = #field then
    sendAllSprites(#whichSpriteText, thisSprite)
  end if
end

--*********************
on enterFrame me
  if the type of the member of sprite the currentSpriteNum = #bitmap then
    if the mouseDown then
      
      if rollOver(thisSprite) then
        set the movieRate of sprite spriteVideo to 0
      end if
      
      put the duration of member (the member of sprite spriteVideo) into a
      put (the locH of sprite thisSprite) - the locH of sprite spriteLimit into b
      put float(a)/the width of sprite spriteLimit into c
      
      if rollOver(thisSprite) then
        set the movieTime of sprite spriteVideo to b * c
      end if
      
      if not rollOver(thisSprite) then
        put the duration of member (the member of sprite spriteVideo) into u
        put the width of sprite spriteLimit into v
        put float(u) /float(v) into w
        put the movieTime of sprite spriteVideo/w into x
        put x + the locH of sprite spriteLimit into y
        set the locH of sprite thisSprite to y
      end if
      
      if displayCount then
        if rollOver(thisSprite) then
          put the movieTime of sprite spriteVideo/60&&"seconds" into member (the member of sprite spriteText)
        end if
      end if
      
    else
      
      set the movieRate of sprite spriteVideo to 1
      
      put the duration of member (the member of sprite spriteVideo) into u
      put the width of sprite spriteLimit into v
      put float(u) /float(v) into w
      put the movieTime of sprite spriteVideo/w into x
      put x + the locH of sprite spriteLimit into y
      set the locH of sprite thisSprite to y
      set the locV of sprite thisSprite to the locV of sprite spriteLimit
      
      if displayCount then
        put " " into member (the member of sprite spriteText)
      end if
      
    end if
  else if the type of the member of sprite the currentSpriteNum = #shape then
    sendAllSprites(#whichSpriteLimit, thisSprite)
  else if the type of the member of sprite the currentSpriteNum = #digitalVideo then
    sendAllSprites(#whichSpriteVideo, thisSprite)
  else if the type of the member of sprite the currentSpriteNum = #field then
    sendAllSprites(#whichSpriteText, thisSprite)
  end if
end

--*********************
on whichSpriteLimit me, limitVar
  set the constraint of sprite thisSprite to limitVar
  set spriteLimit = limitVar
end

--*********************
on whichSpriteVideo me, video
  set spriteVideo = video
end

--*********************
on whichSpriteText me, texto
  set spriteText = texto
end

--*********************
on getBehaviorDescription
  return "This behavior must be assigned to all sprites needed to control the point of a digital¬
  video in time. This way, you can drag the slider and reach the exact moment you want to be displayed."¬
&RETURN&RETURN&"The sprites needed are:"&RETURN&¬
"1) Digital video"&RETURN&¬
"2) Bitmap (the slider to be dragged)"&RETURN&¬
"-->This bitmap may be positioned anywhere on the stage, because it will be repositioned ¬
at the left side of the shape sprite, and, as the video plays, it will move from left to right, ¬
according to the video time."&RETURN&¬
"3) Shape (to constrain the slider movement)"&RETURN&¬
"-->This shape may have any widht or height that you want, but MUST be horizontal. ¬
When the movie plays, its height will be reset to 1 pixel."&RETURN&¬
"4) Text field (optional, to display the current video time while dragging the slider)"&RETURN&RETURN&¬
"The Behavior will act in diferent ways, according to the type of the sprite it will be assigned. ¬
The only parameter recquired¬
  is to display or not the current video time in the optional text field. The dialog box should appear only¬
  when assigning this behavior to the slider bitmap."
end

 


Contact

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

Send e-mail