Autor | Zpráva | ||
---|---|---|---|
8andrej8 Profil * |
#1 · Zasláno: 20. 5. 2010, 19:04:52
Zdravim, potreboval by som prelozit tento jednoduchy AS3 kod do AS2, pise mi len par chyb typu:
The class or interface 'Timer' could not be loaded. The class or interface 'MouseEvent' could not be loaded. tu je kod: var count:Number = 60; var count2:Number = 60; var count3:Number = 60; var count4:Number = 60; var myTimer:Timer = new Timer(1000,count); var myTimer2:Timer = new Timer(1000,count2); var myTimer3:Timer = new Timer(1000,count3); var myTimer4:Timer = new Timer(1000,count4); var clocks:Number = 1; myText_txt.text = String(count); n2_mc.visible = false; n3_mc.visible = false; n4_mc.visible = false; add2_btn.visible = false; add3_btn.visible = false; add_btn.addEventListener(MouseEvent.CLICK, startClock2); add2_btn.addEventListener(MouseEvent.CLICK, startClock3); add3_btn.addEventListener(MouseEvent.CLICK, startClock4); start_btn.addEventListener(MouseEvent.CLICK, startAllClock); stop_btn.addEventListener(MouseEvent.CLICK, stopClock); reset_btn.addEventListener(MouseEvent.CLICK, resetClock); myTimer.addEventListener(TimerEvent.TIMER, countdown); function startAllClock(event:MouseEvent):void { switch (clocks) { case 1: myTimer.start(); break; case 2: myTimer.start(); myTimer2.start(); case 3: myTimer.start(); myTimer2.start(); myTimer3.start(); case 4: myTimer.start(); myTimer2.start(); myTimer3.start(); myTimer4.start(); default: myTimer.start(); break; } } function startClock2 (event:MouseEvent):void { myTimer2.start(); myTimer2.addEventListener(TimerEvent.TIMER, countdown2); n2_mc.visible = true; add_btn.visible = false; add2_btn.visible = true; clocks = 2; } function startClock3 (event:MouseEvent):void { myTimer3.start(); myTimer3.addEventListener(TimerEvent.TIMER, countdown3); n3_mc.visible = true; add2_btn.visible = false; add3_btn.visible = true; clocks = 3; } function startClock4 (event:MouseEvent):void { myTimer4.start(); myTimer4.addEventListener(TimerEvent.TIMER, countdown4); n4_mc.visible = true; add3_btn.visible = false; clocks = 4; } function countdown(t:TimerEvent):void { myText_txt.text = String((count)-myTimer.currentCount); } function countdown2(t:TimerEvent):void { myText2_txt.text = String((count2)-myTimer2.currentCount); } function countdown3(t:TimerEvent):void { myText3_txt.text = String((count3)-myTimer3.currentCount); } function countdown4(t:TimerEvent):void { myText4_txt.text = String((count4)-myTimer4.currentCount); } function stopClock(event:MouseEvent):void { myTimer.stop(); myTimer2.stop(); myTimer3.stop(); myTimer4.stop(); } function resetClock(event:MouseEvent):void { myTimer.reset(); myTimer2.reset(); myTimer3.reset(); myTimer4.reset(); myText_txt.text=String(count); myText2_txt.text = ""; myText3_txt.text = ""; myText4_txt.text = ""; clocks = 1; n2_mc.visible = false; n3_mc.visible = false; n4_mc.visible = false; add_btn.visible = true; add2_btn.visible = false; add3_btn.visible = false; } |
||
DoubleThink Profil * |
#2 · Zasláno: 20. 5. 2010, 19:23:21
Nepůjde to tak snadno. Základem je zde objekt Timer, který v AS2 neexistuje a nemá ani ekvivalent.
Bude potřeba změnit logiku ovládání pro starší funkce setInterval respektive setTimeout. |
||
8andrej8 Profil * |
#3 · Zasláno: 21. 5. 2010, 12:10:25
ok tak nic, dakujem
|
||
VXC008 Profil * |
#4 · Zasláno: 21. 5. 2010, 15:15:17
Nedekuj, nemas za co.
|
||
Časová prodleva: 14 let
|
0