I continue to actively explore the stick, and in this article I give an example of a clock with ActionScript 3. First we need to create a fla and a package for him Clock which create a class ,which will be described in the language of the entire executive ActionScript code. To initialize the class Document Properties indicate a class that will start when opening a document clock.
This entry indicates that the class located in the clock. The folder structure I get the following:
1 2 3
|
-CreatedClock.fla -clock --ClockName.as
|
At first, create a circle of 100X100 pixels that will be moved, our arrow. Format range does not matter, let it be a normal bitmap.



1 2 3 4 5 6
|
package clock { import flash.display.*; import flash.events.*; import flash.utils.*; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13
|
public class ClockName extends MovieClip { var clockTime:Timer; public function ClockName() { clockTime = new Timer(1000,30); StartTime.addEventListener(MouseEvent.CLICK, clicknow); clockTime.addEventListener(TimerEvent.TIMER,movearrow); clockTime.addEventListener(TimerEvent.TIMER_COMPLETE,endmove); } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
public function clicknow(e:MouseEvent) { start(); trace(+delay); trace(+) trace(+running) visible=false; } public function (e:TimerEvent) { rotationrotation+12; trace(+); } public function endmove(e:TimerEvent) { visible=true; reset(); stop(); }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
package clock { import flash.display.*; import flash.events.*; import flash.utils.*; public class extends MovieClip { var :Timer; public function () { new Timer(1000,30); addEventListener(MouseEvent.CLICK); addEventListener(TimerEvent.TIMER); addEventListener(TimerEvent., Endmove); } public function clicknow(e:MouseEvent) { start(); trace(+delay); trace(+) trace(+running) visible=false; } public function (e:TimerEvent) { rotationrotation+12; trace(+); } public function endmove(e:TimerEvent) { visible=true; reset(); stop(); } } }
|
link.