Alan:

I just picked up essential actionscript 3 and this sort of issue is addressed on page 657 and already solved my issue.

i don't know why adobe left the mx.core.bitmap asset out of flash cs3 all together but at least i learned how to compile flash actionscript 3 with the bare minimum flex classes.


Thanks for your time.
Patrick








Alan Watts wrote:
I've never had any problems using this function to return an embedded asset as a bitmap which I can then manipulate or attach.

The getQualifiedSuperclassName if-statement is there because I have some assets with scale-9 enabled and they are returned as sprites, so I convert them first.

public static function getInterfaceAssetasBitmap(interfaceAsset:String):Bitmap {
    var assetClass:Class = getDefinitionByName(interfaceAsset) as Class;
    var returnBitmap:Bitmap;
if ( getQualifiedSuperclassName(assetClass)=="mx.core::SpriteAsset") { var asset:Sprite = new assetClass(); var bitmapData:BitmapData = new BitmapData(asset.width, asset.height, true, 0x00FFFFFF);
                bitmapData.draw(asset);
                returnBitmap.bitmapData=bitmapData;
} else if ( getQualifiedSuperclassName(assetClass)=="mx.core::BitmapAsset") {
        returnBitmap = new assetClass();
    }
    return(returnBitmap);
}

Hope it helps,
Alan




_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to