Cannot call flash functions


I created a SWF movie that load an MP3 file dynamically through a javascript call, when the HTML file is loaded normally, calls to flash embedded functions are being excuted successfuly.
But when the HTML file is being loaded through ajax from another page, when I try to cal the flash function, I get a Javascript error: "Object doesn't support this property or method".

The problem only happens on Internet Explorer, Chrome and firefox doesn't return any error and excutes the function as expected.

Please advice.

Best regards,
	function thisMovie(movieName) {
	  if (navigator.appName.indexOf ("Microsoft") !=-1) {
		return document.getElementById(movieName);
	  }	else {
		return document[movieName]

	function PlayAudio()
	function StopAudio()
	<object CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="" id="AudioPlayer" width="230" height="20">
		<param name="movie" value="AudioPlayer.swf?id=79">
		<PARAM NAME="PLAY" VALUE="false" />
		<PARAM NAME="LOOP" VALUE="false" />	
		<param name="wmode" value="transparent" />
        <embed name="AudioPlayer" width="230" height="20" src="AudioPlayer.swf?id=79" PLAY="false" LOOP="false" QUALITY="high" SCALE="SHOWALL" swLiveConnect="true" wmode="transparent" PLUGINSPAGE="">
	  <input type="button" value="play" onclick="PlayAudio()" /><br />
	  <input type="button" value="stop" onclick="StopAudio()" />

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

To communicate between JavaScript and the internal Flash modules you'll need to add "allowScriptAccess" param tag. E.g.

<param name="allowScriptAccess" value="always">

Also be sure that the Flash modules are registered to be called externally by JavaScript inside your Flash application using the ExternalInterface addCallBack method.

More Information: 
mchaimechAuthor Commented:
Hi phpsales, and thank you for your reply.
Well, I added the tag "AllowScriptAccess" as you mentioned without, but didn't affected the problem.
As I stated in previous post, the flash functions are already registered, and when I open the HTML file normally, javascript calls to flash functions run as expected, but when the HTML is being loaded through ajax, the problem appears.
So, I think that the IE is not registering the flash functions when loaded through ajax, unlike other browsers (chrome, FF) where these browsers are registering the flash functions, those the test runs successfuly.

Best regards,
mchaimechAuthor Commented:
Hello again,

I recreated my flash file, but instead of calling the function through javascript to pass variables I am now passing it through flashvars, and it's working just fine, even when Loaded through ajax.
Again, thank you so much phpsales for trying to help. :)

Best regards,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.