Uploading images in flash

so i’m attempting to use a javascript hack to generate the browse and upload action in order to upload images while using a flash interface…

my problem is getting it all to work together. any thoughts ?

here’s the javascript:

function SetTheFilename()
{ parent.hidden.document.myForm.file.click();
while(parent.hidden.document.myForm.file.value == “”)
{ window.setTimeout(100);
}
parent.hidden.SendTheFilenameToFlash();
}
function SubmitTheFile()
{ if (parent.hidden.document.myForm.file.value=="")
{ alert(“Please enter a valid filename”);
}
else
{ alert("Submitting " + parent.hidden.document.myForm.file.value);
parent.hidden.document.myForm.submit();
}
}

here’s the code in flash:

// Call browse method associated with HTML file widget
myBrowse.onRelease = function()
{ getURL(“javascript:SetTheFilename();”);
};

// Submit the file upload
mySubmit.onRelease = function()
{ getURL(“javascript:SubmitTheFile();”);
};