Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

ساخت يك كرم شب تاب

اطلاعات موضوع

Kategori Adı مباحث Flash
Konu Başlığı ساخت يك كرم شب تاب
نویسنده موضوع *JujU*
تاریخ شروع
پاسخ‌ها
بازدیدها
اولین پسند ارسالی
Son Mesaj Yazan *JujU*

*JujU*

کاربر انجمن
تاریخ ثبت‌نام
Nov 6, 2013
ارسالی‌ها
2,786
پسندها
394
امتیازها
83
محل سکونت
تهران
تخصص
فکر کردن به چیزایی که دیگران ساده ازش رد میشن
دل نوشته
هر روز معجزه است اگر به خدا ایمان بیاوریم..

اعتبار :

يك دايره ساده در اندازه 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));
}




در اين آموزش مي توانيد به جاي دايره، عكسي را Import كنيد و مراحل اين آموزش را به ترتيب انجام دهيد.

منبع:
pnu-club.com
 
بالا پایین