Can't get ExternalInterface to work with flash

very new flash. I am using the XSPF music player (thin version found here ( http://musicplayer.sourceforge.net/ ) written in AS2) to play the mp3 list on the website. I need to make a javascript call every time it loads a track. I am trying to do this via ExternalInterface but no luck so far. Here's my setup: I am writing a site on a linux machine that also contains a test server but edits flash in windows. I am testing a site in the same Linux box using firefox 3.0.10. The html and actionscript are hosted here ( http://pastebin.com/f36b1da0e ). Does anyone see something wrong with my code? Any idea why it isn't working? I feel like this is something in my basic setup ...

Thanks, Dan

+1


a source to share


1 answer


I had a quick look at your code and it seems OK (ActionScript anyway). I would say to try different methods of embedding swf. Age (so I can't remember all the details) but I tested the frontend with different browsers and sometimes it worked in IE but not firefox and if I tried another swf embedding method it would work in firefox but not IE or just IE 6, not 7!

It was very unpleasant. Anyway, the only method I found that worked in both major browsers at the time (chrome was missing) was to use the HTML that is generated from flexbuilder when you publish your application. Of course, I had to change it a bit (because we are using cocoon and xsl), but it worked.

(since then I think swfobject has been improved, I could try this if I were you)

I posted the HTML template from flexbuilder at http://pastebin.com/f79b5b3f3 This will require an AC_OETags.js file ( http://pastebin.com/f3937a336 ) and playerProductInstall.swf (you may need to download flexbuilder to get this) ...




code for comments below

<mx:HTTPService id="mySerivceCall" 
    url="{'myPHPFile.php'}"
    result="resultHandler(event)" 
    fault="faulthandler(event)"
    showBusyCursor="false" 
    resultFormat="e4x"> 
    <mx:request>
        <time>{new Date().getTime()}</time>
    </mx:request>
</mx:HTTPService>

      

I always add time to the httpservice, make sure it is not cached (very bad in IE). Just stick with any other parameters in the query section and the result format just tells flex that the XML result is formatted to e4x, making XML processing very straight forward.

0


a source







All Articles