create a new file and go to document properties. Adjust the properties as shown below:
Using oval tool draw a star. We can magnify and draw as we have to draw small one. Then goto Modify>Convert To Symbol and name it “Star”. Registration should be center.
Then click on the star and again convert it to symbol. Name it “Starfield”. Registration should be center as in the image.
Double click on the “Starfield” movieclip. Now we can work inside it.
Click on the star there and type its instance name “star” on its properties tab and also make the x and y both “0″ to bring it to the edge.
Now we are going to create the area where the star will be generated by the code. For this we are going to create a plus sign. Remember we are still working inside the movieclip “Starfield”. Now draw a verticle line and make its height equal to 200 as the height of the document itself. For this you can directly type in its properties. Click it and type in the properties tab as in the image. Here we will position it by correcting the x and y also.
Similarly draw a horizontal line and type in its properties as in the image below:
Draw a third line now, vertical and modify its properties as before.
Finally a fourth line and its properties.
Now we can see a plus sign is formed.
Select all the four lines and convert to symbol. Name it “Centerlines” and registration is center again.
Goto its properties and type its instance name “centerlines”.
Now we wanna come out of the “Starfield” movie clip. For this click on “scene 1″ .
Now click the “Starfield” movieclip and convert it to symbol again. Name it “Stars”.
Double click on “Stars” movieclip. Now we are gonna work inside it.
Right click on the Layer 1 and Click on “Insert Layer”.
Now on this new layer i.e Layer 2, using a Rectangle Tool, draw a rectangle and modify its size and position from the properties.
Now right click on Layer 2 and Click on “Mask”.
Now right click on the first frame of the Layer 1 and click on “Actions”.
Now copy the following code on the actions window:
starfield.centerlines._visible = 0;
x=starfield._width/2
y=starfield._height/2
initx = starfield._x;
inity = starfield._y;
_root.onEnterFrame = function() {
with (starfield) {
_x += 0;
_y += 2;
if (_x>initx+x) {
_x = initx;
}
if (_xinity+y) {
_y = inity;
}
if (_y Close the actions tab. And click on “Scene 1″ to get back from the “Stars” movieclip.
Press Ctrl+Enter for the result.
If you wanna change the speed or direction of the whole stars then you wanna try changing the values for the _x and _y on the code which are just after “with (starfield) {“.
Now we are done. If you have any problems doing this then feel free to comment. Enjoy flash
x=starfield._width/2
y=starfield._height/2
initx = starfield._x;
inity = starfield._y;
_root.onEnterFrame = function() {
with (starfield) {
_x += 0;
_y += 2;
if (_x>initx+x) {
_x = initx;
}
if (_x
_y = inity;
}
if (_y
Press Ctrl+Enter for the result.
If you wanna change the speed or direction of the whole stars then you wanna try changing the values for the _x and _y on the code which are just after “with (starfield) {“.
Now we are done. If you have any problems doing this then feel free to comment. Enjoy flash
No comments:
Post a Comment