Urgent help please (Embedded swf not loading assets)

Hi There

I’ve been struggling with what should be a really simple issue for far too long and I may be about to do myself some sort of injury. Any help would be much appreciated.

I have a site that contains a page with a fancybox pop up which contains a .swf

This swf loads a sound file and a thumbnail (mp3 and jpeg). When I view this by double clicking the swf it works fine, when I navigate directly to the swf in the browser it works fine, however when I try to view the embedded swf it does not load the jpeg or the sound file. I have another page which does the exact same thing except it loads a different swf which only loads a video file and this works perfectly.

AS3 code :


package www.elementalstudios.co.za {
    import flash.display.Sprite;
    import flash.events.Event;
    import www.elementalstudios.co.za._util.ImageLoader;
    
    import flash.media.SoundChannel;
    import flash.media.Sound;    
    import flash.net.URLRequest;
    import flash.media.SoundTransform;
    import flash.events.MouseEvent;
    
    public class SoundMain extends Sprite {
        
    public var $bgImage:ImageLoader
    
    public var $sound:Sound;
    public var $soundChannel:SoundChannel = new SoundChannel();
    
    public var $playButton:Sprite = new PlayButton();
    public var $pauseButton:Sprite = new PauseButton();
    
    public var $controlBox:Sprite = new Sprite();
    
    public var $trackPosition:Number = 0;
    
    ////////////////////////////////////////////////////////////////////////
    public function SoundMain () {
        
        addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
    
    }
    ////////////////////////////////////////////////////////////////////////
    public function init (e:Event) : void {                
        
        removeEventListener(Event.ADDED_TO_STAGE, init);
        
        $sound = new Sound(new URLRequest('sound.mp3'));
        $bgImage = new ImageLoader('thumb.jpg');
        
        addChild($bgImage);
        
        $controlBox.graphics.beginFill(0x1c1c1c, .5);
        $controlBox.graphics.drawRect(0, stage.stageHeight-20, stage.stageWidth, 20); 
        $controlBox.graphics.endFill();
        
        addChild($controlBox);
        
        $pauseButton.scaleX = $pauseButton.scaleY = .5;
        $playButton.scaleX = $playButton.scaleY = .5;
        $playButton.y = stage.stageHeight - 35;
        $pauseButton.y = stage.stageHeight - 35;
        $pauseButton.x = 35;
        $playButton.x = 5;
        
        $pauseButton.alpha = .5;
        
        addChild($pauseButton);
        addChild($playButton);
        
        $playButton.addEventListener(MouseEvent.CLICK, handlePlay, false, 0, true);
        
    }    
    ////////////////////////////////////////////////////////////////////////
    public function handlePlay (e:MouseEvent) : void {
        
        $playButton.removeEventListener(MouseEvent.CLICK, handlePlay);
        $pauseButton.addEventListener(MouseEvent.CLICK, handlePause, false, 0, true);
        
        $soundChannel = $sound.play($trackPosition);
        
        $playButton.alpha = .5;
        $pauseButton.alpha = 1;
        
    }
    ////////////////////////////////////////////////////////////////////////
    public function handlePause (e:MouseEvent) : void {
        
        $playButton.addEventListener(MouseEvent.CLICK, handlePlay, false, 0, true);
        $pauseButton.removeEventListener(MouseEvent.CLICK, handlePause);
        
        $trackPosition = $soundChannel.position;
        $soundChannel.stop();
        
        $playButton.alpha = 1;
        $pauseButton.alpha = .5;
    }
    ////////////////////////////////////////////////////////////////////////
    }
    
}

And the HTML code that the swf is being embedded in :


$theInner = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"400\" height=\"225\">" +
                            "<param name=\"movie\" value=\"" + $jUrlArray[0] +"/FlashSound.swf\" />" + 
                            "<!--[if !IE]>-->" +
                            "<object type=\"application/x-shockwave-flash\" data=\"" + $jUrlArray[0] +"/FlashSound.swf\" width=\"400\" height=\"225\">" +
                            "<!--<![endif]-->" +
    "<p>Your browser is not able to run HTML5 Video or embedded Flash Video.<br />It would be a good life choice to switch to a different browser.</p>" +
                            "<!--[if !IE]>-->" +
                            "</object>" +
                            "<!--<![endif]-->" +
                              "</object>";


Where the $theInner is a javascript variable that is used to set the innerHTML value of the div that I want to have containing the swf and $jUrlArray is an array of filepaths to various folders containing different sound files and thumbnails (each folder also contains the swf).

The thinking is that the swf looks for the files as “sound.mp3” so the swf would assume that file is in the same folder it is in, therefore I’m only loading the swf from the different folders.