After switching my AIR application into new AIR 2.5 SDK, boom! Every single URLRequest threw an IOErrorEvent. No other exception thrown. So I started digging in in order to find the cause and it appeared to be Security.loadPolicyFile() execution (I am reusing some libs containing these lines) that blocked it all quietly. First I tried to do try-catch block over it, but with no success. Than I just removed the lines for AIR project and voilà, everything back to normal again. URLRequests works again. It seems like AIR does not need loadPolicyFile() for URLRequests at all. Interesting that these loadPolicyFile() were targeting total different domain and were able to break any other requests.
Have you ever worked with BitmapData.getPixels() method? This method generates a byte array from a rectangular region of pixel data. Writes an unsigned integer (a 32-bit unmultiplied pixel value) for each pixel into the byte array. Thats sounds good, but what is it good for to have a ByteArray full of integers? There is not even a decoder for this format on my backend?!… Well, this format is so cool, and easy to access that you do are able to write your own decoder e.g. in PHP.
The resulting bytes are 32-bit unsigned integers for each pixel represented by AARRGGBB format, followed by another pixels and so on e.g.:
AA RR GG BB:
-- -- -- --
FF FF 00 00
00 00 FF 00
Read the rest of this entry »
When working with AIR on Android, I felt into an issue with stage.mouseX (stage.mouseY) returning value 107374182. It seems I am not the only one who experience that, but also Michael Ritchie and Lex Talkington did. This happens after you release touch screen. You may expect that Event.MOUSE_LEAVE would be fired in the right moment, but that sometimes just does not (sometime it does). I did not found any better solution than testing returned values against the static number, so I came up with this piece of code:
if(stage && (int(Math.abs(stage.mouseX)) == 107374182
|| int(Math.abs(stage.mouseY)) == 107374182))
return;

It is now a few weeks after I started experimenting with AIR for Android. While watching all the great tutorials about how to make things work (AIR for Android – Part 1, Part 2) and how to debug application running on device (Debug AIR apps on Android with Flash Builder 4, another in french and Flash), I have decided to attach some of my own findings and practices to build, deploy and debug apps.
To start, it is a good practice to setup your environment variable path to Android sdk and AIR sdk:
PATH: ...;C:/Users/Yoz/Work/Android/SDK/2.2;C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.1.0.16076-AIR2.5\bin
Next, the whole certificate thing does not make sense to me because you can/have to create one by yourself. The cert need to be valid for 25 years else Android Market will not accept your application (bye bye real signed certificate from PGP TrustCenter
)
Read the rest of this entry »

Hold on, this is going to be fast and smooth! I am playing with an Android Emluator for a few days now. One of the challenges was to mount FacebookOAuthGraph lib into Android. It turned out to be 1 hour task. Thanks to Flash-Core article and sHTiF and StageWebView. Long live AIR for Android!
Follow the article for codes:
Read the rest of this entry »

While constantly improving 3DDM (drawTriangles() version soon to be released), I was looking for the fastest possible solution to render simple 3D object. It soon appeared to be drawTriangles() – the native ActionScript 3 method, that let you make illusion of 3D object based on deforming your texture. In fact native ActionScript contains a lot of useful and fast classes to work with 3D like: Utils3D, Vector3D, Matrix3D, PerspectiveProjection… so you do not need to create your own basic 3D engine tools. One thing that it does not contain is z-sorting. Z-sorting is very tricky job, that is why modern 3D engines let you decide which sorting method to use with your scenes (faster vs. precise). For my needs it is enough to use simpliest z-sort possible, based on projected max z coordinate of face (3 vertices).
Before continue reading, make sure you understand the basics of Using triangles for 3D effects, Transforming bitmaps, UV mapping and Culling. Everything is very good described by Adobe.
Read the rest of this entry »