PlaceVideo (ObjectIndex as long, Depth as long) as long

Description

Method places video object to the scene into given depth level. Add video from FLV using .AddVideoFromFileName function. First frame of the video is displayed by default and to play the whole video you should call for .ShowFrame with appropriate number of frames required to play video and change FPS (frames per second) option of main flash movie to the FPS of the video to sync video with movie properly. To get number of frames in video object use VIDEO_FrameCount
To get FPS (frames per second) parameter of video object use VIDEO_FramesPerSecond property and change FPS of main flash movie using .FramesPerSecond property

Only one single video object can be placed into the given depth. To remove object set PLACE_AutoRemoveDepth to True to automatically replace object with new when new object is placed into the same depth or remove object from depth using RemoveObject method

To create FLV video from AVI, MPEG, WMV please check freeware Riva FLV encoder

See also:


Parameters

ObjectIndex - index of existing video object to place to the scene
Depth - depth on the scene to place video into. In most cases you can use .CurrentMaxDepth to automatically set max available depth. Up to 65000 depths are available. If you need to create animation then you should store .CurrentMaxDepth
to variable and then use sequence: create visual object, place to the scene, show frames, remove from scene, place it again, move object using PLACE_ methods and properties, show frames again

Example on moving visual object in the movie:

Shape = Movie.AddShape
Movie.SHAPE_Rectangle 0, 40, 150, 165
Movie.SHAPE_SetSolidColor 145,245,245,true,255

StoredDepth = Movie.CurrentMaxDepth

For i=0 to 100
       Movie.RemoveObject StoredDepth
       Movie.PlaceShape Shape, StoredDepth
       Movie.PLACE_SetPosition 10+i*2, 10+2*i
       Movie.ShowFrame 1
Next


Result

Returns index of new PLACE_ object in zero-based PLACE objects collection

Example:

Visual Basic / VBScript / ASP:

  W = 640
  H = 480
  Set Movie = CreateObject("SWFScout.FlashMovie")
  Movie.InitLibrary "demo", "demo"

  Movie.BeginMovie 0,0,W,H,1,12,6
  Movie.Compressed = true
  Movie.SetBackgroundColor 255,255,255

Font = Movie.AddFont( "Arial",12,true,false,false,false,0)
FontBig = Movie.AddFont("Arial",40,true,false,false,false,DEFAULT_CHARSET)

Text = Movie.AddText2 ("Video",0,0,0,255,FontBig, W / 2, 60,2)
Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text

  Video= Movie.AddVideoFromFileName("test.flv")
  Movie.FramesPerSecond= Movie.VIDEO_FramesPerSecond
  Movie.PlaceVideo Video,Movie.CurrentMaxDepth
  Movie.PLACE_SetTranslate 190,150
  Movie.ShowFrame Movie.VIDEO_FrameCount

Movie.EndMovie

Movie.SaveToFile "Video.swf"

C#:



C++:

Also Check Examples