Code detailed attachmovie a different load

Source: Internet
Author: User
Load | difference |

1, the library has a MC, named "Ball" and connected to the first frame export. The library also has an empty MC named cont; Drag the Cont of the empty MC into the scene, take the case name Cont, and write it on the hardwood:

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, write directly on the stage on a certain 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, write on the frame directly loaded

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, create an empty MC to load

_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. Customize a function to load

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, the Library of a series of pictures loaded into the scene in the scene

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);
}
}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.