Code inside Actionscript:
var methodName4:String = "startupload";
var instance4:Object = null;
var method4:Function = startupload;
var wasSuccessful4:Boolean = ExternalInterface.addCallback(methodName4, instance4, method4);
function startupload(currently_uploading_id) {
/* If there is still more photos to upload, then proceed to next one */
if((max_photo_number - session_photos))
{
uploadthis(selected_photos,currently_uploading_id);
}
}
Html:
<div id="e_upload" class="hidden">
<div id="upload_container">
</div>
</div>
Javascript:
when dom is loaded:
var cached_flash = $('#e_upload').html();
$('#e_upload').html('');
When generating html via javascript:
$(cached_flash).appendTo(full_ad.find('#e_upload_wrapper')).show();
That’s it. When i’m trying to upload somethin, startupload function inside flash is not working anymore.
Calling Actionscript this way:
/* Sending back to Flash */
function thisMovie(movieName) {
if (window.document[movieName]) {
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet") == -1) {
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}
thisMovie('fileref').startupload(currently_uploading_array_slot);
Actionscript is calling javascript functions from inside just fine, but javascript is not.
What is the problem? How to rebind startupload function?
you accessing document body, but your swf is deeper, so access it directly:
so not
document.getElementById(movieName)butdocument.getElementById(e_upload).getElementById(movieName)