Adobe Integrated Runtime (AIR) for JavaScript Developers Pocket Reference

(nextflipdebug5) #1

108 | Chapter 4: AIR Mini-Cookbook


if( xml.readyState == 4 ) // the
request is complete
{
var file = air.File.
applicationStorageDirectory.resolve("data.xml");
var fileStream = new air.
FileStream( );
fileStream.open( file, air.
FileMode.WRITE );
fileStream.writeMultiByte( xml.
responseText , air.File.systemCharset );
fileStream.close( );

document.getElementById(
"dataText" ).value = xml.responseText;
}
}

xml.send( null );
}
}
</script>
</head>
<body onload="onLoad( )">
<textarea id="dataText"></textarea>
</body>
</html>

Drag and Drop


Using Drag and Drop from HTML


Problem


You want to allow users to drag files, images, text, and other
data types into and out HTML-based AIR applications.


Solution


By using Adobe AIR’s Drag and Drop implementation in Jav-
aScript, developers can react to drag and drop operations
that occur on HTML DOM objects.

Free download pdf