blog

Jozef Chúťka's blog

October 13, 2010

No comments

AIR Android Facebook FacebookOAuthGraph StageWebView

Authorizing Facebook Applications in Android

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 »

October 11, 2010

No comments

AIR Sprite

Quick Tip: AIR Application Without Flex Framework

This may be pretty known thing, but I would like to share it. When creating a new AIR project in flash builder (File / New / Flex Project / … Desktop – AIR), and you do not require flex framework, just rename the “Main application file” to whatever.as (instead of whatever.mxml) in the last step of creation wizard (screenshot attached). Or, if your project already exists with main app.mxml file, just create new file with the same name app.as and remove the old one (app.mxml). Make sure your main application class extends Sprite.

October 11, 2010

No comments

3d 3ddm drawTriangles

Superfast 3D Scene Without 3D Engine

Based on my previous post about z-sorting indices, I have created a superfast 3DDM version using drawTriangles(). The following example renders 100×100 segments = 10201 vertices = 20000 triangles (faces) per frame. Just to imagine how much that is, see the main image fullsize. There is no 3D engine used at all, everything is handled by native flash classes and functions. Z-sorting is not calculated on every frame (however it could be, because the sort algorythm is pretty fast), but it is pre-cached for some rotation. Feel free to run the example in new window in order to see the real speed (there is more flash content around here on my blog template). I can go up to 12 fps with the best flash quality for the first image in demo, how much can you?

Read the rest of this entry »

October 8, 2010

3 Comments

3d 3ddm drawTriangles Matrix3D PerspectiveProjection Triangles Utils3D Vector3D

Z-sorting Indices For drawTriangles()

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 »

September 24, 2010

No comments

AIR AppUp certificate Marketplace Melrose

Adobe Melrose – The Place To Sell Your Apps

This post is about Adobe Melrose – the new Lab project from Adobe, and my first contact with it. I hope to be able to continuously update this article so you can get perfect view of what is going on when you decide to use Melrose. Lets begin with public static const MELROSE:

Melrose (codename) enables developers and publishers to distribute and make money with Adobe® AIR® applications through application stores. Melrose provides a repository that distributes applications to multiple application stores so that publishers can reach millions of users. Intel AppUp Center and the Adobe AIR Marketplace are the first two storefronts available in Melrose. Melrose also provides analytics that let publishers measure success of their applications.

Read the rest of this entry »

September 22, 2010

1 Comment

AIR licensing Merlose MY_UNIQUE_32_HEX_NUM

Quick Tip: What is MY_UNIQUE_32_HEX_NUM?

When working with Adobe Merlose licensing code I hit MY_UNIQUE_32_HEX_NUM variable containing some generated string (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX). As there was nothing within my emails from melrose that would correspond to that string, investigation got started. Soon after I found Merlose FAQ saying that MY_UNIQUE_32_HEX_NUM is a GUID that you choose and is immutable for the lifetime of the application, followed by Q&A combo:

Q: Do I need to randomly generate the application UID that is passed to the* checkLicense() *call or will Adobe give one to me? A: You need to generate the UID. We recommend you use a GUID generator tool like: http://www.guidgenerator.com/online-guid-generator.aspx. Generate your own unique number and plug it into your code…

Mistery solved!

September 21, 2010

16 Comments

AIR Facebook HTMLLoader JavaScript NativeWindow NativeWindowInitOptions

Authorizing Facebook Applications in AIR

I was asked to make AIR compatibile version of FacebookOAuthGraph class. It was a nice little challenge for me, where I learn some new things about AIR. E.g. how easy it is to define the JavaScript callback directly from ActionScipt (HTMLLoader.window.methodName)… There are more ways to make authorization process work for you, I have chosen the one with popup window. In order to make FacebookOAuthGraph work for AIR, the short extending is required, instead of creating popup window from JavaScript, popup is created by HTMLLoader.createRootWindow (no ExternalInterface required)…

Read the rest of this entry »

September 20, 2010

2 Comments

Dict dictionary replace

Quick Tip: Simpliest dictionary

Here is a short extract from a very simple dictionary engine I use on few of my latest projects. Even though it is based on single static method replace() , I always search and copy-paste the file from project to project, so I decided to publish it, maybe it can help someone else too …

package
{
    public class Dict
    {
        public static const LINK_IN_CLIPBOARD:String =
            "%1\nLink has been copied into the clipboard."

        public static const UPDATE_FLASH_PLAYER:String =
            "Please update your flashplayer.";

        public static const HELLO:String = "%1 %2";

        public static function replace(text:String, ... rest):String
        {
            var i:uint = 1;
            for each(var repl:String in rest)
                text = text.replace("%" + i++, repl);
            return text;
        }
    }
}

Usage:

trace(Dict.UPDATE_FLASH_PLAYER);
trace(Dict.replace(Dict.LINK_IN_CLIPBOARD, "http://somelink"));
trace(Dict.replace(Dict.HELLO, "Hello", "World"));

Have a nice one.

September 16, 2010

No comments

crossdomain.xml loadPolicyFile policy Security site-control

Security.loadPolicyFile() Ignored … Not at all! (update)

I was about to publish an article about a bug in flash player, that loadPolicyFile() method fails when loading crossdomain policy files from a custom location (not domain root), but I soon realized that it is not a bug, but a feature .

It seems like flash player (WIN 10,1,50,426, debug) ignores crossdomain files loaded from a custom location. The documentation defines Security.loadPolicyFile() as a method to be used to download “cross-domain policy file from a location specified by the url parameter”, it does not work at all. Even the custom crossdomain.xml is requested (debuged with proxy software), the flash application somehow ignores it and tries to load crossdomain.xml file from a domain root. And if there is none on the domain root (why would it be, when you need to load custom one) all your loads results in security error.

After some investigation, I found out, that it is required to have a domain root crossdomain file that allows handling with cross-domain files located besides domain root via site-control element. Long story short, cross-domain security is an alchemy and one should read the whole specification. Long story even shorter, if you have no access to domain root (and there is no required crossdomain file with allow-access-from or site-control), you are doomed (flash application will not let you handle file contents from the location) … please read the update part (not doomed at all)! Lets have a quick look at scenario with the site-control on domain root and allow-access-from on custom location:

Read the rest of this entry »

September 14, 2010

No comments

3d 3ddm anaglyphs displacement fade pixel bender

3D Displacement Maps

Good news everyone, since 3D displacement maps gained big success, I was asked to make a standalone application, so anyone could use it within their webpages. After few hours of hard work, the 3 applications are finally out and you can see and download it from 3ddm.yoz.sk. Feel free to use it on your own webpages. If you do so, please notice the copyright, and/or consider a small donation via PayPal (donation button in footer). If you are willing to see the source code of these application, you can download it from here: App3DDMSimple.as, App3DDMFade.as, App3DDMAnaglyph.as, App3DDMSimplePV.as, App3DDMFadePV.as, App3DDMSimpleAW.as, App3DDMSimpleTriangles.as, additional classes, .pbk and .pbj files can be downloaded from classes.yoz.sk. Any feedback welcome

Read the rest of this entry »

« Older Entries