PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : آموزشی ساخت يك كرم شب تاب!



آبجی
28th May 2010, 01:05 AM
يك دايره ساده در اندازه 5x5px رسم نماييد و درون آن را با رنگ زرد پر كنيد حال با كليك بر روي آن و رفتن به مسير Insert> Convert to symbol و يا فشار دادن كليد F8 آن را به مووي كليپ (Movie Clip) تبديل كنيد. كتابخانه (F11) را باز كنيد و بر روي مووي كليپ راست كليك كنيد و گزينه linkage را انتخاب كنيد. گزينه Export for Actionscript و Export on first frame را انتخاب و نام fly را به جاي Symbol 1 تايپ نماييد.

با كليك بر روي دايره، مووي كليپ را انتخاب و كد زير را در قسمت Actions بريزيد.





function Fly(x, y){
this.x = x;
this.y = y;
this.init();
}
Fly.prototype.init = function(){
this.mc = _root.attachMovie( "fly", "f"+d, d); //setup ‘linkage’
d++; //increment variable that mandates depth
this.mc._x = this.x; //set x position
this.mc._y = this.y; //set y postion
this.mc.obj = this; //setup linkage from mc to object
this.mc.angle = -1.55;
this.mc.onEnterFrame = function(){
this.a += (Math.random() * .1)- .05;
this.a*= .90;
this.angle += this.a;
ywave = Math.sin(this.angle)*2;
xwave = Math.cos(this.angle)*5;
this.obj.y += ywave;
this.obj.x += xwave;
this._x = this.x+this.obj.x;
this._y = this.y+this.obj.y;
//using x and y for shortcuts for the if test
x = this._x;
y = this._y;
if(x>Stage.width || x<-this._width*3 || y>Stage.height || y<-this._height){
delete this.onEnterFrame;
delete this.obj;
removeMovieClip(this);
ff = new Fly(-10, random(350));
}//end if
var temp = random(15);
if(temp == 0){
if(this.off == true){
this._alpha = 70;
this.off = false;
}else{
this._alpha = 15;
this.off = true;
}//end else
}//end if
}//end OEF
}//end method
for(a = 0; a<= 10; a++){
bleh = new Fly(-10, random(350));
}

استفاده از تمامی مطالب سایت تنها با ذکر منبع آن به نام سایت علمی نخبگان جوان و ذکر آدرس سایت مجاز است

استفاده از نام و برند نخبگان جوان به هر نحو توسط سایر سایت ها ممنوع بوده و پیگرد قانونی دارد