15.10.2012 Views

Actionscript 3 Entwicklerhandbuch

Actionscript 3 Entwicklerhandbuch

Actionscript 3 Entwicklerhandbuch

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ACTIONSCRIPT 3.0 ENTWICKLERHANDBUCH<br />

Ziehen und Ablegen in AIR<br />

package<br />

{<br />

import flash.desktop.IFilePromise;<br />

import flash.events.ErrorEvent;<br />

import flash.events.EventDispatcher;<br />

import flash.utils.IDataInput;<br />

}<br />

public class AsynchronousFilePromise extends EventDispatcher implements IFilePromise<br />

{<br />

private var fileGenerator:AsyncDataProvider;<br />

private const fileSize:int = 5000; //size of file data<br />

private var filePath:String = "AsynchronousFile.txt";<br />

}<br />

public function get relativePath():String<br />

{<br />

return filePath;<br />

}<br />

public function get isAsync():Boolean<br />

{<br />

return true;<br />

}<br />

public function open():IDataInput<br />

{<br />

fileGenerator = new AsyncDataProvider();<br />

fileGenerator.fileSize = fileSize;<br />

fileGenerator.begin();<br />

return fileGenerator;<br />

}<br />

public function close():void<br />

{<br />

fileGenerator.end();<br />

}<br />

public function reportError(e:ErrorEvent):void<br />

{<br />

trace("Something went wrong: " + e.errorID + " - " + e.type + ", " + e.text );<br />

}<br />

Letzte Aktualisierung 27.6.2012<br />

669

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!