I'm basically putting together an AIR version of an existing
application I wrote awhile ago.
So far I've got the AIR application accepting images that have been drag-n-dropped on the phone background and displaying/positioning them on the screen.
I can't seem to get my head around getting the image that has been dropped into the application into a BitmapData object so I can crop/etc it and save it to a new file though. It seems like a security sandbox thing, but it's been soo long since I've done anything with Flash, let alone AIR, that I really don't know.
Here's the function I'm using to display the dropped image
function dropHandler(event)
{
var str = event.dataTransfer.getData("text/plain");
var elm = document.getElementById('iphone-wallpaper');
air.trace(elm.style.backgroundImage);
elm.src = str;
}
- function dropHandler(event)
- {
- var str = event.dataTransfer.getData("text/plain");
- var elm = document.getElementById('iphone-wallpaper');
- air.trace(elm.style.backgroundImage);
-
- elm.src = str;
- }
Here's what I've tried for loading the BitmapData
var loader = new air.Loader();
// event handler definitions
loader.contentLoaderInfo.addEventListener(air.Event.COMPLETE, completeHandler);
loader.contentLoaderInfo.addEventListener(air.IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(new air.URLRequest(document.getElementById('iphone-wallpaper').src));
- var loader = new air.Loader();
- // event handler definitions
- loader.contentLoaderInfo.addEventListener(air.Event.COMPLETE, completeHandler);
- loader.contentLoaderInfo.addEventListener(air.IOErrorEvent.IO_ERROR, ioErrorHandler);
- loader.load(new air.URLRequest(document.getElementById('iphone-wallpaper').src));
Here's the error message I get for a local file
[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2035: URL Not Found. URL: file:///home/me/Desktop/1024-768-cat-wallpapers-11.jpg
" errorID=2035]
- [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2035: URL Not Found. URL: file:///home/me/Desktop/1024-768-cat-wallpapers-11.jpg
- " errorID=2035]
-
Here's the message for a file dragged from my browser
An ActionScript error has occurred:
TypeError: Value does not allow function calls.
- An ActionScript error has occurred:
- TypeError: Value does not allow function calls.
Any information is welcome.

Strong with this one, the sudo is.