Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

How to dynamically load movieclip and manipulate it using actionscript source code compiler in the SWF Scout library

Generated Flash movie (move mouse over move to see moving object):

The main idea is:

1) add external movie as sprite (movieclip) using .AddExternalSWF
2) place this movieclip to scene using .PlaceSprite and then set movieclip name using .PLACE_Name property
3) now you can access this movieclip from actionscript code using new movieclip name

In this sample we set mcl_shapes for new movieclip and then we move mcl_shapes up to mouse:

VB source code:

' ExternalSWF_AccessExternalMovieClipFromASCode.vbs

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

'//////////////////////////
' External SWF
'/////////////////////////

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.PlaceSprite ExtSWF, Movie.CurrentMaxDepth

Movie.PLACE_SetTranslate 0, 0 ' set new position
Movie.PLACE_SetScale 0.5, 0.5 ' we set scale to 0.5

' now set name for added movieclip (sprite) so can manipulate with it with actionscript
Movie.PLACE_Name = "mcl_shapes"

' compiling code for enterFrame event of mcl_shapes to move and rotate movie clip to mouse
Movie.PLACE_CompileEvent "onClipEvent(enterFrame){dify=_root._ymouse - _root.mcl_shapes._y;difx=_root._xmouse- _root.mcl_shapes._x;_root.mcl_shapes._x=_root.mcl_shapes._x+(difx/5);_root.mcl_shapes._y=_root.mcl_shapes._y+(dify/5);_rotation+=10;}"

Movie.ShowFrame 1

Movie.EndMovie

Movie.SaveToFile "ExternalSWF_AccessExternalMovieClipFromASCode.swf"


Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement