flash素材、flash片头、flash特效、flash源码,flash相册等flash资源都是本站的重要flash素材请大家支持新丁flash素材网!
首页 | 片头欣赏 | Banner 欣赏 | Flash 特效 | 网站欣赏 | 黄色笑话 | 技术文档 | 视频教程 | 网页模板 | flash小游戏 | 源码下载 | 相关下载 | 声音下载 |
flash Action应用 您当前的位置是:首页 >> 技术文档 >> flash Action应用 >> 详细内容
代码详解attachMovie有区别的加载
加入时间:2007-10-4 浏览:29 录入:启能Flash资源网 来源:网络
1、库中有一个MC,名为“ball”并连接为第一桢导出。库中还有一个空的mc名为cont;将空的MC   的cont拖入场景,并给它取事例名cont,在桢上写:

for (i=0; i<10; i++) {
 _root.cont.attachMovie("ball", "ball"+i, i);
 _root.cont["ball"+i]._x = 50+40*i;
 _root.cont["ball"+i]._y = 200;
}

2、直接写在舞台上的某一个MC上

onClipEvent (load) {
 for (i=0; i<10; i++) {
  this.attachMovie("ball", "ball"+i, i);
  this["ball"+i]._x = 50+40*i;
  this["ball"+i]._y = 200;
 }

3、写在桢上直接加载

for (i=0; i<10; i++) {
 this.attachMovie("ball", "ball"+i, i);
 this["ball"+i]._x = 50+40*i;
 this["ball"+i]._y = 200;
}

4、创建一个空的MC来加载

_root.createEmptyMovieClip("kong", 1);
for (i=0; i<10; i++) {
 _root.kong.attachMovie("ball", "ball"+i, i);
 _root.kong["ball"+i]._x = 50+40*i;
 _root.kong["ball"+i]._y = 200;
}

5、自定义一个函数来加载

function Bal() {
 for (i=0; i<10; i++) {
  this.attachMovie("ball", "ball"+i, i);
  this["ball"+i]._x = 50+40*i;
  this["ball"+i]._y = 200;
 }
}
Bal();

6、将库中的一系列图片加载到场景中在场景中

on (release) {
 _root.zhuye._visible = 0;
 for (n=0; n<6; n++) {
  this.attachMovie("picture", "picture"+n, n+1);
  this["picture"+n].gotoAndStop(n+1);
  this["picture"+n]._x = 100+150*(n-Math.floor(n/3)*3);
  this["picture"+n]._y = 100+150*Math.floor(n/3);
 }
}

关于我们 | 联系方式 | 广告赞助 | 免责声明 | 站点留言 | 友情链接 | 推荐站点
Copyright 2007-2008 新丁flash资源(flash素材)网 All Rights Reserved
新丁flash资源(flash素材)网 保留所有权利 未经许可请勿任意转载或复制使用 
请使用1024*768分辨率浏览本站以达到浏览新丁flash资源(flash素材)网的最佳视觉效果
新丁flash资源(flash素材)网中所有的解压密码均为:www.qnflash.com
粤ICP备08010396号