I am using the code bellow to load an image on stage and everything works great but my problem is that i dont know how setup manualy the width and height of the uploaded image.
the movieclip that holds the uploaded image is called image2.
The code bellow is running under .as file so i dont need to write the imports etc.
My code is:
private var jagFileRefSave:FileReference = new FileReference();
private var uloader:Loader = new Loader();
private var imagesFilter:FileFilter = new FileFilter("Images", "*.jpg;*.gif;*.png");
upload_Image.addEventListener(MouseEvent.CLICK,onClickSave);
private function onClickSave(e:MouseEvent):void{
jagFileRefSave.browse([imagesFilter]);
jagFileRefSave.addEventListener(Event.SELECT, selectedFile);
}
private function selectedFile(e:Event):void{
jagFileRefSave.load();
jagFileRefSave.addEventListener(Event.COMPLETE, uuloaded);
}
private function uuloaded(e:Event):void{
var rawBytes:ByteArray = jagFileRefSave.data;
uloader.contentLoaderInfo.addEventListener(Event.COMPLETE, ugetBitmapData)
uloader.loadBytes(rawBytes);
}
private function ugetBitmapData(e:Event):void{
image2.addChild(uloader); //**Image2 is the movieclip that holds the uploaded image**
}
Thank you!
“i dont know how setup manualy the width and height of the uploaded image” – This can be found by checking the content of the loader:
“how can i change the size of the uploaded image, not the loader”: