blog
2009 October ArchiveJozef Chúťka's blog
October 20, 2009
Apparat optimization swc swf TAAS
Apparat (TAAS) framework to optimize swf
Joa Ebert is a Flash developer with a focus on ActionScript 3. He has developed several tools helping to optimize daily workflow. Most projects have been released as open-source. The most important one is Apparat / TAAS project:
Apparat is an open source framework written in Java to optimize ABC, SWC and SWF files. The core of Apparat are its three file formats and their implementation:
ABC (read and write ABC files, bytecode analysis and tools)
SWC (read and write SWC files)
SWF (read and write SWF files, tag implementations)
TAAS is a stackless representation of the ActionScriptBytecode. Read first results of TAAS, and see application before and after optimization.
October 19, 2009
api Facebook facebook api JavaScript solution
FB.Connect.showPermissionDialog
If your facebook iframe applications need extra permissions granted, you can use Facebook JavaScript Api to generate modal window over your content to request permissions from users. For this purpose I created a simple FB_test_perm() function. It takes 4 arguments:
api_key – your application api key
xd_receiver – path to xd_receiver.htm file (Cross-Domain Receiver Page)
permission – publish_stream, read_stream …
callback – your function with boolean return (true if permission granted, false if not granted)
October 19, 2009
ActionScript browser Canvas Flex FlexIFrame html IFrame JavaScript web
Flex IFrame – Web browser in flash (update)

You can not have a web browser inside your web flash applications right? Well, you can! This solution uses html iframe to generate fake build in browser. So the behaviour of the browser in flash is the same as the one you are previewing this flash in (it is the same one). The best part of it is, you can manipulate with the position and size of this browser directly from flash. sk.yoz.html.IFrame solution was inspired by Alistair Rutherford, www.netthreads.co.uk.
FlexIFrame.js
Application
Application html
October 17, 2009
break continue nesting optimization script
Code optimization
First, my golden rule: method with more than 12 rows is too long. Methods should be short, simple, clean and reusable. In most cases your methods fits into 5-12 rows. If not, you should consider rewriting your methods.
Look at the next code. There is too much nested tests. Soon you get lost with more and more nested levels:
function gimmeResult(a, b, c)
{
var result;
if(a)
{
if(b || c)
{
if(b && c < 0)
{
result = 1;
}
else
{
result = 2;
// where am I?
}
}
else
{
result = 3;
}
}
else
{
result = 4;
}
return result;
}Try to linearize code, it is much more cleaner for reading when no multiple nesting used:
function gimmeResult(a, b, c)
{
if(!a)
return 4;
if(!b && !c)
return 3;
if(b && c < 0)
return 1;
return 2;
}October 15, 2009
Bitmap BitmapData ByteArray converting DisplayObject encoding image Loader LoaderInfo url URLRequest
Bitmap, BitmapData, ByteArray…
Lets see how to convert between Bitmap, BitmapData and ByteArray in few examples:
DisplayObject to BitmapData
BitmapData to Bitmap
BitmapData to ByteArray
URL (image) to ByteArray (asynchronous)
URL (image) to BitmapData (asynchronous)
ByteArray to BitmapData (asynchronous)
October 14, 2009
asset Bitmap Class embed Flash Flex library SpriteAsset symbol
Embedding assets wisely
You can embed various types of assets in your Adobe Flex applications (.jpeg, .png, .swf, .mp3, .svg, .ttf …). Embedded assets are compiled into the SWF file of your Flex application. They are not loaded at run time and you do not have to deploy the original asset files with your application. Read more about embedding assets on Adobe.
Basics first. How to make your symbol from Flash library visible for Flex (see images on the bottom of the artice):
1. Create your symbol and linkage (library (Ctrl+L) / {your symbol} / Linkage…).
2. Linkage Properties, set your class name that will be used in [Embed] meta.
3. Export .swf file and make Assets.as.
October 13, 2009
3d ActionScript editor engine model physics scene
Flash 3D Engine List

If you are looking for 3D flash engine you have multiple open source choices. The best one offers modeling editors, so creating your scenes is click easy, or other animation / physics frameworks, pixel bender shaders etc. List of most popular 3d engines:
October 13, 2009
ActionScript ByteArray serialization String
Serialization
This classes let you serialize your ActionScript 3 Objects to ByteArray or String:
October 12, 2009
browser crash Flash Media Server serialize SharedObject solution
SharedObject goes RangeError: Error #2006
If you keep getting RangeError: Error #2006: The supplied index is out of bounds. with SharedObject, you probably not gonna fix it. In my case this happend when I tried to write non primitive values too frequently into persistant SharedObject’s properties. After reconnect, before any event from your SharedObject dispatched, you get exception that will cause browser crash.
I was not able to solve it by excluding saving advanced objects, nor by using just simple Objects, AMF0 or AMF3, nor by any other method I imagined. To solve the problem I decided to write only serialized objects (strings) and deserialize again on client after synchronization.
October 12, 2009
ActionScript browse classes download swc
ActionScript 3 Classes
You can always download classes used in posts here http://classes.yoz.sk/!
« Older Entries