|
How to implement complex actionscripts in
flash movie using SWF Scout Updates in 2.xx version: now you can use built-in source code actionscript
compiler instead of using extracted bytecode as shown in this tutorial.
We recommend to develop complex scripts in Flash MX or another flash software with ActionScript support and then compile SWF code. Using our free SWFMixer utility you can get the compiled script bytecode for further use with SCRIPT_ methods. This tutorial will teach you how to get compiled script bytecode. Create and test FLA project with the complex script: ![]() ![]() Now we will export this flash project as SWF file. Go to File
menu and select Export Movie in Export sub-menu:
Review SWF flash movie properties and press OK to save SWF file:
![]() Enter the filename and click Save to save SWF file:
![]() Now run SWFMixer utility and click Open to open SWF
file:
![]() SWFMixer will show content of SWF file. Click on PlaceObject2
tag to view details about Place object
![]() Click Copy Actions Bytecode to copy the bytecode to the clipboard:
![]() SWFMixer will copy the bytecode to the clipboard:
![]() Now you can use this code to add an actionscript to your flash movie
generated with SWF Scout
VB code that uses compiled bytecode extracted using SWFMixer: ' KeyPress.vbs.
You can find source code of this example along with required files
'
in "Examples\More Examples" sub-folder
' Bytecode
was extracted from KeyPressEvent.swf. You can find this file in
"Examples\More Examples" folder as well
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)
'///////////////////
' Buttons
'////////////////////// Text = Movie.AddText("Use
arrow keys to move button",0,0,0,255,Font, 0, 80, 170, 160)
Movie.PlaceText Text,Movie.CurrentMaxDepth
' place text
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
Sprite = Movie.AddSprite
Movie.SPRITE_PlaceShape
Shape, 1
Action= Movie.AddScript
' this
compiled code below was extracted from KeyPress.swf using SWFMixer
utility
Movie.SCRIPT_AddCompiledBytecode
"88190005004B657900676574436F64650074686973005F78005F
7900960B0006000000000000000008001C9602000801528 70100009605000725000000669D02003500960700040007 27000000669D0200480096070004000726000000669D020 05B0096070004000728000000669D02006E009902008C00 96020008021C960400080308021C96020008034E9605000 7010000000B4F990200690096020008021C960400080308 021C96020008034E9605000701000000474F99020046009 6020008021C960400080408021C96020008044E96050007 010000000B4F990200230096020008021C9604000804080 21C96020008044E9605000701000000474F99020000000001" ' HINT:
if bytecode string is too long then you can save it to file and then
load it to string and then use this srtring variable with SCRIPT_AddCompiledBytecode
Movie.PlaceSprite Sprite,
2
Movie.PLACE_SetTranslate
200, 150
Movie.PLACE_SetScriptForEvent
Script, 1, 0
Movie.ShowFrame
1
Movie.EndMovie
Movie.SaveToFile
"KeyPress_SWFScout.swf"
download ZIP with FLA and SWF file: swfscout_using_complex_scripts.zip download SWFMixer utility (if you have SWF Scout installed then simply go to SWF Scout icon group and click SWFMixer icon to run SWFMixer) |
|
|
Copyright © ByteScout, 2003-2010. Privacy Statement
Microsoft®, Windows®, Windows 2000®, Windows Server®, Windows Vista®, Internet Explorer®, .NET Framework®, ActiveX®, Visual Basic®, Visual C#®, ASP®, ASP.NET®, Excel®, PowerPoint®, are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Adobe®, Flash® and Acrobat® are registered trademarks of Adobe Systems, Incorporated. Mozilla®, Firefox® and the Mozilla and Firefox Logos are registered trademarks of the Mozilla Foundation. Other product names or brandnames used herein are for identification purposes only and might be trademarks or registered trademarks of their respective companies. We disclaim any and all rights to those marks. |
|