-
KoolMoves Moderator
[EXAMPLE] MiniClock using PixelScreen
A component that I overlooked until now is the pixelscreen. Here's a little example of using it to display a miniclock
Code:
import km.display.*;
var ps:PixelScreen = new PixelScreen(50,20);
addEventListener(Event.ENTER_FRAME, onFrame);
function onFrame(e:Event):void {
var now:Date = new Date();
hr=now.getHours();
if (hr<10){
hr="0"+hr;
}
min=now.getMinutes();
if(min<10){
min="0"+min;
}
sec=now.getSeconds();
if (sec<10){
sec="0"+sec;
}
ps.cls;
ps.locate(2,1);
ps.print(hr+":"+min+":"+sec);
}
addChild(ps);
ps.color(0xffffff);
box();
function box(){
for (x=3;x<=45;x++){
ps.pset(x,1);
ps.pset(x,15);
}
for (x=2;x<=15;x++){
ps.pset(3,x);
ps.pset(45,x);
}
}
-
Can you post the example.
-
Works slick. Thanks, Bret! Haven't played with PixelScreen at all.
-
KoolMoves Moderator
Bob that's it just paste the code in KM and thats it.
-
It worked.. Funny
Is there also a script to do something like this (Countdown with days & time) in KM
http://www.flashkit.com/movies/Utili...2086/index.php
-
KoolMoves Moderator
found this
var dtDate1ate = new Date(2008, 4, 1); //May 1st, 2008
var dtDate2ate = new Date(2008, 6, 20); //July 20th, 2008
var difference:uint = Math.floor(Math.abs((dtDate2.time - dtDate1.time) / 86400000));
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|