在 AS2 的 MovieClip 中加载一系列多个 Swf
我正在尝试将一系列外部 Swf 加载到舞台上的 Movieclip 中。 swf 的尺寸为 800 x 600,而容器的尺寸为 400 x 400。
每当我尝试将外部 swf 加载到容器中时,容器都会采用加载的 swf 的大小,而不是 400 x 400。我该如何克服这个问题?
我希望加载到容器中的任何 swf 都是 400 x 400
我正在使用以下代码:
var movLoad:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadInit = function(thisMc:MovieClip) {
thisMc._height = 400;
thisMc._width = 400;
};
movLoad.addListener(myListener);
btnNext.onPress = function()
{
loadSwf("myswf_file1.swf");//will change name accordingly.
}
function loadSwf(swf)
{
movLoad.loadClip(swf, container_mc);
// myswf1.swf is a swf which could be of any size .
// container_mc is movieclip on stage.
//container_mc has dimension 400 x 400
}
thx 阿米特
Im trying to load series of external Swfs into a Movieclip on stage.
The swf are 800 x 600 in dimension whereas as the container is 400 X 400.
Whenever i try to load the external swf in the container,the container takes the size of the loaded swf instead of 400 x 400 .How can i overcome this?
I want to any swf loaded into the container to be 400 x 400
I'm using the following code :
var movLoad:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadInit = function(thisMc:MovieClip) {
thisMc._height = 400;
thisMc._width = 400;
};
movLoad.addListener(myListener);
btnNext.onPress = function()
{
loadSwf("myswf_file1.swf");//will change name accordingly.
}
function loadSwf(swf)
{
movLoad.loadClip(swf, container_mc);
// myswf1.swf is a swf which could be of any size .
// container_mc is movieclip on stage.
//container_mc has dimension 400 x 400
}
thx
amit
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑(新答案):
我认为问题在于您加载的 swf 保留了先前的
_xscale
和_yscale
容器_mc 属性。如果您尝试在container_mc是空剪辑时设置
container_mc._width
和._height
,那么Flash(奇怪地)会将其比例更改为零 - 当您的swf加载时,它也会比例为零,因此设置_width
和_height
无效。您可以使用
trace("scale = "+thisMc._xscale+" x "+thisMc._yscale);
进行测试。修复方法是首先将一些内容放入 container_mc(例如 400x400 的正方形)中。您可以隐藏它,直到您的 swf 加载。
EDIT (new answer):
I think the problem is that your loaded swf retains the previous
_xscale
and_yscale
properties of container_mc.If you tried to set
container_mc._width
and._height
when container_mc was an empty clip, then flash (bizarrely) changes it's scale to zero - when your swf loads, it also has zero scale, so setting the_width
and_height
has no effect.You could test this with
trace("scale = "+thisMc._xscale+" x "+thisMc._yscale);
The fix would be to put something into container_mc (say a 400x400 square) initially. You could hide it until your swf loads.