Ilm va ziyo > Dasturlash

ActionScript namunalari va natija fayllari

(1/2) > >>

Usmon:
Assalomu aleykum!Bu mavzuda o'zimiz tuzgan yoki bizga ma'lum bo'lgan ActionScript (Adobe Flash) namunalari va natija fayllarini joylashtiramiz.

Usmon:
http://my-files.ru/Clock_analog.swf
      Analog soat

ActionScript kodi:

--- Kod: ---function drawArrow(s, c, i, t, d) {
this.createEmptyMovieClip("mc"+i, d);
this["mc"+i].lineStyle(s, c, 100);
this["mc"+i].moveTo(0, 0);
this["mc"+i].lineTo(0, t);
this["mc"+i]._x = Stage.width/2;
this["mc"+i]._y = Stage.height/2;
}
drawArrow(1, 0x0000ac, 1, -90, 1);
drawArrow(4, 0xd20200, 2, -90, 2);
drawArrow(6, 0x0000ac, 3, -70, 3);
onEnterFrame = function () {
var clock:Date = new Date();
H = clock.getHours();
M = clock.getMinutes();
S = clock.getSeconds();
mc3._rotation = (H*3600+M*59+S)/120;
mc2._rotation = (M*60+S)/10;
mc1._rotation = S*6;
};
--- End code ---

Kod 1-kadrga ilinishi kifoya.
Manba: www.metoart.ru (kod farq qilishi mumkin)

Usmon:
Mana yana bitta soat, faqat bu safar elektron quartz :D:

http://my-files.ru/Clock_elektron.swf

Quyidagi kod 1-kadrga ilinadi:


--- Kod: ---time = new Date(); //joriy vaqtni oladi
ht = time.getHours(); // ht o'zgaruvchisiga joriy soatni yuklaydi
mt = time.getMinutes(); // mt o'zgaruvchisiga joriy minutni yuklaydi
st = time.getSeconds(); // st o'zgaruvchisiga joriy sekundni yuklaydi
if (st < 10) {st = "0"+st
}
if (mt < 10) {mt = "0"+mt
}
if (ht < 10) {ht = "0"+ht
} // agar soat, minut, yoki sekund sonlari 10dan kichik bo'lsa, ular yoniga "0" qo'yadi
showtime = ht+":"+mt+":"+st;  // vaqtni ko'rsatadi
--- End code ---

Shu bilan birga 1 kadrga fon va Dinamic text matn oynasi qo'yiladi. Bu oyna Properties (xususiyatlari) bo'limida Variable (o'zgaruvchisiga)ga "showtime"(qo'shtirnoqsiz) nomi beriladi.
Ikkinchi kadrga esa


--- Kod: ---gotoAndPlay(1);
--- End code ---

kodi ilinadi.
Va mo'jazgina quartz soat hosil bo'ladi.... ;D

Mana bu yerda Flashni o'rganamiz: http://forum.ziyouz.com/index.php?topic=2043.0

boburiy:
yangilarini kutib qolamiz!!!

Usmon:
Hammayoq soat bo'p ketdi o'ziyam.  :11
Mana bu soatda yuqoridagisidan farqli tomoni bor. Unda sekund ko'rsatkichi har sekundda emas millisekundda yuradi. Demakki, silliq harakatlanadi

http://my-files.ru/clwz_new_super.swf

Kodi ham birgina joyda farq qiladi. Siferblat  esa ClocX dasturidan olingan :D

Mana kodi:


--- Kod: ---function drawArrow(s, c, i, t, d) {
this.createEmptyMovieClip("mc"+i, d);
this["mc"+i].lineStyle(s, c, 100);
this["mc"+i].moveTo(0, 0);
this["mc"+i].lineTo(0, t);
this["mc"+i]._x = Stage.width/2;
this["mc"+i]._y = Stage.height/2;
}
drawArrow(3, 0x990000, 2, -53, 2);
drawArrow(5.5, 0xFF9900, 3, -42, 3);
drawArrow(1, 0xFFFFFF, 1, -55, 1);
onEnterFrame = function () {
var clock:Date = new Date();
H = clock.getHours();
M = clock.getMinutes();
S = clock.getSeconds();
MS = clock.getMilliseconds();
mc3._rotation = (H*3600+M*59+S)/120;
mc2._rotation = (M*60+S)/10;
mc1._rotation = S*6 + MS/160;
};
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version