• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How could i have the user upload an image to a flash file?

New Here ,
Aug 23, 2015 Aug 23, 2015

Copy link to clipboard

Copied

eg. User uploads image file and it changes a photo to that image

TOPICS
ActionScript

Views

232

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 23, 2015 Aug 23, 2015

Copy link to clipboard

Copied

LATEST

you can use the filereference class to load a user file into flash:

var fileRef:FileReference= new FileReference(); 
button.addEventListener(MouseEvent.CLICK, onButtonClick);  
function onButtonClick(e:MouseEvent):void { 
fileRef.browse([new FileFilter("Images", "*.jpg;*.gif;*.png")]); 
fileRef.addEventListener(Event.SELECT, onFileSelected); 
function onFileSelected(e:Event):void {
 fileRef.addEventListener(Event.COMPLETE, onFileLoaded); fileRef.load(); 
function onFileLoaded(e:Event):void { 
var loader:Loader = new Loader(); loader.loadBytes(e.target.data); 
addChild(loader); 
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines