Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

How to save images into single SWF file and how to use this file as a resource in the new flash movie using SWF Scout

Download source code of this example: swfscout_create_images_library_and_use_library_in_new_swf.zip (433 KB)

SWF file with image stored (SWF library):

New SWF that uses previous SWF and manipulates images from attached SWF library:

Source code:

W = 640
H = 480
FPS = 12

' // make a SWF library with images

Set Movie = CreateObject("SWFScout.FlashMovie")
Movie.InitLibrary "demo", "demo"
' Movie creating and setting parameters
Movie.BeginMovie 0,0,W,H,1,FPS,6
Movie.Compressed = true

For ImageIndex = 1 to 3

image = Movie.AddImageFromFilename("NewImage" & CStr(ImageIndex) & ".jpg")
sprite = Movie.AddSprite
currobj = Movie.CurrentObjectID
Movie.SPRITE_PlaceImage Image, Movie.SPRITE_CurrentMaxDepth
Movie.ExportAssets "image" & CStr(ImageIndex), currobj

Movie.PlaceSprite Sprite, Movie.CurrentMaxDepth

Next

Movie.EndMovie
Movie.SaveToFile "MakeImagesLibraryAndMakeSWFUsingThisLibraryFromExtFile_lib.swf"

Set Movie = nothing

'//////////////////////////
' now create movie that will use produced LIB from SWF
'/////////////////////////

Set Movie = CreateObject("SWFScout.FlashMovie")
Movie.InitLibrary "demo", "demo"
Movie.BeginMovie 0,0,W,H,1,FPS,6
Movie.Compressed = true

Movie.AddExternalSWF "MakeImagesLibraryAndMakeSWFUsingThisLibraryFromExtFile_lib.swf", 1, true ' // seimResource = 1

'// now addding actionscript to place images at given X and Y, using their names mcl_image1, mcl_image2 etc
For ImageIndex = 1 to 3

' create a movieclip and attach image from library
Movie.AddScript
Movie.SCRIPT_Compile "this.createEmptyMovieClip('mcl_image" & CStr(ImageIndex) & "', _root.getNextHighestDepth()+" & CStr(ImageIndex) & ");attachMovie('image" & CStr(ImageIndex) & "', 'mcl_image" & CStr(ImageIndex) & "', getNextHighestDepth());"
MsgBox Movie.ASCompilerLog


' place image to X, Y (x = ImageIndex*10, y = ImageIndex * 15)
X = ImageIndex *10
Y = ImageIndex *15
Movie.AddScript
Movie.SCRIPT_Compile "mcl_image"& CStr(ImageIndex) & "._x=" & CStr(X) & ";mcl_image"& CStr(ImageIndex) & "._y=" & CStr(Y) & ";"
Movie.ShowFrame FPS*1 ' show frames for 1 second
Next

Movie.EndMovie

Movie.SaveToFile "MakeImagesLibraryAndMakeSWFUsingThisLibraryFromExtFile.swf"

Download source code of this example: swfscout_create_images_library_and_use_library_in_new_swf.zip (433 KB)


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