Flash

Resources

  • http://mycroft.mozdev.org/download.html?name=Actionscript+3

  • http://www.brajeshwar.com/reference/as2/

  • http://wiki.mediabox.fr/documentation/flash

Play generated pcm wave data

  • http://www.flashbrighton.org/wordpress/?p=9

Ogg support

AS3 PNG

  • http://www.5etdemi.com/blog/archives/2006/12/as3-png-encoder-faster-better/

  • http://blog.je2050.de/imageprocessing-library/

Adobe(R) Flash(R) Video format (FLV) to MPEG4 Transcoder.

  • http://sourceforge.net/projects/vixynet/

Rend engine for XHTML, SVG, XForms, XFrames, arbitrary XML (e.g. RSS), styled by CSS 3

  • http://deng.com.br/

  • http://www.flash-creations.com/notes/sample_svgtoflash.php

  • http://blog.tiagocardoso.eu/mainada/comics-sketch/2008/07/04/svg-viewer-demo/

ColorMatrix

  • http://www.adobe.com/devnet/flash/articles/matrix_transformations_print.html

  • http://www.brajeshwar.com/reference/as2/

  • http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html

  • http://blog.pixelbreaker.com/flash/as30-jit-vs-interpreted/

AS architercural UML

  • http://www.gskinner.com/gmodeler/app/run.html

Decompile & Protect

  • http://articles.techrepublic.com.com/5100-22-5111586.html

Make screensaver

  • http://www.instantstorm.com/features/

AVE Imperator

  • http://www.ave-imperator.com/index.php

Bitmap

  • http://blog.je2050.de/2007/09/03/optimized-seam-carving/

  • http://blog.je2050.de/2007/08/28/analyzing-bitmaps-bigger-than-512x512/

  • http://blog.je2050.de/2007/10/01/converting-a-number-to-4-bytes-and-vice-versa/

Gaia framework

  • http://www.gaiaflashframework.com/

  • http://rsizr.com/

Tween curves

  • http://www.robertpenner.com/easing/easing_demo.html

  • http://labs.zeh.com.br/blog/?p=120

Realtime image post-processing with flash

  • http://www.lifeztream.com/blog/?p=99&language=en

Flash FPS Monitor AS2,AS3

  • http://www.lifeztream.com/blog/?p=97&language=en

Disable Right clicking (JS)

  • http://www.kirupa.com/forum/showthread.php?t=270568

Flash AS3 VM bytecode compiler

  • http://code.google.com/p/as3c/

Windows 2003 serve Flv files

  • http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_19439&sliceId=2

???

  • http://www.blog.lessrain.com/?p=552

  • http://labs.zeh.com.br/blog/?p=95

  • http://www.rockonflash.com/blog/?page_id=32

  • http://www.rockonflash.com/blog/?p=29

  • http://theflashblog.com/?p=197

  • http://www.insearchofabrilliantwhitecloud.com/Papervision3D.htm

  • http://labs.blitzagency.com/?p=118

AS 3.0 Language and Components Reference

  • http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/

  • http://help.adobe.com/en_US/AS3LCR/Flash_10.0/index.html

Raycasting

  • http://www.bytearray.org/?p=67

Flash CS3 Fonts

  • http://prinzipiell.com/2007/05/03/embed-fonts-with-as3/

  • http://www.actionscriptclasses.com/

Math classes (AS2)

  • http://members.shaw.ca/flashprogramming/wisASLibrary/wis/index.html

C++ to AS3

  • http://blogs.adobe.com/kiwi/2006/05/as3_language_101_for_cc_coders.html

Download Player & Cie

  • http://www.adobe.com/support/flashplayer/downloads.html

Old player versions

  • http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266&sliceId=1

Download Flex SDK

  • http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3

Speed up ExternalInterface in IE

  • http://codinginparadise.org/weblog/2006/02/how-to-speed-up-flash-8s.html

TweenLite, TweenMax

  • http://blog.greensock.com/category/tweening/

Bugs

  • https://bugs.adobe.com/jira/browse/FP

  • https://bugs.adobe.com/flashplayer/

Fonts

Embed font with AS3:

Bitmap fonts

Flash renames bitmap fonts and adds the suffix: __{size}_pt_st, where _{size}_ is the bitamp size of the font.

Exemple:

  • Verdana in 12 pixels becomes Verdana_12pt_st

  • Arial in 12 pixels becomes Arial_12pt_st

Effects on no-embedded fonts (alpha, rotation, etc.)

In FlashPlayer 9, to apply alpha, use filters, cacheAsBitmap or blend mode "layer"

For other effect (rotation, scale, etc.) draw TextField in a BitmapData

In FlashPlayer 10, no more problems with alpha, but remain for transfrom effects like rotation, scale, etc.

In FlashPlayer 10 flash.text.engine natively support it

Flash player

Adoption / market penetration

6 to 9 month for all new version to reach ~90% of adoption

Flash right click (disable ContextMenu)

ExternalInterface JavaScript evaluation

ExternalInterface evaluate given JavaScript string (anonymous functions): ExternalInterface.call("(function(param1, param2) {/* javascript code here */})", parameter1, parameter2);

Note: don’t use the dash character "-" or other special chars in the DOM id of your flash element. IE need id attribute for using ExtenralInterface, others need name attribute.

IE native JavaScript function for hanlding Flash & JS exchanges

Extending Flash

Execute command line through JSFL

Metadata

Add document metadata in Flash:

[Transient] metadata

Applied in all places using AMF encoding (RemoteObject, NetConnection, byteArray.readObject();)

See flash.net.registerClassAlias()

Use AS3 metadata

-keep-as3-metadata+=Meta1,Meta2

Conditional compilation

  • C Preprocessor Fun - kirupaForum

    -define=namespace::variable_name,value

    CONDITIONAL_COMPILATION::value { //Do something only when compilation condition is verified }

    if(some condition) { //Do something } else { CONDITIONAL_COMPILATION::value { //Something only when compilation condition is verified } }

    CONDITIONAL_COMPILATION::value = 'true'

Inline

Conditional compilation is string replacement

Libraries

XML

Intercept E4X XML events

Types:

  • attributeAdded: Occur when an attribute was added

  • attributeChanged: Occur when an attribute was changed

  • attributeRemoved: Occur when an attribute was removed

  • nodeAdded: Occur when a node was added

  • nodeChanged: Occur when a node was changed

  • nodeRemoved: Occur when a node was removed

  • nameSet: Occur when the node name changed

  • namespaceAdded: Occur when a namespace was added to the node

  • namespaceRemoved: Occur when a namespace was removed

  • namespaceSet: Occur when the node's namespace changed

  • textSet: Occur when a text node was added to the node

E4X

Exemple:

Get in items all XML nodes node:

The same but with address:

Get all nodes with age greater than 30:

The same but with only one cycle

Application domain

Child SWF uses parent domain definitions. If defined there, otherwise its own.

child SWF adds its unique definitions to parent SWF; both SWFs share the same domain child SWFs definitions do not overwrite parents

child SWF domain is completely separate and each SWF uses its own definitions

set loader context in load()

ASDocs

Bugs : Talk:ASDoc:Creating ASDoc Comments - Adobe Labs

Don't use <code></code> in your @see text description.

The comment: /** @see "oops can't document this." */ will also cause the same exception

A better Flash

Solvable, common sense

  • Make HTML alternative

Introductions

  • Remove it

  • Shorten it

  • Give the ability to skip it

Search engine visibility

  • Google and Yahoo have SWF reading ability

  • Make a HTML alternative (better solution)

Accessibility

See Accessibility

Takes long to load

CPU hog

Can't bookmark pages / back history

Video and sound

Display

Draw a DisplayObject into a BitmapData

Pixelize a DisplayObject

Draw it into a BitmapData (see above) with scale

Then, set bitmap width & height to original sizes (bounds.width & bounds.height)

NetStream BitmapData capture

Outlined Text

Network & File IO

Upload file with URLLoader

  • https://discuss.as3lang.org/t/send-a-file-to-a-server-as-an-attachment-in-an-urlrequest-urlloader/320

Common errors

Return nodes are not same object

addFrameScript()

Note: here frame is zero base index.

Code tips & tricks

Convert Array to Vector.<T>

Conditional switch statement

Compare real types of objects

With (final contructor) != is keyword

Extends Array

And support Array's arguments

Is SubClass extends SuperClass

Disallow instantiation

Desactivate constructor super call

Estimate sound duration while loading

Forcing Garbage collecting

LocalConnection limits

LocalConnection.send() limited to 40960 bytes. For one ByteArray is limited to 40864 (+ AMF data for one ByteArray: 96 bytes ?)

Throw error

Package are namespace

Loading events order

  1. Event.OPEN

  2. ProgressEvent.PROGRESS * n

  3. Event.INIT (if SWF, first frame loaded)

  4. ProgressEvent.PROGRESS * n

  5. HTTPStatusEvent.HTTP_STATUS

  6. Event.COMPLETE

AS Native & Product

https://www.macromedia.com/bin/flashdownload.cgi?product=fpupdatept&amp;signed=true&amp;A=t&amp;SA=t&amp;SV=t&amp;EV=t&amp;MP3=t&amp;AE=t&amp;VE=t&amp;ACC=f&amp;PR=t&amp;SP=t&amp;SB=f&amp;DEB=t&amp;V=WIN%209%2C0%2C115%2C0&amp;M=Adobe%20Windows&amp;R=1920x1200&amp;DP=72&amp;COL=color&amp;AR=1.0&amp;OS=Windows%20XP&amp;L=fr&amp;IME=f&amp;PT=External&amp;AVD=f&amp;LFD=f&amp;WD=f&amp;TLS=t&amp;what=descr…

  • fpupdateax

  • digitaleditions2x0

  • airappinstaller

  • fpupdatepl

Access to all members (inc. private) of a specified object (debug player only)

Get class from Loaded SWF

Clone object

Not work on DisplayObjects

  • http://niko.informatif.org/blog/2007_07_20_clone_an_object_in_as3

Allow socket

Deliver policy file with command line PHP

  • http://www.functionblog.com/?p=67=1

Threading

Therading is impossible in Flash. But:

  • [Idea] Using LocalConnection between mutliple Flash embedded in same page ? (depend browser, but maybe all instance are in same os thread)

  • Using asynchronous ShaderJobs (fp10)

  • Use pseudo threading with small chunk of function

Implementation of pseudo threading:

  • General relativity's GreenThread

  • Senocular's tutorial

    package { import flash.display.DisplayObjectContainer; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.utils.getTimer; import flash.display.Sprite;

    }

  • http://blogs.adobe.com/aharui/2008/01/threads_in_actionscript_3.html

Progressive SWF loading ("use later" code/assets or embedded preloader)

Compile a SWF following:

  • Frame 1

    • Include MyClass1

    • Create an instance of MyClass1 and use it as root class

  • Frame 2

    • Include MyClass2

  • Frame 3

    • Include MyClass3

  • You must to compile MyClass3 as main class

  • MyClass1 must extends MovieClip (you can also extends Sprite, but some things will not work)

  • You can check loading progression with loaderInfo's progress event

  • You can check also frame loading (framesLoaded/totalFrames)

  • To ask FlashPlayer to parse a frame (when is loaded), you must to play it (with nextFrame() or gotoAndStop())

  • MyClass2 and MyClass3 could not extends DisplayObject and are not executed

  • If you want to use SWF metadata tag, you must use it in main class (which use to compile application), here MyClass3

If you want to add an extra class in a specific frame use [Frame(extraClass="MyAsset")]

Example (frames):

  1. Loading

  2. Libraries (classes …)

  3. Main

    package { import flash.display.Sprite;

    }

    package {

    }

  • http://www.dreaminginflash.com/2007/11/13/actionscript-3-preloader/

  • http://www.bit-101.com/blog/?p=946

Use MXML without Flex framework

Using [Bindable] & {}:

  • https://stackoverflow.com/questions/320499/how-does-binding-in-actionscript-work

  • https://stackoverflow.com/questions/1561410/flex-binding-to-an-mxml-esque-binding-string-in-action-script

  • http://code.google.com/p/flit/


Array implementation (http://wiki.ecmascript.org/doku.php?id=discussion:builtin_classes) can be found in Tamarin

Internals

Sound use URLStream? (error #2029)

public::trace

ApplicationDomain.currentDomain.getDefinition("trace") as Function

  • http://hg.mozilla.org/tamarin-central/file/e774dfe22b39/extensions/Trace.as

right now I can use it by default

or use my own traceListener function

Equality

Notice that NaN is actually a Number and an Object, that 0 == "" == false and that false is actually an Object

Accessibility

Last updated

Was this helpful?