Ciao ragazzi sono nuovo è poco che utilizzo flash as3 e non mi sono chiare tante cose e siccome ho poco tempo speravo che qualcuno di voi mi desse una mano.
Cercando con google ho trovato un sorgente ben fatto l'ho scopiazzato e adattato alle mie esigenze solo che uppa correttamente solo file immagini.
Quindi la mia domanda è: come posso modificarlo da renderlo utilizzabile anche per l'upload dei video(.flv)?

[code]
import flash.events.MouseEvent;
import flash.net.FileReference;
import flash.net.FileFilter;
import flash.utils.ByteArray;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.display.MovieClip;
import fl.controls.ProgressBarMode;

var mFileReference:FileReference;

// Setup button to handle browsing
browseButton.buttonMode=true;
browseButton.mouseChildren=false;
browseButton.addEventListener(MouseEvent.CLICK, onBrowseButtonClicked);
// Hide progress bar
progressBar.visible=false;

// This function is called when the BROWSE button is clicked.
function onBrowseButtonClicked(event:MouseEvent):void
{
trace("onBrowse");
mFileReference=new FileReference();
mFileReference.addEventListener(Event.SELECT, onFileSelected);
var swfTypeFilter:FileFilter = new FileFilter("FLV Files","*.flv");
var allTypeFilter:FileFilter = new FileFilter("All Files (*.*)","*.*");
mFileReference.browse([swfTypeFilter,allTypeFilter]);
}

// This function is called after user selected a file in the file browser dialog.
function onFileSelected(event:Event):void
{
trace("onFileSelected");
// This callback will be called when the file is uploaded and ready to use
mFileReference.addEventListener(Event.COMPLETE, onFileLoaded);

// This callback will be called if there's error during uploading
mFileReference.addEventListener(IOErrorEvent.IO_ER ROR, onFileLoadError);

// Optional callback to track progress of uploading
mFileReference.addEventListener(ProgressEvent.PROG RESS, onProgress);

// Tells the FileReference to load the file
mFileReference.load();

if (mFileReference.size > 512000*1024)
{
trace("File too big");
}
// Show progress bar
progressBar.visible=true;
progressBar.mode=ProgressBarMode.MANUAL;
progressBar.minimum=0;
progressBar.maximum=100;
}

// This function is called to notify us of the uploading progress
function onProgress(event:ProgressEvent):void
{
var percentLoaded:Number=event.bytesLoaded/event.bytesTotal*100;
trace("loaded: "+percentLoaded+"%");
progressBar.setProgress(percentLoaded, 100);
}

// This function is called after the file has been uploaded.
function onFileLoaded(event:Event):void
{
var fileReference:FileReference=event.target as FileReference;
var data:ByteArray=fileReference["data"];
trace("File loaded");
var movieClipLoader:Loader=new Loader();
movieClipLoader.loadBytes(data);
movieClipLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, onMovieClipLoaderComplete);

mFileReference.removeEventListener(Event.COMPLETE, onFileLoaded);
mFileReference.removeEventListener(IOErrorEvent.IO _ERROR, onFileLoadError);
mFileReference.removeEventListener(ProgressEvent.P ROGRESS, onProgress);
}

function onFileLoadError(event:Event):void
{
// Hide progress bar
progressBar.visible=false;
mFileReference.removeEventListener(Event.COMPLETE, onFileLoaded);
mFileReference.removeEventListener(IOErrorEvent.IO _ERROR, onFileLoadError);
mFileReference.removeEventListener(ProgressEvent.P ROGRESS, onProgress);
browseButton.visible=true;
progressBar.visible=false;
trace("File load error");
}

// This function below is specific to this example.
// It does the processing required to display the swf/png/jpeg file that we have just loaded.
function onMovieClipLoaderComplete(event:Event):void
{
var filename:String=mFileReference.name;
var urlRequest:URLRequest = new URLRequest("uploader.php");
urlRequest.method = URLRequestMethod.POST;

browseButton.visible=false;
// Optional callback to track progress of uploading
mFileReference.addEventListener(ProgressEvent.PROG RESS, onProgress);
mFileReference.addEventListener(DataEvent.UPLOAD_C OMPLETE_DATA,onUploadComplete);
mFileReference.upload(urlRequest);
}

function onUploadComplete(event:Event):void
{
// Optional callback to track progress of uploading
mFileReference.removeEventListener(ProgressEvent.P ROGRESS, onProgress);
mFileReference.removeEventListener(DataEvent.UPLOA D_COMPLETE_DATA,onUploadComplete);
browseButton.visible=true;
progressBar.visible=false;
}
[code]