flexawesome escreveu: > thanks for reply, > > but I don't know how to use in my file, any example? > > thanks > > --- In [email protected], Frederico Garcia <[EMAIL PROTECTED]> > wrote: > >> flexawesome escreveu: >> >>> Hi there, >>> >>> do you know how can I use it to duplicate the image? It seems >>> > doesn't > >>> work. any ideas? >>> >>> Thank you >>> >>> loader = new SWFLoader(); >>> loader.addEventListener(Event.COMPLETE, Bitmapdata) >>> > > >>> >>> loader.source >>> > = "http://us.i1.yimg.com/us.yimg.com/i/us/nt/ma/ma_tech- > >>> grp_1.gif" >>> //addChild(loader); >>> >>> >>> private function oBitmapdata(e:Event):void >>> { >>> >>> var img:Image = new Image(); >>> var data:BitmapData = Bitmap(loader.content).bitmapData; >>> var bitmap:Bitmap = new Bitmap(data); >>> >>> img.addChild(bitmap) >>> >>> addChild(img); >>> >>> } >>> >>> >>> ------------------------------------ >>> >>> -- >>> Flexcoders Mailing List >>> FAQ: >>> > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > >>> Search Archives: http://www.mail-archive.com/flexcoders% >>> > 40yahoogroups.comYahoo! Groups Links > >>> >>> >>> __________ NOD32 3106 (20080516) Information __________ >>> >>> This message was checked by NOD32 antivirus system. >>> http://www.eset.com >>> >>> >>> >>> >>> >> Hi, >> >> you can use this method: >> >> public static function clone(value:ByteArray):ByteArray { >> var myBA:ByteArray = new ByteArray(); >> myBA.writeObject(value); >> myBA.position = 0; >> >> return myBA.readObject(); >> } >> >> kind regards, >> >> Frederico Garcia >> >> > > > > ------------------------------------ > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links > > > > > __________ NOD32 3106 (20080516) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > > > Sorry, there's an easier way. BitmapData already implements clone(). Here's an example from the Flex Language Reference:
import flash.display.Bitmap; import flash.display.BitmapData; var bmd1:BitmapData = new BitmapData(100, 80, false, 0x00000000); var bmd2:BitmapData = bmd1.clone(); bmd1.setPixel32(1, 1, 0xFFFFFFFF); trace(bmd1.getPixel32(1, 1).toString(16)); // ffffffff trace(bmd2.getPixel32(1, 1).toString(16)); // ff000000 var bm1:Bitmap = new Bitmap(bmd1); this.addChild(bm1); var bm2:Bitmap = new Bitmap(bmd2); bm2.x = 110; this.addChild(bm2); Hope this helps you. Frederico Garcia

