blog

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

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 »

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

2 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 »