A general method of Flash8 to realize dynamic sky

Source: Internet
Author: User
Dynamic

Do you want to be a star? Just copy the code for this tutorial! First look at the effect:

Production method:

First Modify document properties: Black background, frame frequency 30fps

Create a new movie clip. Draw a small pentagram or any other graphic in the movie clip symbol! You can even make an animation yourself.

To set connection properties:

Then create a background layer and an action layer in the home scene, the background layer to make its own background, the action layer first frame put the following code:

var stars = 150;
var maxspeed = 12;
var minspeed = 6
Create and position stars
for (var i = 0; i<stars; i++) {
var star = This.attachmovie ("Star", "Star" +i, I);
star._x = random (stage.width);
star._y = random (stage.height);
var size = random (2) +0.6* (random (4));
Star._width = size;
Star._height = size;
}

This.onenterframe = function () {
for (var j = 0; j<stars; j + +) {
var s = this["star" +j];
if (s._y>0) {
S._y-= random (maxspeed-minspeed) +minspeed;
} else {
s._y = Stage.height;
}
}
};

The code above, if you are not clear, you can try to change. Can test the film!



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.