views:

16

answers:

1

Hi Guys,

I've built a carousel in Papervision3D using Flash CS5, everything works fine but when it's embedded in a web-page (local or online) the BitmapFileMaterial assets don't seem to load.

I've tried everything and like I said, it works locally, just not when it's embedded. Is there something I'm missing?

It's a carousel made up of a number of planes. Here's the AS3 code that generates the planes (and adds the material):

for (var i:int = 0; i < numItems; i++)
        {
            var plane:Plane = new Plane(new BitmapFileMaterial("images/file" + i + ".jpg"),150,225,0,0);
            planes.push(plane);
            //Add plane to the scene
            planesHolder.addChild(plane);
        }

Here's the embed code (probably where the error is):

<object width="160" height="400" align="middle">
<param name="movie" value="flash/spinner.swf">
<embed src="flash/spinner.swf" width="160" height="400">
</embed>
</object>
+1  A: 

You are loading your images from the wrong url.
Contrary to the way say, CSS behaves when an image referenced is relative to the .css file Flash loads files relative to the embedding page.

So, when you run your swf without the wrapping page it'll load from the same folder, but when you embed it from a folder above it will load the image from that folder instead.
Thus, you need to either change the url in your Flash or move your image.

Bugs like these are very easy to find using something like Charles or Firebug.

grapefrukt
I've added my code. I suspect it's an issue with the actual embedding code, as there seems to only be a problem when it's embedded.
Daniel Hanly
i've updated my answer, not sure if you get notified about that unless i comment here too
grapefrukt
cheers mate, that was the error right on the money :) I assumed that when you embed a SWF it still retains any paths to external resources. My directory structure had 2 folders flash inside that was images. I thought that because I'd embedded the file, the root would be where the SWF is stored, not where the HTML is stored. You've taught me a lot with this problem, cheers.
Daniel Hanly