画像のマスクされた領域のスナップショットを取得しようとしています...そのため、画像をロードして次の機能を実行します。
private function manageLoadedImage(e:Event):void
{
_bitdata = e.currentTarget.content; // get the bitmap
_bithold.addChild( _bitdata ); // add the bitmap to a sprite on the stage
_bithold.x = holder1.x -((_bithold.width - holder1.width)/2); // center image
_bithold.y = holder1.y -((_bithold.height - holder1.height)/2); // center image
var m:Shape = new Shape(); // create the shape
m.graphics.beginFill(0x0); // make the fill
m.graphics.drawRect( this.x, this.y, holder1.width, holder1.height ); // draw the mask
m.graphics.endFill(); // end the fill
_bithold.mask = m; // mask the image
}// private function manageNewPaneAddition(e:Event):void
public function save( ):void
{
// WHAT DO I DO HERE ????????
_bmdsrc = new BitmapData( holder1.width, holder1.height ); // create the new bitmapdata
var m:Matrix = _bithold.transform.matrix; // lets try this out
m.tx = -holder1.x + _bithold.width; // not sure what this means ?
m.ty = -holder1.y + _bithold.height; // what does this mean ?
_bmdsrc.draw( _bithold, m); // draw the bitmapdata
// END PROBLEM ??????????????
}// private function save( ):void
というわけで、読み込んだ画像を管理したら保存します。しかし、保存機能は 80x80px の白い正方形しか出力しません。これは、空のステージをスナップショットしていることを示しています。
MovieClip の構造は次のとおりです。
ムービーがあり、そのムービー内に ThumbEdit という名前のサムネイル エディターがあります。
ThumbEdit のステージには、「holder1」と呼ばれるムービークリップがあります。ThumbEdit のドキュメント クラスで、スプライト "_bithold" を作成し、ステージの holder1.x と holder1.y に配置します。画像が読み込まれたら、その画像を _bithold に追加し、_bithold をシェイプでマスクします。したがって、_bithold のマスクされた領域のスナップショットを取得したいのですが、どうすればよいかわかりません...何かアドバイスはありますか?