PlaceText (ObjectIndex as long, Depth as long) as long

Description

Method places text object to the scene into given depth level

Only one single text 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 text object
Depth - depth on the scene to place text 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 ' width
H = 480 ' height
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 ' set background color to white
Dim Font1 As Integer
Font1 = Movie.AddFont("Arial", 18, True, False, False, False, 0) ' add font
' create and place text
Dim Text As Integer
Text = Movie.AddText("Hello, World!", 0, 0, 0, 255, Font1, 0, 100, 250, 160)
Movie.PlaceText Text, Movie.CurrentMaxDepth ' place text into current depth
Movie.PLACE_FadeOut 0.5 ' fade out text
Dim Shape As Integer
Shape = Movie.AddShape ' add new shape
Movie.SHAPE_Rectangle 0, 140, 150, 285 ' draw rectangle
Movie.SHAPE_SetSolidColor 50, 255, 50, True, 255 ' set solid fill for shape

Movie.PlaceShape Shape, Movie.CurrentMaxDepth ' place shape into current depth
Movie.ShowFrame 10 ' show 10 frames
Movie.EndMovie ' end movie generation
Movie.SaveToFile "c:\Shapes.swf" ' save generated SWF into file

C#:

                       SWFScout.FlashMovie Movie = new        SWFScout.FlashMovie();
                       Movie.InitLibrary("demo", "demo");
                       Movie.BeginMovie(0, 0, 640, 480, SWFScout.SWFSystemCoord.sscPix, 12, 6);
                       int Font = Movie.AddFont("Arial", 18, true, false, false, false, 0); // add font
                       // create and place text
                       int Text = Movie.AddText("Hello, World!", 0, 0, 0, 255, Font, 0, 100, 250, 160);
                       Movie.PlaceText(Text, Movie.CurrentMaxDepth); // place text into current depth
                       Movie.PLACE_FadeOut(0.5F); // fade out text
                       int Shape = Movie.AddShape(); // add new shape
                       Movie.SHAPE_Rectangle(0, 140, 150, 285); // draw rectangle
                       Movie.SHAPE_SetSolidColor(50, 255, 50, true, 255); // set solid fill for shape
                       Movie.PlaceShape(Shape, Movie.CurrentMaxDepth); // place shape into current depth
                       Movie.ShowFrame(10); // show 10 frames
                       Movie.EndMovie(); // end movie generation
                       Movie.SaveToFile("c:\\Shapes.swf"); //  save generated SWF into file


C++:

// HelloWorld.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#import "SWFScout.tlb"
using namespace SWFScout;

int main(int argc, char* argv[])
{
       // initialize OLE
       HRESULT hr = CoInitialize(NULL);

       // check for errors
       if (FAILED(hr)) {
       MessageBox(0,"OLE initialization errp","error",MB_OK);
       return -1;
       }
       // declare SWFScout object
       IFlashMovie* Movie = NULL;
       long Shape, Font, Text;
       CLSID clsid;

       // get inuque ID for IFlashMovie interface
       hr = CLSIDFromProgID(OLESTR("SWFScout.FlashMovie"), &clsid);
       // check for errors
       if (FAILED(hr)) {
       MessageBox(0,"Can't get CLSID for interface","error",MB_OK);
       goto Uninit;
       };
       // create FlashMovie object
       hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL,__uuidof(IFlashMovie), (LPVOID*)&Movie);
       // check for errors
       if (FAILED(hr)) {
       MessageBox(0,"Can't create Movie object","error",MB_OK);
       goto Uninit;
       }

       // initialize library
       Movie->InitLibrary("demo", "demo");
       // start movie generation
       Movie->BeginMovie(0,0,640,480,sscPix, 12,6);
       // start document generation

       Font = Movie->AddFont("Arial", 18, true, false, false, false, 0); // add font
       // create and place text
       Text = Movie->AddText("Hello, World!", 0, 0, 0, 255, Font, 0, 100, 250, 160);
       Movie->PlaceText(Text, Movie->CurrentMaxDepth); // place text into current depth
       Movie->PLACE_FadeOut(0.5); // fade out text
       Shape = Movie->AddShape(); // add new shape
       Movie->SHAPE_Rectangle (0, 140, 150, 285); // draw rectangle
       Movie->SHAPE_SetSolidColor(50, 255, 50, true, 255); // set solid fill for shape

       Movie->PlaceShape(Shape, Movie->CurrentMaxDepth); // place shape into current depth
       Movie->ShowFrame(10); // show 10 frames
       Movie->EndMovie(); // end movie generation
       Movie->SaveToFile("c:\\Shapes.swf"); // save generated SWF into file

       // disconnect from library
       Movie->Release();
       // uninitialize OLE libraries
       Uninit:
       CoUninitialize();
       return 0;
}


Also Check Examples

ewefwe
wefwefwe