PDA

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



Aminneo
26-07-2006, 16:00
منبع:سايت شايگان

يك دايره ساده در اندازه 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 كنيد و مراحل اين آموزش را به ترتيب انجام دهيد.

Aminneo
26-07-2006, 16:00
سوال داشتيد بگيد!

Elfin-D
27-07-2006, 00:43
سلام
عکسها مشکل داره
لطفا چک کنید
لطفا کد ها رو در تگ کد قرار بدید
مرسی

Aminneo
27-07-2006, 12:45
بابا عكس نداشت!باشه كدها رو هم از اين به بعد!(عكس گريه)

Elfin-D
27-07-2006, 18:11
سلام
sorry
مرسی از لطفت

H2O2
29-08-2006, 10:30
مرسي اقا امين
سورسشون نداري؟

Aminneo
29-08-2006, 13:55
سورس كه نمي خواد!

Aminneo
31-03-2007, 22:05
بعضی مطالبو از زیر خاک میکشم بیرون!چون اعضا تازه وارد هم ببینن!
با اجازه شاهین جان