User Tools

Site Tools


my:flash-and-actionscript

Table of Contents

Flash And Actionscript

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.

Understand Flash and Flex

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:

  • The ability to design and implement human-centered user interfaces without worrying about browser limitations.
  • A runtime environment with almost 100% deployment to all Internet users.
  • The powerful ActionScript programming language.
  • The ability to integrate rich media like streaming video and sound.

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.

Flash to run on Android, IOS, HTML5

Some technology:

Recomended to use Haxe + OpenFL:

  • Haxe: http://haxe.org/ → Haxe is a language based on ActionScript. With Haxe, you can easily build cross-platform tools targeting all the mainstream platforms natively.(Refer haxe target
  • OpenFL: http://www.openfl.org/ → uses the familiar Flash API, but goes everywhere that Flash Player cannot.

Compile and run

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.

Compile with Flashdevelop

Install

  1. Step1: Install java 32bits before install FlashDevelop
  2. Step2: set environment variables JAVA_HOME and *PATH* to path of java 32bits
  3. Step3: Select some option compilers below and install:
  4. Step4: We can install missing compiler by open flashdevelop and go to tools → Install Software

Create new flash project

Create new flex project

Import new flex project exist

  1. Step1: Copy all sources of exist project to directory D:\projects\flash\simplechat\
  2. Step2: Create new project Flex4 Project with option unchecked Create Directory for Project
  3. Step3: Right Click SimpleChat.xml to set it as Document Class
  4. Step4: Right Click libs\SFS2X_API_AS3.swc to set it as Add To Library

  1. Step5: Build the project, output:
    Build halted with errors (fcsh).

    Fix:

    • End Java Process in Task Manager and rebuilt the project
    • Or Fix all warnings and rebuilt the project
    • Or Off all warnings in Compiler Options of .as3proj file

FlashDevelop workflow

refer: http://www.flashdevelop.org/wikidocs/index.php?title=AS3#Workflows

Compile using Flash

  • Use Flash to create graphics and to embed resources such as sounds and fonts
  • Use FlashDevelop to write ActionScript classes
  • Use Flash to associate your resources with a document class or with linkage classes
  • Use Flash to compile your project
  • See: Flash workflow tutorial

Compile using the Flex SDK and create assets using Flash

  • Use Flash to create graphics and to embed resources such as sounds and fonts
  • Use Flash to publish an SWC library file
  • Add the SWC as a library in your FlashDevelop project
  • Use FlashDevelop to compile your project using the Flex SDK
  • See: Flex SDK and Flash workflow tutorial

Compile using the Flex SDK

  • Add resources such as graphics, sounds and fonts to your FlashDevelop project
  • Use FlashDevelop to write ActionScript classes
  • Use embed tags in your ActionScript to include assets
  • Use FlashDevelop to compile your project using the Flex SDK

Debug in FlashDevelop

refer: http://www.flashdevelop.org/wikidocs/index.php?title=AS3:Debugging (To run Debug, you must config JAVA_HOME to java 32 bits)

  1. Step1: Go to tools → Install Software, Install FlashPlayer Debug tools for FlashDevelop:
  2. Step2: Configure build project with debug mode and run it

Change Tab settings in Editor

Change using Tab to 3 spaces in FlashDevelop:

  1. Step1: Go to Tools→Program Settings
  2. Step2: in section Main→FlashDevelop change Indenting configs:
    • Indenting size: 3
    • Use Tab Characters: False
    • Width of Tab: 3

Custom Compiler Options

Change output swf screen size in .as3proj:

    <movie width="800" />
    <movie height="660" />

Compile with Adobe flash(.fla file)

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

Compile with flash builder

Compile with flex SDK

refer: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf614b9-7ff3.html Install and config to run FlexSDK:

  • Step1: Check exist java 32 bits in windows:
    java.exe -version
  • Step2: Install JDK or JRE windows 32bits(not 64bits) to d:\tools\jdk1.6.0_11_32bits If in windows not exists java 32bits
  • Step3: Configure Flex SDK D:\tools\flex_sdk_4.5\bin\jvm.config to use jre 32bits:
    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

  • Step4: Or change the windows environment JAVA_HOME to d:\tools\jdk1.6.0_11_32bits and edit D:\tools\flex_sdk_4.5\bin\jvm.config:
    java.home=

Compile Disabling framework RSLs

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"

Using mxlmc compile base on mxml config

  • Simple compile
    d:\tools\flex_sdk_4.6\bin\mxmlc xxx.mxml
  • Compiling an application that uses SWC files
    mxmlc -library-path+=/xx/lib1.swc;/xx/lib2.swc xxx.mxml
  • Compiling an application that uses RSLs
    mxmlc -runtime-shared-library-path=/xx/lib.swc,/yy/bin/library.swf xx.mxml

Using compc compile with xml config

d:\tools\flex_sdk_4.5\bin\compc -load-config=build-swc.xml

Using compc to compile swc library

  • Compile source in d:/tools/flashapi/RoadComponent/r36/src to swc library RoadComponent.swc
    d:\tools\flex_sdk_4.5\bin\compc -include-sources "d:/tools/flashapi/RoadComponent/r36/src" -output RoadComponent.swc
  • Compile source in src to swc libray 2.swc, this source use libraries in libs
    d:\tools\flex_sdk_4.6\bin\compc -include-sources "src" -compiler.library-path "libs" -output 2.swc

convert swf to swc file

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

Build with ant tool

D:\tools\apache-ant-1.8.4\bin\ant.bat -buildfile build.xml main

Developing AIR applications for mobile devices

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.

Run swf file

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

Config allow flash run on local and connect any domains

Config for flash player application on windows

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

Config for flash player plugin of browser

  1. Step2: Click link Global Security Settings panel
  2. Step3: Click Edit Location too add folder which you want to run the all swf files

config allow domain with actionscript

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");

Conditional Compilation

Run Embeded swf in browser

Run Embeded swf with simple HTML

<!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>

Run Embeded swf with swfobject

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>

Run SWF Object with PHP code

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>

Debug in flash player

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)

Config turn on debug for flash player run on Windows

Note: You must install Flash Player Debug

Below are steps to config debug for flash player:

  1. Step1: Create mm.cfg file in %USERPROFILE%\ with content below:
    PolicyFileLog=1
    PolicyFileLogAppend=0
    ErrorReportingEnable=1
    TraceOutputFileEnable=1
    SuppressDebuggerExceptionDialogs=1
  • Step2: Check log file which contain debug informations:
    %USERPROFILE%\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt

Config turn on debug for flash player run on Chrome and Opera

(Debug on Opera more better on Chrome) Install Flash Player Debug in chrome and Opera:

  • Step1: install flash player debug plugin on chrome
  • Step2: open new tab on google chrome and run:
    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:

  • Step1: Create mm.cfg file in directory
    %USERPROFILE%/AppData/Local/Google/Chrome/User Data/Default/Pepper Data/Shockwave Flash/System
  • Step2: Restart the chrome and run swf file with chrome, then check log file in
    %USERPROFILE%/AppData/Local/Google/Chrome/User Data/Default/Pepper Data/Shockwave Flash/WritableRoot/Logs/flashlog.txt

Config debug in Opera:

  • Step1: Create mm.cfg file in directory
    %USERPROFILE%/AppData/Roaming/Opera Software/Opera Stable/Pepper Data/Shockwave Flash/System
  • Step2: Restart the opera and run swf file with opera, then check log file in
    %USERPROFILE%/AppData/Roaming/Opera Software/Opera Stable/Pepper Data/Shockwave Flash/WritableRoot/Logs/flashlog.txt

Debug code in ActionScript

  • command to write log
    trace(string)
  • trace all old function
    trace(a)

    ⇒> a is undefined variable

  • abc code of trace command
    findpropstrict      QName(PackageNamespace(""), "trace")
    pushstring          "debug string"
    callpropvoid        QName(PackageNamespace(""), "trace"), 1

Security flash

Update abc code

Update abc code with Rabc tool

Basic update:

  1. Step1: Get actionscript code with abcexport:
    d:\tools\Rabc\abcexport PackageOut.swf
  2. Step2: Edit the PackageOut-0.abc and dasm the changes:
    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

Update abc code with flex sdk

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

Actionscript dump

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:

  • pushint 100 → push gia tri can gan vao stack
  • setlocal 1 → pop off gia tri tu stack va gan vao thanh ghi r1
  • getlocal1 → get gia tri cua tham so arg1 cua function va push vao stack
  • getlocal 1 → get gia tri cua thanh ghi r1 va push vao stack
  • Find class name ddt.manager.SocketManager in asasm file by find string ddt.manager:SocketManager

Basic Developing

Compiler Restrictions of Main class

When compiling ActionScript programs with the Flash authoring tool, FlexBuilder,or mxmlc, bear in mind the following compiler restrictions:

  • The program’s main class must be public.
  • In FlexBuilder 2 and mxmlc, the program’s main class must reside in the unnamed package.
  • The program’s main class must extend either Sprite or MovieClip
  • Every ActionScript source file (.as file) in the program must have exactly one externally visible definition. An “externally visible definition” is a class, variable,function, interface, or namespace that is defined as either internal or public within a package statement.
  • An ActionScript source file’s name must match the name of its sole externally visible definition. For example, the following source file would be considered illegal because it con-tains two externally visible classes:
    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 {
    }

Event handling

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
  • Listener function defined as a class method
    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);
        }
    }
  • Or Listener function defined outside of a class
    dispatchEvent(event:Event):Boolean

    ⇒ Dispatches an event into the event flow(The same send message in windows). For example:

    dispatchEvent(new Event(Event.COMPLETE));

Swftools

swfdump

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

  • decompress:
    swfcombine.exe -d OpenTreasure.swf -o OpenTreasure_new.swf
  • compress:
    swfcombine.exe -dz OpenTreasure.swf -o OpenTreasure_new.swf
  • merger:
    swfcombine.exe -o OpenTreasure_new.swf OpenTreasure_old.swf #147=147_edit.swf
  • changefont:
    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
  • update sprite:
    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
  • change sprite
    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
  • Update abc code in main.swf
    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

swfextract

Extract spriteId 147 from swf file

swfextract.exe -i 147 -o 147.swf OpenTreasure_old.swf

Debug variables and GUI with Monster debug

refer: http://www.monsterdebugger.com/

Below are some baisc debug methods:

  • Basic Debug:
    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!");
            }
        }
    }           
  • Debug object class
    import com.demonsters.debugger.MonsterDebugger;
    MonsterDebugger.initialize(this);

    ⇒ Will called before trace, It established connection with MonsterDebug Program

  • Debug variable
    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

Flash Decompiler

notes: Before rebuilt the fla file from decompiler source, you need to change source path and library path to directory which contain actionscript source

Overview about Flash Decompiler tools

Analyze all decompiler tools:

  • ffdec and sothink similar source code structure
  • sothink create fla file best

Old method

Below are steps decompile and fix:

  1. Step1: Decompile fla file using trillix
  2. Step2: Decompile action script using trillix and fix actionscript base on sothink and ffdec source
  3. Step3: We can decompile the swf file to flash or flex application

New method

Below are steps decompile and fix:

  1. Step1: Decompile swf file using sothink to get fla file
  2. Step2: Using ffdec to decompile swf file and get actionscript source
  3. Step3: Config to build only resources in fla file(remove classpath, librarypath, Main Class in current flash project) and build it as swc library
  4. Step4: Config to build only actionscript in FlashDevelop and using GUI swc from step3 as library
  5. Step5: Fix error can't import resources from GUI swf(create actionscripts from actionscript source which use actionscript from GUI swc)
  6. Step6: Fix actionscript error by comparing with actionscript source of sothink first. If not be fixed, you must compare with source of trillix

Using ffdec

Download and Install:

Some basic command lines(To run it, we need run DOS as Administrator):

  • Display helps:
    ffdec.bat --help
  • Decompiler and read swf source:
    java -jar ffdec.jar filename.swf
  • Decompiler only script(actionscript) in swf file to source destination src:
    java -jar ffdec.jar -export script "src" filename.swf
  • Decompiler to get fla file:
    java -jar ffdec.jar -format fla:cs5.5 -export fla "src\filename.fla" filename.swf

Adobe flash

Crack adobe flash cs5

Cài đặt

  1. Bước 1: Các bạn download Adobe Flash Professional CS5 về máy tính.
  2. Bước 2: Giải nén bằng winrar hoặc 7-zip (xem hướng dẫn cách sử dụng winrar & 7-zip để giải nén).
  3. Bước 3: Chạy file Set-up.exe trong thư mục Adobe Flash Professional CS5.5 để cài đặt với chế độ dùng thử (Try).

Crack

Sau khi cài đặt xong, bạn chọn một trong 2 cách Crack bên dưới:

  1. Cách 1: Crack Adobe Flash Professional CS5 sử dụng file amtlib.dll. Bạn quay lại thư mục giải nén ban đầu ở bước 2, mở thư mục Crack, copy file amtlib.dll paste vào thư mục cài đặt Adobe Flash Professional CS5 mặc định là:
    • Windows 32-bit: C:\Programs\Adobe\Adobe Flash Professional CS5\
    • Windows 64-bit: C:\Programs(x86)\Adobe Flash Professional CS5\
    • Lưu ý: Nếu có thông báo hỏi ghi đè, bạn chọn Yes hoặc Replace nha.
    • Sau đó bạn mở Adobe Flash Professional CS5 lên xem Crack thành công chưa ( Không hiện cửa sổ yêu cầu kích hoạt là Crack thành công rồi đó). Nếu chưa thành công thì các bạn tiếp tục chuyển sang cách 2.
  2. Cách 2: Crack Adobe Flash Professional CS5 sử dụng Keygen. Bạn quay lại thư mục giải nén ban đầu ở bước 2, mở thư mục Crack, copy file keygen.exe paste vào thư mục cài đặt Adobe Flash Professional CS5 mặc định là:
    • Windows 32-bit: C:\Programs\Adobe\Adobe Flash Professional CS5\
    • Windows 64-bit: C:\Programs(x86)\Adobe Flash Professional CS5\
    • Sau đó bạn chạy file keygen.exe đó, cửa sổ Keygen hiện lên, các bạn nhấn nút Patch rồi chờ một chút cho nó chạy là xong.

Đâ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.

my/flash-and-actionscript.txt · Last modified: 2022/10/29 16:15 by 127.0.0.1