|
PlaceSprite (ObjectIndex as long, Depth as long) as long
Description
Places given sprite (movieclip) object to the scene into the given depth.
Only one single sprite 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
See also:
Parameters
ObjectIndex - index of existing sprite(movieclip) object
Depth - depth on the scene to place sprite(movieclip) 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. Please note that sprites(movieclips) have their own timeframe.
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:
' using external swf flash movie as sprite (movieclip) in new flash movie
W = 640
H = 480
Set Movie = CreateObject("SWFScout.FlashMovie")
Movie.InitLibrary "demo","demo"
' Movie creating and setting parameters
Movie.BeginMovie 0,0,W,H,1,12,6
Movie.Compressed = true
Movie.SetBackgroundColor 255,255,255
Image = Movie.AddImageFromFilename("swfscout_logo.jpg")
Movie.AddPreloader 0, 0,0,0,180, 0,255,0,30, "Loading (%d% completed)...", Image
Font = Movie.AddFont( "Arial",12,true,false,false,false,0)
FontBig = Movie.AddFont("Arial",40,true,false,false,false,DEFAULT_CHARSET)
'//////////////////////////
' External SWF
'/////////////////////////
Text = Movie.AddText2 ("External SWF",0,0,0,255,FontBig, W / 2, 60,2)
Movie.PlaceText Text,Movie.CurrentMaxDepth ' place text
ExtSWF= Movie.AddExternalSWF ("Shapes.swf", 3, true) ' 3 is a Sprite mode so external movie is added as sprite and returned value is a sprite index in sprite collection
Movie.PLACE_SetTranslate 0, 0 ' set new position
Movie.PLACE_SetScale 0.5, 0.5 ' we set scale to 0.5
Movie.PlaceSprite ExtSWF, Movie.CurrentMaxDepth
ExtSWF= Movie.AddExternalSWF ("Transformations.swf", 3, true) ' 3 is a Sprite mode so external movie is added as sprite and returned value is a sprite index in sprite collection
Movie.PLACE_SetTranslate W / 2 , 0 ' set new position
Movie.PLACE_SetScale 0.5, 0.5 ' we set scale to 0.5
Movie.PlaceSprite ExtSWF, Movie.CurrentMaxDepth
Movie.ShowFrame 1
Movie.EndMovie
Movie.SaveToFile "ExternalSWF.swf"
C#:
// using external swf file as a sprite(movieclip)
int W = 640;
int H = 480;
SWFScout.FlashMovie Movie = new SWFScout.FlashMovie();
Movie.InitLibrary("demo", "demo");
Movie.BeginMovie(0, 0, 640, 480, SWFScout.SWFSystemCoord.sscPix, 12, 6);
Movie.Compressed = true;
Movie.SetBackgroundColor(255,255,255);
int Image = Movie.AddImageFromFilename("swfscout_logo.jpg");
Movie.AddPreloader(0, 0,0,0,180, 0,255,0,30, "Loading (%d% completed)...", Image);
int Font = Movie.AddFont( "Arial",12,true,false,false,false,0);
int FontBig = Movie.AddFont("Arial",40,true,false,false,false,0); // 0 is default charset
// External SWF
int Text = Movie.AddText2("External SWF",0,0,0,255,FontBig, W / 2, 60,SWFScout.SWFTextAlign.staLeft);
Movie.PlaceText (Text,Movie.CurrentMaxDepth);// place text
int ExtSWF= Movie.AddExternalSWF ("Shapes.swf", SWFScout.SWFExtIncludeMode.seimSprite, true); //Sprite mode so external movie is added as sprite and returned value is a sprite index in sprite collection
Movie.PLACE_SetTranslate(0, 0); // set new position
Movie.PLACE_SetScale(0.5F, 0.5F); // we set scale to 0.5
Movie.PlaceSprite(ExtSWF, Movie.CurrentMaxDepth);
ExtSWF = Movie.AddExternalSWF ("Transformations.swf", SWFScout.SWFExtIncludeMode.seimSprite, true); // 3 is a Sprite mode so external movie is added as sprite and returned value is a sprite index in sprite collection
Movie.PLACE_SetTranslate (W / 2 , 0); // set new position
Movie.PLACE_SetScale (0.5F, 0.5F);// we set scale to 0.5
Movie.PlaceSprite (ExtSWF, Movie.CurrentMaxDepth);
Movie.ShowFrame (1);
Movie.EndMovie();
Movie.SaveToFile("C:\\ExternalSWF.swf");
Process MyProcess = new Process();
// Set the file to open
MyProcess.StartInfo.FileName = "c:\\ExternalSWF.swf";
MyProcess.StartInfo.Verb = "Open";
// Start the process
MyProcess.Start();
C++:
Also Check Examples
|