webstudio Forums

webstudio Forums (http://www.webstudio.com.cn/forum/index.php)
-   flash网站建设技术精粹 (http://www.webstudio.com.cn/forum/forumdisplay.php?f=26)
-   -   第四章中平铺可缩放的底纹背景问题 (http://www.webstudio.com.cn/forum/showthread.php?t=3442)

whitebud 2009-10-01 01:14 AM

第四章中平铺可缩放的底纹背景问题
 
我将该范例代码改为通过代码创建背景后,怎么不需要侦听就能出来效果呢?在代码中测试新建的背景元件的宽度为2500,这是什么原因?:confused::confused::confused:急盼老师以及各位高手能解释一下!代码如下,链接的图片名为pic:


Stage.align = "TL";
Stage.scaleMode = "noScale";

createEmptyMovieClip("background_mc",0);
var temp:MovieClip = background_mc.attachMovie("pic", "pic1", 0);

var tw:Number = temp._width;
var th:Number = temp._height;
var nw:Number = Math.ceil(Stage.width/tw);
var nh:Number = Math.ceil(Stage.height/th);
removeMovieClip(temp);
for (var i:Number = 0; i<tw; i++) {
for (var j:Number = 0; j<th; j++) {
var img:MovieClip = background_mc.attachMovie("pic", "pic"+i, background_mc.getNextHighestDepth());
img._x = tw*i;
img._y = th*j;
}
}
trace(background_mc._width)


所有时间均为格林尼治时间 +9。现在的时间是 08:04 PM

Powered by vBulletin® 版本 3.8.3
版权所有 ©2000 - 2020,Jelsoft Enterprises Ltd.
增强包 [3.4] 制作: PHP源动力   官方中文站: vBulletin 中文
copyright by webstudio.com.cn. All Rights Reserved.