Probably something like:
public function writeExternal(output:IDataOutput):void
{
output.writeInt(_bitmapData.width);
output.writeInt(_bitmapData.height);
output.writeBytes(_bitmapData.getPixels(new Rectangle(0, 0,
_bitmapData.width, _bitmapData.height))
}
public function readExternal(input:IDataInput):vo! id
{
var w:int = input.readInt();
var h:int = input.readInt();
_bitmapData = new BitmapData(w, h);
_bitmapData.setPixels(input.readBytes(), new Rectangle(0, 0, w, h));
}
On 8/18/11 2:04 PM, "Philip Smith" <[email protected]> wrote:
How would I go about implementing that? eg:
public class PageVO implements IExternalizable
{
public function get bitmapData():BitmapData
{
return _bitmapData;
}
public function set bitmapData(value:BitmapData):void
{
_bitmapData = value;
}
public function writeExternal(output:IDataOutput):void
{
}
public function readExternal(input:IDataInput):vo! id
{
}
}
________________________________
To: [email protected]
From: [email protected]
Date: Thu, 18 Aug 2011 13:46:59 -0700
Subject: Re: [flexcoders] BitmapData Argument: Error #1063: Arg count mismatch
on object util.copy
You can implement IExternalizable on the object that references the
bitmapdata
On 8/18/11 11:57 AM, "method_air" <[email protected]
<http://[email protected]> > wrote:
I'm creating a deep copy of an object which has a BitmapData property using
ObjectUtil.copy and 'registerClassAlias', eg:
registerClassAlias("flash.display.BitmapData", BitmapData);
...but I'm getting the error: ArgumentError: Error #1063: Argument count
mismatch on flash.display::BitmapData(). Expected 2, got 0
Is there a workaround?
Thanks,
Philip
--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui