开发者

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>


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜