フラッシュの画像からキューブを作成しています。ローダーは、画像のスプライトマップをロードします。
+----++----++----++----++----++----+
|frnt||rght||back||left||top ||bot |
| || || || || || |
+----++----++----++----++----++----+
私が得ているエラーは次のとおりです。
エラー#2005:パラメーター0のタイプが正しくありません。タイプはBitmapDataである必要があります。
行上front.draw(src, null, null, null, clip);
(コードをコメントアウトし、エラーを受け取らないことで確認)。しかし、理由はわかりません。私はとして定義 src
しBitmapData
、のtrace
はをsrc
生成し[object BitmapData]
ます。
private function loaderCompleteListener(e:Event):void
{
log('Complete');
var front:BitmapData,
right:BitmapData,
back:BitmapData,
left:BitmapData,
top:BitmapData,
bottom:BitmapData,
srcData:Bitmap,
src:BitmapData,
clip:Rectangle;
try
{
srcData = this._imageLoader.content as Bitmap;
src = srcData.bitmapData;
front = new BitmapData(src.height, src.height, false, 0);
right = new BitmapData(src.height, src.height, false, 0);
back = new BitmapData(src.height, src.height, false, 0);
left = new BitmapData(src.height, src.height, false, 0);
top = new BitmapData(src.height, src.height, false, 0);
bottom = new BitmapData(src.height, src.height, false, 0);
clip = new Rectangle(0, 0, src.height, src.height);
//This is the line that causes the error
front.draw(src, null, null, null, clip); //<----
clip.x += src.height;
right.draw(src, null, null, null, clip);
clip.x += src.height;
back.draw(src, null, null, null, clip);
clip.x += src.height;
left.draw(src, null, null, null, clip);
clip.x += src.height;
top.draw(src, null, null, null, clip);
clip.x += src.height;
bottom.draw(src, null, null, null, clip);
}
catch ( e:Error )
{
log(e.message);
}
}
私は何が欠けていますか?
編集して追加:
1つの考慮事項は、画像サイズです。1866×11196の画像を読み込んでいます。明日テストして、小さい画像が機能するかどうかを確認します。Flashが特定のサイズを超える画像を処理できない可能性があります。