Re: [Flashcoders] How to add bitmaps from my library to the stage AS3?
Thanks Jonathon and Eduardo for your answers, I'll get them implemented. :) Ali On 19 Jun 2008, at 15:29, Eduardo Omine wrote: IIRC, because your LibImage extends BitmapData, it needs the 2 parameters required by the BitmapData constructor (width and height). var formatImg = new LibImage(10, 10); http://www.kirupa.com/forum/showthread.php?p=2113725 -- Eduardo Omine http://blog.omine.net/ http://www.omine.net/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Alistair Colling Interactive Developer FPP Brand Communications (Newcastle upon Tyne) The Courtyard Dinsdale Place Sandyford Newcastle upon Tyne NE2 1BD Telephone: +44 (0)191 261 6662 Fax: +44 (0)191 233 2511 This transmission is confidential and intended solely for the person or organisation to whom it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action in reliance on it. If you have received this transmission in error, please notify the sender at the e-mail address above. FPP Design Limited. Reg. Office: The Courtyard, Dinsdale Place, Sandyford, Newcastle upon Tyne NE2 1BD. Registered Number 3775564. Registered in England and Wales. Visit our website at http://www.fpp.net/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to add bitmaps from my library to the stage AS3?
Here's the function I use (it uses getDefinitionByName Class because it lets me get bitmaps in externally loaded swfs as well): public static function getBitmapAsset(assetName:String):Bitmap { try { var ClassReference:Class = getDefinitionByName(assetName) as Class; var data:BitmapData = new ClassReference(0, 0); } catch (error:Error) { trace(AssetManager:: attempted to instantiate class (Bitmap) that was not found (asset misnamed or does not exist in loaded libraries , assetName, error.toString()); } var instance:Bitmap = new Bitmap(data); return instance; } On Thu, Jun 19, 2008 at 4:11 PM, Ali Drongo [EMAIL PROTECTED] wrote: Hello there, thanks for checking my post. I have a bunch of jpgs that I've imported into my library and have given class names, they default to extend the BitmapData class. When I try and instantiate them I get an error message saying I need to pass them 2 arguments. Here is my code: var formatImg = new LibImage(); var image:Bitmap = new Bitmap(formatImg); mainMC.addChild(image); Could someone let me know the correct syntax for doing this? As I am using a document class I think I may need to use the [Embed(source='myPhoto.png')] syntax also Thanks! Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to add bitmaps from my library to the stage AS3?
IIRC, because your LibImage extends BitmapData, it needs the 2 parameters required by the BitmapData constructor (width and height). var formatImg = new LibImage(10, 10); http://www.kirupa.com/forum/showthread.php?p=2113725 -- Eduardo Omine http://blog.omine.net/ http://www.omine.net/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How to add bitmaps from my library to the stage AS3?
When you call a Library class (eg:LibImage()), you need to give it 2 parameters which represent the width and height of the BitmapData class. Here however, they dont do anything. So simply call :: new LibImage(0, 0); 2008/6/20 jonathan howe [EMAIL PROTECTED]: Here's the function I use (it uses getDefinitionByName Class because it lets me get bitmaps in externally loaded swfs as well): public static function getBitmapAsset(assetName:String):Bitmap { try { var ClassReference:Class = getDefinitionByName(assetName) as Class; var data:BitmapData = new ClassReference(0, 0); } catch (error:Error) { trace(AssetManager:: attempted to instantiate class (Bitmap) that was not found (asset misnamed or does not exist in loaded libraries , assetName, error.toString()); } var instance:Bitmap = new Bitmap(data); return instance; } On Thu, Jun 19, 2008 at 4:11 PM, Ali Drongo [EMAIL PROTECTED] wrote: Hello there, thanks for checking my post. I have a bunch of jpgs that I've imported into my library and have given class names, they default to extend the BitmapData class. When I try and instantiate them I get an error message saying I need to pass them 2 arguments. Here is my code: var formatImg = new LibImage(); var image:Bitmap = new Bitmap(formatImg); mainMC.addChild(image); Could someone let me know the correct syntax for doing this? As I am using a document class I think I may need to use the [Embed(source='myPhoto.png')] syntax also Thanks! Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Random Lines 3D My online portfolio www.therandomlines.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders