Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

How to dynamically load and display images from external JPG files in the flash movie generated using the SWF Scout library

Download source code of this example: swfscout_loading_images_using_actionscript.zip (150 KB)

Screenshot of flash movie that uses images from external .JPG files:

flash displays images loaded from external JPEG image files

Source code:

' TO USE ACTIONSCRIPT COMPILER in registered version YOU HAVE TO HAVE ADDITIONAL "AS License"

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_loading_images_using_actionscript.zip (150 KB)

Download Free Trial Buy Now More Information

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