Results 1 to 6 of 6

Thread: External API - changing swf filename breaks everything?

  1. #1
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default External API - changing swf filename breaks everything?

    I am using the External API in the most basic way possible: to play a movie when the page is finished loading.

    Everything works just fine, but for some strange and mysterious reason, I can't change the filename of the swf I'm using.

    Here is the simple js code:

    Code:
    // Flash External API Functions
    function callExternalInterface() {
    	getMovieName("myMovie").callPlayBall(); 
    }
    
    function getMovieName(movieName) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[movieName]
       }
       else {
           return document[movieName]
       }
    }
    And here's the html:

    Code:
    					<script type="text/javascript">
                        AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','980','height','385','src','images/homepage_loader','quality','high','wmode','opaque','allowScriptAccess','always','id','myMovie','name','myMovie','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/homepage_loader' ); //end AC code
                        </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="980" height="385" id="myMovie" align="middle">
                        <param name="allowScriptAccess" value="always" />
                        <param name="movie" value="images/homepage_loader.swf" />
                        <param name="quality" value="high" />
                        <param name="wmode" value="opaque" />
                        <embed src="images/homepage_loader.swf" quality="high" wmode="opaque" name="myMovie" align="middle" allowScriptAccess="always" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="980" height="385"></embed>
                        </object></noscript>
    And then there is the body onLoad calling the callExternalInterface function. This works great. But if I export the homepage_loader.fla as homepage_loader2.swf (and change all four references in the above code to match), I am greeted with a "callPlayBall is not a function" error.

    The javascript is using the id/name of the swf to manipulate it, not the filename. Why would simply changing the filename of the swf cause my External API function to break?

    In case it helps, I'm using CS3 with AS2.0.

  2. #2
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Okay now it gets weirder.

    If I put homepage_loader.swf into a different directory and change the file paths, everything still works fine.

    If I change homepage_loader.swf's filename to homepage_loader2.swf and change the file paths, everything breaks.

    That makes about 0 sense to me. ;-;

  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    I'm not really sure. I've never ever seen that happen. The only thing that comes to mind is a possible cache issue. Have you tried clearning your system cache between tests?

  4. #4
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    I'm certain that it's not a cache issue. I am using the web developer toolbar with FF and have the cache disabled. Just in case I cleared my cache anyway and the error was still there. This happens in both FF and IE.

    Trying to narrow the problem down further, it gets weirder still:

    Using the fla that generated the original swf (the one that works with its original filename intact), I exported the movie as the exact same filename, and the newly exported version with the same filename did not work. Even their size in bytes is identical, yet the External API simply rejects the newer version?

    These two files are identical in every way, but either the browsers or Flash are detecting some difference. The only difference is their creation date - they are the same damn file.

    This is by far the strangest issue I've ever seen with Flash.

  5. #5
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Is this happening in all browsers?

  6. #6
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    It happens in FF2, IE6, and IE7. Those are the only browsers I'm concerned with/have installed but if it happens in all 3 surely there is something going on here.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •