Not signed in (Sign In)

Vanilla 1.0.3 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthordmitch31
    • CommentTimeJul 2nd 2007
     
    Here's my problem. I've successfully implemented SWFObject. Now, all I'm trying to do is use ExternalInterface.call to call a javascript function in my page.

    The ID of my flash object as definied in my SWFObject code is 'UploadFile'. Here is my code...

    FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
    var so = new SWFObject("UploadFile.swf", "UploadFile", "200", "65", "6", "#FFFFFF");
    so.addParam("allowScriptAccess", "always");
    so.addVariable("uploadPage", "STWM_TAX_Business/UploadFile.axd<%=GetFlashVars()%>");
    so.addVariable("completeFunction", "UploadComplete()");
    so.addVariable("jvaUploadCancel", "UploadComplete()");
    so.write("flashcontent");
    </script>

    The problem is that when I add the line of code to my actionscript:
    ExternalInterface.call("jvaShowFlashUploadComponent");

    and run the page, I get the following error when the ExternalInterface.call gets hit:

    Microsoft JScript runtime error: 'UploadFile' is undefined

    Seeing that the ID of my flash object is defined as 'UploadFile', I have no idea why it is undefined at this point, and quite frankly, I don't even know why it even matters. The rendered code that I see in the Visual Studio IDE that causes the error is as follows:

    try { UploadFile.SetReturnValue(__flash__toXML(jvaShowFlashUploadComponent()) ); } catch (e) { UploadFile.SetReturnValue("<undefined/>"); }

    The debugger has the '}' right before the 'catch' highlighted in yellow. Does anyone have any insight into what is going on? Any help would be GREATLY appreciated. I am new with Flash, so I'm just kind of finding my way as I go, and it's frustrating because I'm not familiar with all of this.

    Thank you.
    • CommentAuthorAran
    • CommentTimeJul 2nd 2007
     
    Is your flash definition within a form? If so, there is a known bug with Externl interface and IE.

    Anyhow, checkout the flash javascript communication FAQ: http://blog.deconcept.com/swfobject/forum/discussion/499/flash-to-browser-communication-with-swfobject/

    When things don't work, I go back to basics. Do a nice simple flash file which just calls js alert or something with no forms or anythig else on the page. If you get that working, start building up the functionality and see where things break.

    Also - this line should not be in your HTML: FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject; These are shortcut references used internally in the swfobject.js file.
    • CommentAuthordmitch31
    • CommentTimeJul 3rd 2007 edited
     
    Aran,

    Thank you so much for your efforts to help. As a result of the link you shared, I've actually found a solution!

    I will share what happened here for the benefit of anyone else who may experience the same issues I have.

    My situation as far as web development goes is a little bit different than what is assumed by the instructions for SWFObject. I am developing a very complex website using Microsoft Visual Studio 2005 and also the website is created using the DotNetNuke framework. All of our files are ascx files, therefore, I have to take the instructions for SWFObject and "adapt" them to something equivalent within DotNetNuke. For example, within the ascx files, there are NO <HEAD> tags. So when someone says, well, you have to have thus-and-so in your head tags, it just doesn't apply to me. Rather, I have to insert the script in a different way.

    I followed your link and as a result, went to Steve Kamerman's website and found his updated swfobject_swfformfix.js script. If you use this script in place of the standard SWFObject script, it resolves the form issue. Initially, I wasn't aware that the form issue was my problem, because I am not trying to implement this in a form. However, upon further research, I have found that DotNetNuke, as it renders its pages, inserts form tags. I don't know why, but I don't have to. The point here is to know that DotNetNuke inserts form tags in its rendered pages and therefore causes the incompatibility with the original SWFObject script. Steve Kamerman's new script solves the problem simply by replacing the script with his new version! Yippee!
    • CommentAuthorkernol
    • CommentTimeJul 19th 2007
     
    I think you will find that it is asp.net that is creating the form elements, not dotnetnuke. It's all related to the way it does post backs and controls from memory (could be wrong though).
    • CommentAuthorzhangsisi
    • CommentTimeOct 1st 2007
     
    the find best www.ConnectAsia.info/en/lang104082about_sisi11 welcome you
  1.  
    You can easily fix the problem with flash objects in forms for ie. Just add [flashid] = document.getElementById('[flashid]'); at the bottom of your script.

    Example:

    FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
    var so = new SWFObject("UploadFile.swf", "UploadFile", "200", "65", "8", "#FFFFFF");
    so.addParam("allowScriptAccess", "always");
    so.addVariable("uploadPage", "STWM_TAX_Business/UploadFile.axd<%=GetFlashVars()%>");
    so.addVariable("completeFunction", "UploadComplete()");
    so.addVariable("jvaUploadCancel", "UploadComplete()");
    so.write("flashcontent");
    UploadFile = document.getElementById('UploadFile'); //fix ExternalInterface in IE including call() method

    You can then use the ExternalInterface.call method all you want and it appears to work on the FireFox and Safari without any special modification.
    • CommentAuthorAran
    • CommentTimeOct 20th 2007
     
    @IsaacTheIceMan

    I could be wrong, but I think your suggestion is what Steve Kamerman's javascript fix does (although I think it will loop through the DOM an add all flash files automatically)