画像をキャンバスにドロップすると、画像へのnativePathを取得できますが、必要なビットマップデータは取得できません。
デバッグモードでファイルのプロパティを調べると、データはNULLに設定されています。
私はここで何が間違っているのですか?私のコードfile.data
では何も与えられません。
protected function creationCompleteHandler(event:FlexEvent):void
{
this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER,onDragIn);
this.addEventListener(NativeDragEvent.NATIVE_DRAG_DROP,onDrop);
NativeDragActions.COPY;
}
private function onDrop(e:NativeDragEvent):void
{
trace("Dropped!");
var dropfiles:Array = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;
for each (var file:File in dropfiles){
switch (file.extension.toLowerCase()){
case "png" :
trace('png');
//resizeImage(file.nativePath);
break;
case "jpg" :
trace('jpg');
//resizeImage(file.nativePath);
break;
case "jpeg" :
trace('jpeg');
//resizeImage(file.nativePath);
break;
case "gif" :
resizeImage(file.nativePath);
break;
default:
Alert.show("choose an image file!");
}
}
}