Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

How to use semi-transparent PNG images (with alpha layer) in flash movies produced with SWF Scout

Download source code of this example (including source PNG and final SWF files):
swfscout_using_png_with_alpha_channel_transparency.zip (220KB)

Produced flash movie (png_transparency_sample.swf)

Source code (png_transparency_sample.vbs):

W = 640 ' width
H = 480 ' height
Set Movie = CreateObject("SWFScout.FlashMovie")
Set ImageLdr = CreateObject ("SWFScoutImgAddon.ImageLoader")

Movie.InitLibrary "demo", "demo"

Movie.BeginMovie 0, 0, W, H, 1, 12, 8

Font = Movie.AddFont("Arial", 18, True, False, False, False, 0) ' add font
' create and place text
Text = Movie.AddText("PNG with transparency Sample", 0, 0, 0, 255, Font, 50, 130, 380, 200)
Movie.PlaceText Text, Movie.CurrentMaxDepth ' place text into current depth


ImageLdr.ConnectToSWFLibrary (Movie)
Image = ImageLdr.AddImageFromFileNameEx ("TransparentPNG.png")

ImageLdr.DisconnectFromSWFLibrary

Movie.IMAGE_ConvertToJPEG 75 ' force use of JPEG compression for image so decrease final swf file size up to 5 times

' add image
Shape = Movie.AddShape ' add new shape
Movie.SHAPE_Rectangle 0, 0, 188, 170 ' draw rectangle
Movie.SHAPE_SetImageFill Image, 1 ' set image fill for shape, 1=sfimFit mode
Movie.PlaceShape Shape, Movie.CurrentMaxDepth ' place shape into max depth in sprite

Movie.ShowFrame 1 ' show 10 frames

Movie.EndMovie ' end movie generation

Movie.SaveToFile "png_transparency_sample.swf"

' disconnect from library
Set Movie = Nothing

Download source code of this example (including source PNG and final SWF files):
swfscout_using_png_with_alpha_channel_transparency.zip (220KB)

See also: adding PNG image (visual c++ source code) - swfscout_add_png_visual_c.zip (100 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