PlaceButton (ObjectIndex as long, Depth as long) as long

Description

Method places existing button object to the scene using depth (Depth parameter)

Only one single 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 button object
Depth - depth on the scene to place button 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 creating and setting parameters

  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,0)

  Shape = Movie.AddShape
  Movie.SHAPE_Circle 0, 0, 40
  Movie.SHAPE_BeginRadialGradient
  Movie.SHAPE_AddRadialGradientColor 255,255,255,255
  Movie.SHAPE_AddRadialGradientColor 0,0,255,255
  Movie.SHAPE_EndRadialGradient 35,35

  Shape2= Movie.AddShape
  Movie.SHAPE_Circle 0,0,40
  Movie.SHAPE_BeginRadialGradient
  Movie.SHAPE_AddRadialGradientColor 255,255,255,255
  Movie.SHAPE_AddRadialGradientColor 0,0,128,255
  Movie.SHAPE_EndRadialGradient 40,40

  Button = Movie.AddButton(false,true)
  Movie.BUTTON_AddShape Shape, 0 ' sbstUp = 0
  Movie.BUTTON_AddShape Shape, 3 ' sbstHitTest = 3
  Movie.BUTTON_AddShape2 Shape,2,1.1,1.1,0,0,0,0,0,scttNone,0,0,0,0,false ' sbstOver = 2, scttNone = 2
  Movie.BUTTON_AddShape2 Shape2,1,1.1,1.1,0,0,0,0,0,scttNone,0,0,0,0,false
  Action= Movie.AddScript
  Movie.SCRIPT_GetUrl "http://www.swfscout.com/","_blank"
  Movie.BUTTON_SetScriptOnEvent 3,Action
  Movie.PlaceButton Button,Movie.CurrentMaxDepth
  Movie.PLACE_SetTranslate 100,150

  Movie.ShowFrame 1
  Movie.EndMovie

  Movie.SaveToFile "PlaceButton.swf"

C#:



C++:

Also Check Examples