ActionScript is executed by the ActionScript Virtual Machine (AVM), which is part of Flash Player and AIR. ActionScript code is typically compiled into bytecode format (a sort of programming language that’s written and understood by computers) by a compiler, such as the one built into Adobe® Flash® CS4 Professional or Adobe® Flex™ Builder™, or that is available in the Adobe® Flex™ SDK. The bytecode is embedded in SWF files, which are executed by Flash Player and AIR.
What is Adobe Flex? Like Flash, Flex creates SWF files that are rendered by Flash Player. However, Flex is primarily a developer's tool and the way you develop Flex applications is entirely different than the way you develop Flash RIAs. All Flex development is based upon a framework that provides you with reusable and extendable UI components, data retrieval services, event handling functionality and much more. You can create RIAs in a familiar code-centric environment, but you still reap the benefits of Flash applications, which include:
In comparison, the Adobe Flash Authoring environment revolves around a timeline metaphor and visual development tools. Because of this emphasis, and despite the evolution of Flash's programming language, ActionScript, into a fully object-oriented ECMA-4-compliant language, Flash has traditionally been seen as a designer's tool for creating animations. Over the years, many programmers have learned the benefits of using Flash to create powerful RIAs, but others have found the IDE to be difficult to understand.
You should note that Flash and Flex can work together. As a matter of fact, Flex can work directly with other products in the Adobe Create Suite, as well. Designers and programmers can easily “create” in their own environments and then integrate their work to establish an entirely new breed of RIAs.
Summary: Flash is better suited for making movies and animations. Flex is better for application development.
Some technology:
Recomended to use Haxe + OpenFL:
Before an ActionScript program can be executed by a Flash runtime, it must be converted from human-readable ActionScript 3.0 code to a condensed, binary format that Flash runtimes understand, known as ActionScript bytecode,or ABC. The process of converting an ActionScript program to bytecode is known as compiling the program.
refer: http://www.flashdevelop.org/
Build halted with errors (fcsh).
Fix:
refer: http://www.flashdevelop.org/wikidocs/index.php?title=AS3#Workflows
Compile using Flash
Compile using the Flex SDK and create assets using Flash
Compile using the Flex SDK
refer: http://www.flashdevelop.org/wikidocs/index.php?title=AS3:Debugging (To run Debug, you must config JAVA_HOME to java 32 bits)
Change using Tab to 3 spaces in FlashDevelop:
Change output swf screen size in .as3proj:
<movie width="800" /> <movie height="660" />
Using Adobe Flash to open .fla file and compile it change option in case ran out of memory when compile: C:\Users\anhvc\AppData\Local\Adobe\Flash CS5.5\en_US\Configuration\ActionScript 3.0\jvm.ini from:
-Xmx128m
to
-Xmx512m
refer: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf614b9-7ff3.html Install and config to run FlexSDK:
java.exe -version
java.home=d:\tools\jdk1.6.0_11_32bits
If we can't compile because error below:
Error: could not find a JVM.
We set follow the step4
java.home=
refer:http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7add.html
d:\tools\flex_sdk_4.5\bin\mxmlc.exe -static-link-runtime-shared-libraries=true -o output.swf -source-path="D:\simplegame\src\" "D:\simplegame\src\games.as"
d:\tools\flex_sdk_4.6\bin\mxmlc xxx.mxml
mxmlc -library-path+=/xx/lib1.swc;/xx/lib2.swc xxx.mxml
mxmlc -runtime-shared-library-path=/xx/lib.swc,/yy/bin/library.swf xx.mxml
d:\tools\flex_sdk_4.5\bin\compc -load-config=build-swc.xml
d:\tools\flex_sdk_4.5\bin\compc -include-sources "d:/tools/flashapi/RoadComponent/r36/src" -output RoadComponent.swc
d:\tools\flex_sdk_4.6\bin\compc -include-sources "src" -compiler.library-path "libs" -output 2.swc
http://en.wikipedia.org/wiki/Adobe_SWC_file http://haxe.org/manual/swc
haxe DDT_Loading -swf loading.swc -swf-lib loading.swf -swf-version 10 haxe --macro include('*') -swf 2.swc -swf-lib 2.swf -swf-version 10
D:\tools\apache-ant-1.8.4\bin\ant.bat -buildfile build.xml main
The Adobe® AIR® runtime enables developers to package the same code into native apps for Windows and Mac OS desktops as well as iPhone, iPad, Kindle Fire, Nook Tablet, and other Android™ devices, reaching the mobile app stores for over 500 million devices.
AIR applications on mobile devices are deployed as native applications. They use the application format of the device, not the AIR file format. Currently AIR supports Android APK packages and iOS IPA packages. Once you have created the release version of your application package, you can distribute your app through the standard platform mechanism. For Android, this typically means the Android Market; for iOS, the Apple App Store.
You can use the AIR SDK and Flash Professional, Flash Builder, or another ActionScript development tool to build AIR apps for mobile devices. HTML-based mobile AIR apps are not currently supported.
ActionScript programs can be executed by three different software applications (all produced by Adobe): Flash Player application, Adobe AIR, Flash Lite, or browser with Flash Plugin
refer:
Go to Control Pannel → Flash Player and action steps follow the images below:
Add Folder: D:\tools\SmartFoxServerPRO_1.6.6\Examples\ ⇒ we can run any swf files from directory D:\tools\SmartFoxServerPRO_1.6.6\Examples\ with flash player application on windows
refer: https://www.adobe.com/devnet-docs/acrobatetk/tools/AppSec/xdomain.html
import flash.system.Security; Security.loadPolicyFile("http://avatar.me.zdn.vn/crossdomain.xml"); Security.allowDomain("http://myplay.apps.zing.vn");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>SWFObject 2 static publishing example page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> swfobject.registerObject("myId", "9.0.0", "expressInstall.swf"); </script> </head> <body> <div> <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="140"> <param name="movie" value="test.swf" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="test.swf" width="300" height="140"> <!--<![endif]--> <div> <h1>Alternative content</h1> <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p> </div> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </div> </body> </html>
simple run:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>SWFObject 2 dynamic publishing example page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> swfobject.embedSWF("test.swf", "myContent", "300", "140", "9.0.0", "expressInstall.swf"); </script> </head> <body> <div id="myContent"> <h1>Alternative content</h1> <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p> </div> </body> </html>
run with flashvars:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Game Bài</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> var flashvars="username=anhvc01"; var params={ quality:"low", bgcolor:"#004040", allowScriptAccess:"always", FlashVars:flashvars }; swfobject.embedSWF("cardgame.swf", "game", "800", "660", "9.0.0", "expressInstall.swf", null, params); </script> </head> <body> <div id="game"> <h1>Tiến Lên</h1> <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p> </div> </body> </html>
refer file mmorpg.php of hsr
<?php $username = isset($_GET['username'])?$_GET['username']:"test01"; $gametype = isset($_GET['gametype'])?$_GET['gametype']:"tienlen"; $flashVars = "username=".$username."&gametype=".$gametype; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Game Bài</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> var params={ quality:"low", bgcolor:"#004040", allowScriptAccess:"always", FlashVars:<?php echo '"'.$flashVars.'"' ?> }; swfobject.embedSWF("cardgame.swf", "game", "800", "660", "9.0.0", "expressInstall.swf", null, params); </script> </head> <body> <div id="game"> <h1>Tiến Lên</h1> <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p> </div> </body> </html>
You must build the flash with debug mode(The size of swf file in debug mode was bigger the size of in swf file in release mode)
Note: You must install Flash Player Debug
Below are steps to config debug for flash player:
PolicyFileLog=1 PolicyFileLogAppend=0 ErrorReportingEnable=1 TraceOutputFileEnable=1 SuppressDebuggerExceptionDialogs=1
%USERPROFILE%\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt
(Debug on Opera more better on Chrome) Install Flash Player Debug in chrome and Opera:
about:plugins or chrome://plugins/
Then enable the plugin flash debugger plugin and disable the old plugin, You must view the plugins in detail mode to see the plugin description in debug mode:
Description: Shockwave Flash 20.0 r0 Debug
Config debug in Chrome:
%USERPROFILE%/AppData/Local/Google/Chrome/User Data/Default/Pepper Data/Shockwave Flash/System
%USERPROFILE%/AppData/Local/Google/Chrome/User Data/Default/Pepper Data/Shockwave Flash/WritableRoot/Logs/flashlog.txt
Config debug in Opera:
%USERPROFILE%/AppData/Roaming/Opera Software/Opera Stable/Pepper Data/Shockwave Flash/System
%USERPROFILE%/AppData/Roaming/Opera Software/Opera Stable/Pepper Data/Shockwave Flash/WritableRoot/Logs/flashlog.txt
trace(string)
trace(a)
⇒> a is undefined variable
findpropstrict QName(PackageNamespace(""), "trace") pushstring "debug string" callpropvoid QName(PackageNamespace(""), "trace"), 1
refer:
Basic update:
d:\tools\Rabc\abcexport PackageOut.swf
rd /S /Q PackageOut-0 d:\tools\Rabc\rabcdasm PackageOut-0.abc
Some examples:
d:\tools\Rabc\rabcasm CommModule-0\CommModule-0.main.asasm d:\tools\Rabc\abcreplace CommModule.swf 0 CommModule-0\CommModule-0.main.abc d:\tools\Rabc\abcexport DDT_Loading.swf d:\tools\Rabc\rabcdasm DDT_Loading-0.abc d:\tools\Rabc\rabcasm DDT_Loading-0\DDT_Loading-0.DDT_Loading.asasm d:\tools\Rabc\abcreplace DDT_Loading.swf 0 DDT_Loading-0\DDT_Loading-0.DDT_Loading.abc d:\tools\Rabc\abcexport 2.swf d:\tools\Rabc\rabcdasm 2-0.abc d:\tools\Rabc\rabcasm 2-0\2-0.main.asasm d:\tools\Rabc\abcreplace 2.swf 0 2-0\2-0.main.abc
D:\tools\flex_sdk_4.5\bin\mxmlc.exe -static-link-runtime-shared-libraries=true -o SocketManager.swf -source-path=“2” “2\ddt\manager\SocketManager.as”
D:\tools\flex_sdk_4.5\bin\mxmlc.exe -compiler.library-path=2. swc SocketManager.as
d:\tools\Rabc\rabcasm Loading-0\Loading-0.main.asasm d:\tools\Rabc\abcreplace Loading.swf 0 Loading-0\Loading-0.main.abc
void*abccode = swf_ReadABC(tag); swf_DumpABC(stdout, abccode, “”);
d:\tools\Rabc\abcexport LoadInterface.swf d:\tools\Rabc\rabcdasm LoadInterface-0.abc d:\tools\Rabc\rabcasm LoadInterface-0\LoadInterface-0.main.asasm d:\tools\Rabc\abcreplace LoadInterface.swf 0 LoadInterface-0\LoadInterface-0.main.abc d:\tools\Rabc\rabcasm GameLoader-0\GameLoader-0.main.asasm d:\tools\Rabc\abcreplace GameLoader.swf 0 GameLoader-0\GameLoader-0.main.abc
Basic change abc code:
When compiling ActionScript programs with the Flash authoring tool, FlexBuilder,or mxmlc, bear in mind the following compiler restrictions:
package { public class A { } public class B { } }
Likewise, the following source file would be considered illegal because it does not contain any externally visible definition
class C { }
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event:
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
package { import flash.display.Sprite; public class ClickExample extends Sprite { public function ClickExample() { var child:ChildSprite = new ChildSprite(); addChild(child); } } } import flash.display.Sprite; import flash.events.MouseEvent; class ChildSprite extends Sprite { public function ChildSprite() { graphics.beginFill(0xFF0000); graphics.drawRect(0,0,100,100); graphics.endFill(); addEventListener(MouseEvent.CLICK, clickHandler); } private function clickHandler(event:MouseEvent):void { trace("clickHandler detected an event of type: " + event.type); trace("the this keyword refers to: " + this); } }
dispatchEvent(event:Event):Boolean
⇒ Dispatches an event into the event flow(The same send message in windows). For example:
dispatchEvent(new Event(Event.COMPLETE));
Using swfdump to check swf information
swfdump.exe OpenTreasure_old.swf > OpenTreasure_old.txt swfdump.exe OpenTreasure_new.swf > OpenTreasure_new.txt
Script dump all swf files in directory:
dir /B > listfiles.txt for /F "delims=\r" %x in (listfiles.txt) do (d:\tools\SWFTools\swfdump.exe -D %x > %x.txt)
swfcombine.exe -d OpenTreasure.swf -o OpenTreasure_new.swf
swfcombine.exe -dz OpenTreasure.swf -o OpenTreasure_new.swf
swfcombine.exe -o OpenTreasure_new.swf OpenTreasure_old.swf #147=147_edit.swf
swfextract.exe -i 69 -o 69.swf UILibrary_1.swf swfcombine.exe -o UILibrary_1_new.swf UILibrary_1.swf #69=69_edit.swf
and check the changes with swfdump:
swfdump.exe -D UILibrary_1.swf > UILibrary_1_old.txt swfdump.exe -D UILibrary_1_new.swf > UILibrary_1_new.txt
swfcombine.exe -o NewTask_new.swf NewTask.swf #38=40.swf
And check changes with swfdump:
swfdump.exe -D NewTask.swf > NewTask.txt swfdump.exe -D NewTask_new.swf > NewTask_new.txt
swfdump.exe -D NewTeam.swf > NewTeam.txt swfcombine.exe -o NewTeam_new.swf NewTeam.swf #72=123.swf swfdump.exe -D NewTeam_new.swf > NewTeam_new.txt
d:\tools\Rabc\abcexport main.swf d:\tools\Rabc\rabcdasm main-0.abc d:\tools\Rabc\rabcasm main-0\main-0.main.asasm d:\tools\Rabc\abcreplace main.swf 0 main-0\main-0.main.abc
Extract spriteId 147 from swf file
swfextract.exe -i 147 -o 147.swf OpenTreasure_old.swf
refer: http://www.monsterdebugger.com/
Below are some baisc debug methods:
package { import com.demonsters.debugger.MonsterDebugger; import flash.display.Sprite; public class Main extends Sprite { public function Main() { // Start the MonsterDebugger MonsterDebugger.initialize(this); MonsterDebugger.trace(this, "Hello MonsterDebug!"); } } }
import com.demonsters.debugger.MonsterDebugger; MonsterDebugger.initialize(this);
⇒ Will called before trace, It established connection with MonsterDebug Program
var person:Object = {name:"Mike", age:25, gender:"Male"}; MonsterDebugger.trace(this, person);
To Debug GUI, You must select View → Highlight Inspect after start the flash application and connect to MonsterDebugger
notes: Before rebuilt the fla file from decompiler source, you need to change source path and library path to directory which contain actionscript source
Analyze all decompiler tools:
Below are steps decompile and fix:
Below are steps decompile and fix:
Download and Install:
@echo off java -Xmx1024m -Djna.nosys=true -jar "%~dp0\ffdec.jar" %*
Some basic command lines(To run it, we need run DOS as Administrator):
ffdec.bat --help
java -jar ffdec.jar filename.swf
java -jar ffdec.jar -export script "src" filename.swf
java -jar ffdec.jar -format fla:cs5.5 -export fla "src\filename.fla" filename.swf
Sau khi cài đặt xong, bạn chọn một trong 2 cách Crack bên dưới:
Đây là 2 cách Crack Adobe Flash Professional CS5 mà chắc chắn là các bạn sẽ thành công sau khi thực hiện 1 trong 2 cách trên.