Dan Hanly
Dan Hanly

Reputation: 7839

BitmapFileMaterial not loading on embed

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>

Upvotes: 0

Views: 276

Answers (1)

grapefrukt
grapefrukt

Reputation: 27045

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.

Upvotes: 1

Related Questions