Archive | August 2008

Problems in smoothing photo with BitmapData

If we are programming for the client with flash player older than 8,it would be easy to control the quality of the picture assets like this:

_quality = "HIGH";

However,this applies to the global quality and sometimes slows down your animation rendering.

Then in higher version of flash player(8+),we have the other way to ajust the picture performance like this:
In the listener’s onLoadInit event callback:

function __onLoadInit(target:MovieClip):Void
{
	var bd:BitmapData = new flash.display.BitmapData(target._width, target._height);
	bd.draw(target);
	target.attachBitmap(bd, 1, "auto", true);
}

Then the picture Object will be replaced with a BitmapData Object.

Never think it’s better than before,actually worse than ever.
Due to the security policy updated by adobe,there’s no way to draw BitmapData crossdaminly (your picture and your SWF file are in the different domain) and it is impossible to hack this restrict with the flash player version less than 7 or 8.

So you have to persuade your customers update their flash player.Then with the client side flash player version higher than 9,you can avoid this by loading(loadPolicyFile) a new crossdomain XML file as a white list,in which specifies all of the safe domains.This step should be placed before your pictures drawing,and of course you have to add lots of codes in order to confirm the crossdomain file being loaded entirely.

The worse thing happens in large scale Photo display applications.Image that there are 50 photos which are distributed in 50 different servers with 50 different domains,then what?50 crossdomain.xml files have to be placed on each server and the swf file has to load them before the picture being loaded.
Hope this could be solved in the next days.

Advertisements