wee mei this is for you. if your class anyone of them dont have the script can ask them to copy from here too :)
1. create one movie clip for eg: music_chord_mc.
2. double click on the mc. inside create a few object, one in each frame. i used 3 frames.
3. put it on the stage
4. name those instance. i will name it 'music_chord_mc' and 'music_chord_mc1'. it can be different names too
you can remove all // (instructions) if you think it is too messy on your script.
----
//begin here: as on main stage, i put two items here for you.
stop();
//this part is to make the object appear random first before appearing. if not all your same duplicate mc will come out same object the first time.
//ok this figure u must get it right. if total frame in the mc is 3 then you get this *2+1, if you have 5 frames then you put *4+1. this and the bottom do not need to be the same mc. but mine is the same mc, different instance. so i just change the instance name only.
//add more lines here if you have more objects
music_chord_mc.gotoAndStop(Math.round(Math.random() * 2+1));
music_chord_mc1.gotoAndStop(Math.round(Math.random() * 2+1));
//these few var are for all the random images.
var top_Y:Number=-30;
//meaning i want object to appear -30 above the screen. it depends how tall your images is
var btm_Y:Number=900;
//make this figure slightly more than your document size height, so that the whole image will disappear before it appears again
var speed:int=5;
//the speed set
function moveChords(e:Event) {
// moveChords can name any name, just make sure you put the same name at the end
//your first random object. name it here according to how you name the instance. everything after if it when preparing for the random before coming into the screen
if (music_chord_mc.y>=btm_Y) {
music_chord_mc.y=top_Y;
music_chord_mc.scaleX=Math.random() *1+0.5; //0.5~1.5 .all the first number like 1, 360 is the original size. if you want to change, you change the second number after the + or -
music_chord_mc.scaleY=music_chord_mc.scaleX; //following the scale of X
music_chord_mc.rotation=Math.random()*360-180; // -180~180, so that it doesnt turn more than 1 round, this rotation is for when it appears. this does not make the image rotate on stage. it just appears rotated but stay the same thruout
music_chord_mc.alpha=Math.random()*1+0.2; //0.2~1 // is for transparency, if you do not want your image transparent, remove this
music_chord_mc.gotoAndStop(Math.round(Math.random() * 2+1)); // this is to make the next image appear randomly
} else {
music_chord_mc.y+=speed; //everything after 'else' is what you want to see happen on stage. like below rotation on stage
music_chord_mc.rotation-=1;
}
//your second random object, add more if you need.
if (music_chord_mc1.y>=btm_Y) {
music_chord_mc1.y=top_Y;
music_chord_mc1.scaleX=Math.random()*1+0.7; //0.7~1.7 different from top
music_chord_mc1.scaleY=music_chord_mc1.scaleX;
music_chord_mc1.rotation=Math.random()*360-180;
music_chord_mc1.alpha=Math.random()*1+0.2;
music_chord_mc1.gotoAndStop(Math.round(Math.random() * 2+1));
} else {
music_chord_mc1.y+=speed;
}
this is the same thing... but i dont want the object to rotate on stage so i remove that here. i make changes to some of the random so that it doesnt all appear the same.
//this is the closing of it. any mc or instance you add, just add in the middle before this line.
}
this.addEventListener(Event.ENTER_FRAME, moveChords);
Tuesday, June 2, 2009
Subscribe to:
Post Comments (Atom)
3 comments:
thx chai yen, it's so nice!
i told others d.
thank you Chai Yen
chai yen!!! HIIIIIIIII
yay found your blog
you don't update huh :D
Post a Comment