var btn:Sprite = new Sprite();
btn.graphics.beginFill(0);
btn.graphics.drawRect(0,0,100,20);
btn.graphics.endFill();
addChild(btn);
var fr:FileReference = new FileReference();
fr.addEventListener(Event.COMPLETE, completeHandler);
fr.addEventListener(Event.SELECT, selectHandler);
btn.addEventListener(MouseEvent.CLICK, onBtnClicked);
function onBtnClicked(ev:MouseEvent):void {
fr.browse(); //Use arguments to restrict file types. See Lang Ref.
}
function completeHandler(ev:Event):void {
trace(fr.data);
}
function selectHandler(ev:Event):void {
fr.load();
}
No comments:
Post a Comment