Created
March 23, 2012 07:15
-
-
Save wwwins/2167889 to your computer and use it in GitHub Desktop.
uploadmanager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var uploadmanager:UploadManager = UploadManager.Instance; | |
// init | |
initUploaderManager(); | |
private function initUploaderManager():void | |
{ | |
// init uploadmanager | |
// set file filter | |
uploadmanager.ApplyFileFilters([new FileFilter("Images (*.jpg, *.jpeg, *.JPG, *.JPEG, *.png, *.PNG)", "*.jpg;*.jpeg;*.JPG;*.JPEG;*.png;*.PNG")]); | |
uploadmanager.onFileLoaded.add(myPhotoLoaded); | |
} | |
private function myPhotoLoaded(__loader:Loader):void | |
{ | |
while(pic_loader.numChildren){ | |
pic_loader.removeChildAt(0); | |
} | |
pic_loader.addChild(__loader); | |
// fits a DisplayObject into a rectangular area | |
var area:Rectangle = new Rectangle( 0, 0, 125, 125 ); | |
DisplayUtils.fitIntoRect( __loader, area, true, Alignment.MIDDLE ); | |
Bitmap(__loader.content).smoothing = true; | |
} | |
// set mouse click | |
btn_browse.addEventListener(MouseEvent.CLICK, function(e:MouseEvent){uploadmanager.Browse();}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment