This problem is happening is both IE8 and IE7. I have a small swf compiled with flex. It's basically just a wrapper around audio streaming functionality. All the controls and such are in html with javascript. I load the swf using swfobject's "static" method. This works great in Firefox and Chrome. In IE, the swf loads correctly, but as soon as I try to stream any audio with it, I get an error.
EDIT: I've reduced the code quite a bit to try and find the problem. You can see the new version running here. Here is the error, html and flex files for my reduced version:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at isolated/playStream()[/home/defrex/code/bd/trunk/ackbar/media/flex/isolated.mxml:19]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at flash.external::ExternalInterface$/_callIn()
at <anonymous>()
The HTML:
<!DOCTYPE html>
<html>
<head>
<title>fuie</title>
<script type="text/javascript" src="swfobject.js"></script>
<script>
var player;
swfobject.registerObject("_mediaplayer", "9.0.0", undefined, function(e){
if (e.success)
player = e.ref;
else
console.log('Flash not loaded');
});
</script>
</head>
<body>
<a href="#" onclick="player.play_fuie('celebration.mp3');return false;">play track</a>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1" id="_mediaplayer">
<param name="movie" value="isolated.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="isolated.swf" width="1" height="1">
</object>
<!--<![endif]-->
</object>
</body>
</html>
And the flex:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
import flash.external.ExternalInterface;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
public function init():void {
ExternalInterface.addCallback("play_fuie", playStream);
ExternalInterface.call("console.log('flash loaded')");
}
public function playStream(stream:String):void {
var url:URLRequest = new URLRequest(stream);
var audio:Sound = new Sound();
audio.load(url);
var chan:SoundChannel = audio.play();
chan.soundTransform.volume = 0.5;
}
</mx:Script>
</mx:Application>