/ Published in: ActionScript 3
URL: http://blog.riaproject.com/flex/1012.html
Expand |
Embed | Plain Text
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" creationComplete="init()" backgroundColor="White"> <mx:Script> <![CDATA[ import mx.core.UIComponent; private var fileR:FileReference=new FileReference(); private function init():void { this.fileR.addEventListener(Event.SELECT, selectHandler); this.fileR.addEventListener(Event.COMPLETE, completeHandler); } private function selectHandler(event:Event):void { this.fileR.load(); } private function completeHandler(event:Event):void { this.imageShow.source=this.fileR.data; } private function showPic():void { this.fileR.browse(); } ]]> </mx:Script> <mx:Button label="Browse Image" click="showPic()"/> <mx:Image id="imageShow" width="200" height="200"/> </mx:Application>
You need to login to post a comment.
