wtf bitmapData

SWF 13+ (Flash Player 11, AIR 3) the practical limit is the amount of memory available. (The theoretical limit to width or height is the largest positive integer — divided by 20 to allow for twips, but you will hit memory limits long before reaching this size.)
SWF 10 (Flash Player 10, AIR 1.5) the maximum size for a BitmapData object is 8,191 pixels in width or height, and the total number of pixels cannot exceed 16,777,215 pixels. (So, if a BitmapData object is 8,191 pixels wide, it can only be 2,048 pixels high.)
SWF 9 (Flash Player 9, AIR 1.1) the limitation is 2,880 pixels in height and 2,880 pixels in width. If you specify a width or height value that is greater than 2880, a new instance is not created.

Flash Player 11 is very good 🙂
Flash Player 10 need alchemy 🙁
Flash Player 9 no byteArray, so no need think of playing dynamic image processing :((

WTF Flex 4.5.1 eat shit SDK for UIComponent

TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::LabelButton/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::ScrollBar/draw()
at fl.core::UIComponent/callLaterDispatcher()

I know u meet this error

i know you read this:

or this

but still cant play the UIScrollbar
What i think is, i the past, i use this method still can use, i think it is the issue of flex sdk, okok,

i got it

// trick to bring in the skins for the button
sb.setStyle( “ScrollArrowDown_downSkin”, new ScrollArrowDown_downSkin());
sb.setStyle( “ScrollArrowDown_overSkin”, new ScrollArrowDown_overSkin());
sb.setStyle( “ScrollArrowDown_upSkin”, new ScrollArrowDown_upSkin());
sb.setStyle( “ScrollArrowUp_disabledSkin”, new ScrollArrowUp_disabledSkin());
sb.setStyle( “ScrollArrowUp_downSkin”, new ScrollArrowUp_downSkin());
sb.setStyle( “ScrollArrowUp_overSkin”, new ScrollArrowUp_overSkin());
sb.setStyle( “ScrollArrowUp_upSkin”, new ScrollArrowUp_upSkin());
sb.setStyle( “ScrollBar”, new ScrollBar());
sb.setStyle( “ScrollTrack_skin”, new ScrollTrack_skin());
sb.setStyle( “ScrollThumb_downSkin”, new ScrollThumb_downSkin());
sb.setStyle( “ScrollThumb_overSkin”, new ScrollThumb_overSkin());
sb.setStyle( “ScrollThumb_upSkin”, new ScrollThumb_upSkin());
sb.enabled = true;
sb.visible = true;

add this, where sb is the scrollbar object 🙂

by pass as3 8191px problem

Core Concept : Dun draw in bitmap

in urUploader, Thumbnail can over 8191px, loadBytes is according to file size, so if file size too large, yr machine will hang.

[as3]private function genThumbnail():void {
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(Event.COMPLETE, onThumbnailComplete);

private function onThumbnailComplete(e:Event):void {
var b:Bitmap = MCUtil.scaledImage(Bitmap(, new ThumbnailLayout().width);

var data:Object = { uploadJob : this };
dispatchEvent(new UploadJobEvent(UploadJobEvent.THUMBNAIL_GENERATED, data));

This is the scale function, so after scale to small size, now can draw 🙂

[as3]public static function scaledImage(bd:BitmapData, s:Number = 120) : Bitmap
var newWidth:Number;
var newHeight:Number;
var result:BitmapData;
var bitmap:BitmapData = bd;
var size:Number = s;
var matrix:Matrix = new Matrix();
if (bitmap.width > bitmap.height)
newWidth = size;
newHeight = bitmap.height * (size / bitmap.width);
newHeight = size;
newWidth = bitmap.width * (size / bitmap.height);
matrix.scale(newWidth / bitmap.width, newHeight / bitmap.height);
result = new BitmapData(newWidth, newHeight);
result.draw(bitmap, matrix);
return new Bitmap(result);
catch (e:Error)
trace("Scaled image error");
return null;
}// end function[/as3]

ref: photobox photobook program