BitmapFileMaterial 未在嵌入时加载
我使用 Flash CS5 在 Papervision3D 中构建了一个轮播,一切正常,但当它嵌入网页(本地或在线)时,BitmapFileMaterial 资源似乎无法加载。
我已经尝试了一切,就像我说的,它在本地工作,只是在嵌入时不起作用。我有什么遗漏的吗?
这是一个由多个平面组成的旋转木马。这是生成平面(并添加材质)的 AS3 代码:
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);
}
这是嵌入代码(可能是错误所在):
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您从错误的网址加载图像。
与上述方式相反,当引用的图像相对于 .css 文件时,CSS 的行为会相对于嵌入页面加载文件。
因此,当您在没有包装页的情况下运行 swf 时,它将从同一文件夹加载,但当您从上面的文件夹嵌入它时,它将从该文件夹加载图像。
因此,您需要更改 Flash 中的 url 或移动图像。
使用 Charles 或 Firebug.
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.