So ive just really got to grips with AS2 then AS3 kicks me right in the balls!!
Im trying out a Air app where you simply drag and drop a jpg onto the app and it loads the jpg… its from a flv tut from gotoandlearn.com.
the problem im having is i want to drag and drop jpgs from a browser window and have it load. Its weird because the process works in the .swf format but when published in Air it cant pick up the Url/path anymore???
(desktop drag and drops work fine as it can find the path)
Heres the code:
import flash.desktop.NativeDragManager;
import flash.events.NativeDragEvent;
import flash.desktop.ClipboardFormats;
var imageLoader:Loader = new Loader();
dropBox.addChild(imageLoader);
this.addEventListener(NativeDragEvent.NATIVE_DRAG_ENTER, onDragEnter);
this.addEventListener(NativeDragEvent.NATIVE_DRAG_DROP, onDragDrop);
function onDragEnter(e:NativeDragEvent):void{
var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT);
if(fa[0].extension=="jpg"){
NativeDragManager.acceptDragDrop(this);
}
}
function onDragDrop(e:NativeDragEvent):void{
var fa:Object = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT);
imageLoader.load(new URLRequest(fa[0].url));
//trace(fa);
}
what do i need to do to alter:
imageLoader.load(new URLRequest(fa[0].url));
to make it get the correct path? or is this simply a security problem/issue?
Why does the .swf work but not the Air app?
And finally i tried to trace the issue but how can i trace when publishing in Air?
Any help would be great. Thanks!