//for Contribute.mxml:

private function init():void 
{
    fileRef = new FileReference();
    fileRef.addEventListener(Event.SELECT, browseSelectHandler);
    fileRef.addEventListener(Event.COMPLETE, uploadCompleteHandler);
    resetForm();
}

public function resetForm():void 
{
    filename.text='';
    photographerInput.text='';
    descInput.text='';
    fileBrowsed=false;
}

//for FStop.mxml
private function uploadCompleteHandler(event:Event):void 
{     
    var photo:Photo = new Photo();
    photo.photographer=photographerInput.text;
    photo.desc=descInput.text;
    photo.filename=fileRef.name;
    photo.categoryId=categoryList.selectedItem.categoryId;
    var uploadEvent:PhotoEvent = new PhotoEvent(photo, "photoUploaded");
    dispatchEvent(uploadEvent);
}

private function photoUploadHandler(
		event:PhotoEvent):void 
{
	var token:AsyncToken=photoRO.doCreate(event.selectedPhoto);
	token.photo=event.selectedPhoto;
}
