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
Rollover Ink Change
Set PlayBackMode of a Flash Sprite
Pause Button
Sprite Blender - Time
Making Stage fill screen or not
Eat That Dot
Radio Button Groups
Beatnik Xtra
Color Fader-Alphamania
Cool Control Button
 

 

 

Behavior Real Player ActiveX Control

Added on 4/3/2000

 

Compatibilities:
behavior D7 D8 PC

This item has not yet been rated

Author: MediaMacros (website)

Drop this on a Real Player ActiveX Sprite and your play, pause, and stop buttons. This is built around the G2 V.7 run of the ActiveX control, so no garantees that it will work with any other version.

property mediaType, spriteNum, file, adjustToFit, memberType, whatItem, autoStart, clipLoop, context

global isDone, rmSprite

on getPropertyDescriptionList me
  p_list = [:]
  if sprite(the currentSpriteNum).member.type = #ActiveX then
    p_list.addProp(#mediaType, [#format : #string, #default : "All", #comment : "Controls Type", #range : ["ImageWindow", "All", "ControlPanel", "PlayButton", "PositionSlider"]])
    p_list.addProp(#file, [#format : #string, #default : "", #comment : "File Name or URL:"])
    p_list.addProp(#adjustToFit, [#format : #boolean, #default : 0, #comment : "Resize viewing are to fit (based on center)?:"])
    p_list.addProp(#autoStart, [#format : #boolean, #default : 1, #comment : "Auto Start when loaded?:"])
    p_list.addProp(#context, [#format : #boolean, #default : 0, #comment : "Show the context menu when the user right clicks on the media?:"])
    p_list.addProp(#clipLoop, [#format : #integer, #default : 0, #comment : "How many times to loop?(1 for no loop):"])
  else
    p_list.addProp(#whatItem, [#format : #string, #default : "Play", #comment : "What item is this?", #range : ["Play", "Stop", "Pause", "PlayPause"]])
  end if
  return p_list
end

on beginSprite me
  memberType = sprite(spriteNum).member.type
  if memberType = #ActiveX then
    isDone = 0
    rmSprite = spriteNum
    --set the media type
    sprite(spriteNum).setNoLogo(false)
    sprite(spriteNum).controls = mediaType
    sprite(spriteNum).setNumLoop(clipLoop)
    sprite(spriteNum).setEnableContextMenu(context)
    --load the file
    the itemDelimiter = "\"
    newfile = ""
    repeat with x = 1 to file.item.count
      newFile = newFile & file.item[x]
      if x < file.item.count then
        newFile = newFile & "/"
      end if
    end repeat
    sprite(spriteNum).setSource(newFile)
    --resize?
    if adjustToFit = true then
      sprite(spriteNum).setPreFetch(true)
    else
      if autostart = 1 then sprite(spriteNum).doPlay()
    end if
  end if
end

on mouseUp me
  if memberType <> #activeX then
    case whatItem of
      "Play" :
        sprite(rmSprite).doPlay()
      "Pause" :
       sprite(rmSprite).doPause()
      "Stop" :
        sprite(rmSprite).doStop()
      "PlayPause" :
        if sprite(rmSprite).getPlayState() = 3 then
         sprite(rmSprite).doPause()
        else
       sprite(rmSprite).doPlay()
        end if        
    end case
  end if
end

on onPreFetchComplete me
  sendAllSprites(#resize)
end

on resize me
  if adjustToFit = true and memberType = #ActiveX then
    newWidth = sprite(spriteNum).getClipWidth()
    newHeight = sprite(spriteNum).getClipHeight()
    --get centers
    newLeft = (sprite(spriteNum).right + sprite(spriteNum).left) / 2 - (newWidth / 2)
    newTop = (sprite(spriteNum).bottom + sprite(spriteNum).top) / 2 - (newHeight / 2)
    sprite(spriteNum).rect = rect(newLeft, newTop, newLeft + newWidth, newTop + newHeight)
    if autoStart = 1 then
      sprite(spriteNum).doPlay()
    end if
  end if
end

on OnPositionChange param1, param2
  if param2 <= param1 then
    --at the end
    isDone = true
  end if
end


on getBehaviorDescription me
  describe = "This control will enable the Real Player G2 ActiveX element to play in Director 7 or higher." & return
  describe = describe & "Drop it on any buttons you create for play, pause, stop, and play/pause buttons as well as the ActiveX sprite as well." & return
  describe = describe & "The options are ..." & return & "ControlsType - Type of window.  For Video is ImageWindow." & return & "FileName - the file path or URL to the Real Media file." & return
  describe = describe & "Resize - Resize the sprite to fit the sprite to the size of the movie option." & return & "Auto Start - Begin automatically when media is loaded." & return
  describe = describe & "Show Content Menu - Should the content menu be displayed" & return & "Loop - how many times to loop the file (1 for no loop)" & return
  describe = describe & "The global variable isDone can be tracked to see when the video finishes playing." & return
  describe = describe & "More info on the control's methods, properties and call backs are available at http://service.real.com/help/library/guides/extend/embed.htm & http://service.real.com/help/library/guides/productiong261/realpgd.htm"
  return describe
end

 


Contact

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

Send e-mail