blog

Tag Archive for URLRequest at Jozef Chúťka's blog

October 28, 2010

1 Comment

AIR loadPolicyFile Security URLRequest

Quick Tip: AIR 2.5 & Security.loadPolicyFile()

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.

June 2, 2010

2 Comments

buffer delay Loader priority timeout URLLoader URLRequest URLRequestBuffer

URLRequestBuffer – Buffer Your URLRequests

A belt of cartridges feeding into a machine gun.

Let’s suppose your app makes a lot of http requests at once, and you need a good administration for that. Based on used browser your app is running on, you are only allowed to limited request count – mostly its 2 requests per domain, the remaining ones are sitting in browser buffer waiting to finish those actual. URLRequestBuffer is handy class that lets you manage URLRequest-s. E.g. you are creating image gallery and request hundreds of images in gallery at a time, now when user navigates throug the images you need to make some request more prioritized before others, some to be canceled, some may timeout etc. Here comes URLRequestBuffer in scene.

Read the rest of this entry »

April 12, 2010

4 Comments

Child communication content Loader Parent URLRequest

How to communicate between loader and child

A diagram of event dispatch between Parent.swf and Child.swf through loader.content.

This post is about communication between loader (Parent.as) flash object (.swf) and loaded (Child.as) flash object. While flash is event based, I find it correct to use events to communicate, although different methods exist (direct function call etc.)

Read the rest of this entry »

February 4, 2010

No comments

shorten URLLoader URLLoaderDynamic URLRequest URLShorten URLShortenEvent URLVariables

URLShorten Class (update)

URL shortening is a technique where a provider makes a web page available under a very short URL in addition to the original address. There are hundreds of provider out there, but only a few of them provides public api and crossdomain.xml. I put toghether some of those that work and URLShorten class was created 🙂 feel free to use it and enjoy

Update: jdem.cz, tinyurl.com, bit.ly, tr.im, is.gd providers implemented.

Read the rest of this entry »

January 21, 2010

9 Comments

Authorization DesktopSession Facebook facebook api swc URLRequest

Facebook Extended Permissions With Authorization by Overriding Class in swc

Facebook dialog previewing application posts with Allow Publishing and Don't Allow buttons.

It may be not popular, but it is possible to substitute / override whole class from .swc file. Lets say you are using some public api, in our case Facebook actionscript api. I admire work of developer team, but I would like to have some things different. My facebook application requires publish_stream extended permission right after user login (authorize) my application. Even if official facebook api documentation says it is possible to ask for extended permission with login.php call (req_perms parameter), our facebook actionscript api does not offer setting this parameter.

Read the rest of this entry »

October 26, 2009

No comments

ApplicationDomain Class Error IFlexDisplayObject Loader LoaderContext URLRequest

Flex Error #1034: Type Coercion Failed: Cannot Convert *** to mx.core.IFlexDisplayObject

When you keep getting:

Flex Error #1034: Type Coercion Failed: Cannot Convert *** to mx.core.IFlexDisplayObject

… after using getDefinition() method, in my case:

// url = "../some.swf"
var request:URLRequest = new URLRequest(url);
var context:LoaderContext = new LoaderContext();
context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, assetsComplete);
loader.load(request, context);
...
// assetsComplete()
var applicationDomain:ApplicationDomain = assetsLoader.contentLoaderInfo.applicationDomain;
var assetsClass:Class = applicationDomain.getDefinition("Assets") as Class;
...

The problem is, in fact, the security not coercion! Try move your .swf (the one that is beeing loaded) into the same directory where master .swf file is located.

October 15, 2009

4 Comments

Bitmap BitmapData ByteArray converting DisplayObject encoding image Loader LoaderInfo url URLRequest

Bitmap, BitmapData, ByteArray…

bitmap_converting

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)

Read the rest of this entry »