Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

flash externalinterface :works in IE , not in firefox

Posted on 2009-12-28
4
Medium Priority
?
748 Views
Last Modified: 2013-11-11
Hello experts
I have done a very simple flash swf (as3) that plays an mp3 and have added an extranelInterafce
ExternalInterface.addCallback("playMP3",playMP3);

Works great with IE but does not work with firefox 3.6 !
Gives me:
document.getElementById("mp3").playMP3 is not a function

Any clue ?
regards
<!-- saved from url=(0013)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>mp3</title>
</head>
<body bgcolor="#ffffff">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="mp3" width="10" height="10" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="movie" value="mp3.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="mp3.swf" quality="high" bgcolor="#ffffff" width="10" height="10" swLiveConnect="true" id="mp3" name="mp3" align="middle" allowScriptAccess="always" 
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
  <input type="button" name="button" id="button" value="Button"  onclick="document.getElementById('mp3').playMP3()"/>
 
</body>
</html>

Open in new window

0
Comment
Question by:yarekGmail
4 Comments
 
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 26131391
I don't know how this could be related to Delphi, anyway about the Firefox issue I know that using the fully-qualified class name for ExternalInterface (flash.external.ExternalInterface) should solve the Firefox problem.

So try changing your
ExternalInterface.addCallback("playMP3",playMP3);
to
flash.external.ExternalInterface.addCallback("playMP3",playMP3);
0
 

Author Comment

by:yarekGmail
ID: 26131651
Delphi : sorry, I think the wbesite kept my last selection !

Still does not wrok with firefox ! Totally crazy !

I have attached the HTML, SWF and teh FLA source code.
Thanks
Flash.zip
0
 
LVL 19

Accepted Solution

by:
moagrius earned 2000 total points
ID: 26131762
the problem is you're accessing the flash object improperly.

flash is browser independant, and the fully qualified class name is not required.

this is fine:

ExternalInterface.addCallback("playMP3",playMP3);

but your javascript attempt to access the flash object will only grab it in IE.

change your html for the flash object to the following snippet:
<object id="mp3" type="application/x-shockwave-flash" data="mp3.swf" width="10" height="10"> 
  <param name="allowScriptAccess" value="always" />
  <param name="movie" value="mp3.swf" />
  <param name="quality" value="high" />
  <param name="bgcolor" value="#ffffff" />
</object>

Open in new window

0
 

Expert Comment

by:jack_archer
ID: 26835673
Hello,
My question is exactly same. But the "Accepted Solution" does work? I copy and tried, it make no difference. What is the magic? I do can access my flash object, but I cannot access its ExternalInterface function.
Another thing I noticed is that if open the HTML from local, then it works fine. But after I put it on web server, then it stop working in FF (I tried both 3.6 and 3.0). But everything is under same domain
It works in IE always.

Thanks!
Jack
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question