package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.FileReference;
import flash.net.FileReferenceList;
public class FileReferenceListExample extends Sprite {
public static var LIST_COMPLETE:String = "listComplete";
public function FileReferenceListExample() {
initiateFileUpload();
}
private function initiateFileUpload():void {
var fileRef:CustomFileReferenceList = new CustomFileReferenceList();
fileRef.addEventListener(FileReferenceListExample.LIST_COMPLETE, listCompleteHandler);
fileRef.browse(fileRef.getTypes());
}
private function listCompleteHandler(event:Event):void {
trace("listCompleteHandler");
}
}
}
Code like the above will get executed as soon as loaded,how can I make it run under certain condition?
Pretty much this in this answer:
function keyEvent(code:String):void {
// do something with the "code" parameter, that looks like "alt+ctrl+D", may use .split('+'), etc
}