A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [EXAMPLE] MiniClock using PixelScreen

  1. #1
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    [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);
    		}
    }

  2. #2
    Super Moderator
    Join Date
    Jun 2000
    Posts
    3,512
    Can you post the example.

  3. #3
    Member
    Join Date
    Dec 2005
    Location
    Utah
    Posts
    98
    Works slick. Thanks, Bret! Haven't played with PixelScreen at all.

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Bob that's it just paste the code in KM and thats it.

  5. #5
    Junior Member
    Join Date
    Jan 2009
    Location
    Amsterdam
    Posts
    20
    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

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center