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
http://flash.j-ogg.de/test_app.swf
http://www.j-ogg.de/core/main?/index.html
http://www.flumotion.net/cortado/
http://jflac.sourceforge.net/
http://www.jcraft.com/jorbis/
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:
Embedding fonts tutorial on Adobe Developer Connection
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_stArial 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 JavaScript evaluationExternalInterface 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
[Transient] metadataApplied 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 addedattributeChanged: Occur when an attribute was changedattributeRemoved: Occur when an attribute was removednodeAdded: Occur when a node was addednodeChanged: Occur when a node was changednodeRemoved: Occur when a node was removednameSet: Occur when the node name changednamespaceAdded: Occur when a namespace was added to the nodenamespaceRemoved: Occur when a namespace was removednamespaceSet: Occur when the node's namespace changedtextSet: 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
Openness
No standards
Proprietary
Not on mobile/iphoneBinary format
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
Use H264 rather than VP6 or Sorenson Spark Codecs
Load handling, cache data (QueueLoader, BulkLoader)
Check unsed data (for SWF embeded classes:
mxmlc -link-report=link-report.xml)
CPU hog
Use low quality filters
Use mipmap
Use bitmap rather than vector
Optimize code (Joa Ebert's wiki, haXe)
Can't bookmark pages / back history
Use deep linking (SWFAddress)
Video and sound
FlashPlayer – h264 - pseudo streaming with MP4 file
Display
Draw a DisplayObject into a BitmapData
DisplayObject into a BitmapDataPixelize a DisplayObject
DisplayObjectDraw it into a BitmapData (see above) with scale
Then, set bitmap width & height to original sizes (bounds.width & bounds.height)
NetStream BitmapData capture
BitmapData captureOutlined Text
Network & File IO
Upload file with URLLoader
URLLoaderhttps://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()
addFrameScript()Note: here frame is zero base index.
Code tips & tricks
Convert Array to Vector.<T>
Array to Vector.<T>Conditional switch statement
Compare real types of objects
With (final contructor) != is keyword
Extends Array
ArrayAnd 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 limitsLocalConnection.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
Event.OPENProgressEvent.PROGRESS * nEvent.INIT(if SWF, first frame loaded)ProgressEvent.PROGRESS * nHTTPStatusEvent.HTTP_STATUSEvent.COMPLETE
AS Native & Product
https://www.macromedia.com/bin/flashdownload.cgi?product=fpupdatept&signed=true&A=t&SA=t&SV=t&EV=t&MP3=t&AE=t&VE=t&ACC=f&PR=t&SP=t&SB=f&DEB=t&V=WIN%209%2C0%2C115%2C0&M=Adobe%20Windows&R=1920x1200&DP=72&COL=color&AR=1.0&OS=Windows%20XP&L=fr&IME=f&PT=External&AVD=f&LFD=f&WD=f&TLS=t&what=descr…
fpupdateaxdigitaleditions2x0airappinstallerfpupdatepl
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
LocalConnectionbetween 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
GreenThreadSenocular'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
MyClass1Create an instance of
MyClass1and use it as root class
Frame 2
Include
MyClass2
Frame 3
Include
MyClass3
You must to compile
MyClass3as main classMyClass1must 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()orgotoAndStop())MyClass2andMyClass3could not extends DisplayObject and are not executedIf 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):
Loading
Libraries (classes …)
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
Use
flash.display.DisplayObject.accessibilityPropertiesandflash.accessibility.*Text equivalents - Accessible movie elements
Last updated
Was this helpful?