Making a clock with hand pointers

Hello macromedia flashers.
im thinking of making a simple clock design and adding hand pointers that tell the time.but im no action script fan and i have a few questions to ask.
a)how hard is it to add action script to the hand pointers?
b)can i use the clock on my desktop to show time?
Thank you.

The difficulty of the task is dependent your ability and knowledge of using Flash.  In general it is not that difficult, but you need to become familiar with a variety of code to get it working such as the Date class and movieclip rotation property controls.  You should search Google using terms like "Flash analog clock tutorial"
You can open/play an swf file on your monitor.

Similar Messages

  • Making a Clock

    I am trying to make an analog clock with java and it would be easy except for the fact that I can't figure out how to convert the position of the hands to coordinates without using 60+ if statements (or switch for that matter). Isn't there a simple way to do this? Just give me an idea of how to do it and I will toy with it until I either go out of my mind or maybe even figure it out.
    here is the code I have so far:
    (note: to most of you experienced programmers, it probably looks like something the cat dragged in.)
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    public class ClockPane extends JPanel implements Runnable {
        MouseTracker track = new MouseTracker(this);
        int secHandX = 30;
        int secHandY = 145;
        int secHandXmove = 5;
        int secHandYmove = 5;
        Thread runner;
        Image secHand;
        JTextField field = new JTextField(15);
        int second;
        int minute;
        int hour;
        String secondString;
        String minuteString;
        String hourString;
        String twelve = ("12");
        String three = ("3");
        String six = ("6");
        String nine = ("9");
        String currentTime;
        String amPM;
        Font Big = new Font("veranda", Font.BOLD, 16);
        public ClockPane() {
         super();
         add(field);
         addMouseListener(track);
         addMouseMotionListener(track);
         field.setEditable(false);
         field.addMouseMotionListener(track);
         field.addMouseListener(track);
         Toolkit kit = Toolkit.getDefaultToolkit();
         secHand = kit.getImage("secHand.png");
         runner = new Thread(this);
         runner.start();
        public void paintComponent(Graphics comp) {
         Graphics2D comp2D = (Graphics2D) comp;
         if (secHand != null) {
             BasicStroke five = new BasicStroke((float) 5, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
             BasicStroke tick = new BasicStroke((float) 5);
             comp2D.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
             comp2D.setColor(Color.white);
             comp2D.fillRect(0, 0, 350, 350);
             comp2D.setColor(Color.red);
             comp2D.setStroke(five);
             comp2D.drawLine(130, 145, secHandX, secHandY);
             comp2D.setColor(Color.black);
             comp2D.drawOval(10, 25, 240, 240);
             comp2D.drawOval(30, 45, 200, 200);
             comp2D.setFont(Big);
             comp2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
             comp2D.drawString(three, 235, 152);
             comp2D.setStroke(tick);
             comp2D.drawLine(245, 145, 250, 145);
             comp2D.drawString(currentTime, 85, 297);
        public void run() {
         Thread thisThread = Thread.currentThread();
         while (runner == thisThread) {
             Calendar time = Calendar.getInstance();
             second = time.get(Calendar.SECOND);
             hour = time.get(Calendar.HOUR);
             minute = time.get(Calendar.MINUTE);
             secondString = ("" + second);
             if (second < 10) {
              secondString = ("0" + second);
             minuteString = ("" + minute);
             if (minute < 10) {
              minuteString = ("0" + minute);
             hourString = ("" + hour);
             if (hour < 10) {
              hourString = ("0" + hour);
             if (time.get(Calendar.AM_PM) == 0) {
              amPM = ("AM");
             if (time.get(Calendar.AM_PM) == 1) {
              amPM = ("PM");
             if (second == 0) {
              secHandX = 130;
              secHandY = 45;
             if (second == 15) {
              secHandX = 230;
              secHandY = 145;
             if (second == 30) {
              secHandX = 130;
              secHandY = 245;
             if (second == 45) {
              secHandX = 30;
              secHandY = 145;
             if (second == 8) {
              secHandX = 200;
              secHandY = 75;
             currentTime = (hourString + ":" + minuteString + ":" + secondString + " " + amPM);
             repaint();
             try {
                    Thread.sleep(10);
             } catch (InterruptedException e) {
                 //do nothing
        }(another note: the MouseTracker object is just something I added so that I don't spend a million years trying to find the correct coordinates)
    Edited by: fireball_nelson on Feb 15, 2008 8:44 AM
    Edited by: fireball_nelson on Feb 15, 2008 8:51 AM

    import java.awt.*;
    import java.awt.geom.*;
    import java.util.Calendar;
    import javax.swing.*;
    public class ClockPaneRx extends JPanel implements Runnable {
        Thread runner;
        String currentTime;
        public ClockPaneRx() {
            super();
            runner = new Thread(this);
            runner.start();
        AffineTransform secTrans  = new AffineTransform();
        AffineTransform minTrans  = new AffineTransform();
        AffineTransform hourTrans = new AffineTransform();
        AffineTransform clockPos  = new AffineTransform();
        protected void paintComponent(Graphics comp) {
            Graphics2D comp2D = (Graphics2D) comp;
            int w = getWidth();
            int h = getHeight();
            comp2D.setColor(Color.white);
            comp2D.fillRect(0, 0, w, h);
            Font Big = new Font("veranda", Font.BOLD, 16);
            BasicStroke five = new BasicStroke(5f, BasicStroke.CAP_ROUND,
                                                   BasicStroke.JOIN_BEVEL);
            comp2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                    RenderingHints.VALUE_ANTIALIAS_ON);
            clockPos.setToTranslation(w/2, h/2);
            comp2D.setColor(Color.black);
            comp2D.setFont(Big);
            comp2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                                    RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            comp2D.translate(w/2, h/2);
            comp2D.drawString(currentTime, -45, 150);
            comp2D.drawString("1", 48, -85);
            comp2D.drawString("2", 87, -47);
            comp2D.drawString("3", 105, 7);
            comp2D.drawString("4", 90, 60);
            comp2D.drawString("5", 50, 100);
            comp2D.drawString("6", -4, 115);
            comp2D.drawString("7", -60, 98);
            comp2D.drawString("8", -97, 60);
            comp2D.drawString("9", -110, 5);
            comp2D.drawString("10", -99, -48);
            comp2D.drawString("11", -60, -87);
            comp2D.drawString("12", -10, -100);
            comp2D.setStroke(five);
            comp2D.drawOval(-120, -120, 240, 240);
            Line2D.Double secHand = new Line2D.Double(0, 0, 0, -95);
            Line2D.Double minHand = new Line2D.Double(0, 0, 0, -85);
            Line2D.Double hourHand = new Line2D.Double(0, 0, 0, -75);
            Shape minHand2 = minTrans.createTransformedShape(minHand);
            Shape secHand2 = secTrans.createTransformedShape(secHand);
            Shape hourHand2 = hourTrans.createTransformedShape(hourHand);
            comp2D.setColor(Color.red);
            comp2D.draw(secHand2);
            comp2D.setColor(Color.blue);
            comp2D.draw(minHand2);
            comp2D.setColor(Color.black);
            comp2D.draw(hourHand2);
            comp2D.fillOval(-6, -6, 12, 12);
        public void run() {
            String secondString;
            String minuteString;
            String hourString;
            String amPM = "";
            Thread thisThread = Thread.currentThread();
            while (runner == thisThread) {
                Calendar time = Calendar.getInstance();
                int second = time.get(Calendar.SECOND);
                int hour = time.get(Calendar.HOUR);
                int minute = time.get(Calendar.MINUTE);
                secondString = ("" + second);
                if (second < 10) {
                    secondString = ("0" + second);
                minuteString = ("" + minute);
                if (minute < 10) {
                    minuteString = ("0" + minute);
                hourString = ("" + hour);
                if (hour < 10) {
                    hourString = ("0" + hour);
                if (time.get(Calendar.AM_PM) == 0) {
                    amPM = ("AM");
                if (time.get(Calendar.AM_PM) == 1) {
                    amPM = ("PM");
                double secAngle  = second / 30.0 * Math.PI;
                double minAngle  = minute / 30.0 * Math.PI;
                double hourAngle = hour   /  6.0 * Math.PI;
                secTrans.setToRotation(secAngle);
                minTrans.setToRotation(minAngle);
                hourTrans.setToRotation(hourAngle);
                currentTime = hourString + ":" + minuteString + ":" +
                              secondString + " " + amPM;
                repaint();
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    //do nothing
        public static void main(String[] args) {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new ClockPaneRx());
            f.setSize(400,400);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • I'm making a DVD with my iMOVIE and when I tried to burn a DVD I got an error message that said "ERROR IN PROJECT

    I'm making a DVD with my iMOVIE and when I tried to burn a DVD I got an error message that said
    "ERRORS IN PROJECT
    There were errors during the project validation that have to be fixed before burning the project."
    What does this mean and how do I fix it.
    jim

    Hi
    Do You have a NEW Mac ?
    Does it really have iDVD ? New ones Don't.
    Please tell much more
    • Mac used
    • Program used (versions)
    • Material used (Codecs, file formats etc)
    Yours Bengt W

  • Making a PDF with LiveCycle then being able to edit pages, insert pages, delete pages, attach files to document, be readable in Adobe Reader etc.

    We have been working for some time with LiveCycle to creat a documents and have experienced a host of problems with the end product.
    1.  Images inserted into the LiveCycle PDF document often come up as "broken links" after editing the document and resaving it.
    2.  Documents will not display in Acrobat reader unless a digital signature is applied to them and the document is re-saved.
    3.  After making the document, we are unable to use Adobe Pro to insert pages, delete pages, or insert files into the document as attachments.
    The end state was to use the simplicity of LiveCycle to create a document and do most of the hard work, and then save it as a PDF document that could be easily edited with Adobe Pro.  It has proven difficult, to say the least, to figure out how to make this work.
    Thanks in advance for any assistance.

    1- Thank you
    2- It only seems rational that if I make a form with LiveCycle that I should be able to view it with Adobe Reader or Adobe Pro.
    Making a form with LiveCycle to be distrubuted to personnel internally that have Adobe Reader and Adobe Pro and cannot open it without it having a digital signature field in it that has just recently been signed just doesn't make sense.  Nor does it seem to make sense to have to purchase 200 additional licenses just for LiveCycle so that people can open a PDF that was made with LiveCycle.  If I make it in LiveCycle and only people with LiveCycle can open it, what is the purpose of making it to begin with?
    3- This also totally sucks.  In a standard Adobe Doc I can at least attach documents to it?
    So, what, exactly then, is the purpose of LiveCycle if the only benefit it seems to provide is ease of creation, but the end product has way less functionality?
    And how do I go about contacting an Adobe rep on the phone in regards to this without getting "there is no support for this product, go to Adobe.com"
    We have millions of dollars of Adobe software and can't get support other than hunting and pecking in these forums?  Really?

  • Making a PDF with "Outline" and Bookmarks Using Pages

    Hi, I'm using Pages 1 and I have tried making a PDF with outline breaks but I failed. I thought using paragraph styles for my document would work but when I exported my document to PDF, all I got was a PDF that only has the thumbnails view but not the outline view. Also, when I exported my document that has bookmarks to PDF, all the bookmarks don't work anymore. How can I make a PDF document using Pages with all the bookmarks and the organization just like other PDFs that I encounter? Thanks

    Hello LadyinStilettos,
    welcome to the Pages Discussions. If I remember correct, in Pages 1.x there is no way to export text links to PDF. An outline view creation doesn't exist.
    If you want to have links in PDF (of the TOC, too), then you should upgrade to iWork'06. But outline view doesn't exist here like it doesn't in version 1.x.

  • My ipod touch 4th generation's audio jack is no longer making a connection with my headphones, i dont think my ipod is under warranty and therefor would i be able to pay apple to fix my ipod.

    My ipod touch 4th generation's audio jack is no longer making a connection with my headphones, i dont think my ipod is under warranty and therefor would i be able to pay apple to fix my ipod.

    If not under warranty,
    Apple will exchange your iPod for a refurbished one for $199 for 64 GB 4G and $99 for the other 4Gs. They do not fix yours.
    Apple - iPod Repair price                       
    A third-party place like the following will replace the jack for less less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens         
    Replace the jack yourself if you are up to it
    iPod Touch Repair – iFixit                  

  • I am busy making a website with iweb. Do you know if it is possible to make a page with a slideshow which does not contain jpg's but other documents?

    I am busy making a website with iweb. Can I only make a page with a slideshow containing jpg's? I would like to make a (pages) document with pictures and have this as a slideshow. Is that possible?

    If you use Keynote rather than Pages you can export as HTML to get a slideshow...
    http://www.iwebformusicians.com/Banner-Slideshow/HTML-Slideshow.html
    Or you can use a JQuery slider that will display text, images, movies etc...
    http://www.iwebformusicians.com/Banner-Slideshow/Anything-JQuery-Slider.html

  • How to convert a pdf file with hand-written signature?

    How to convert a pdf file with hand-written signature?

    Hi Lotus1215,
    Once the document is signed we cannot edit that document, hence convertion is not possible
    Please see the article mentioned below
    http://forums.adobe.com/docs/DOC-1515
    Let me know if you have any other question.
    Regards,
    ~Pranav

  • Making a Directory with alumni information...Templates to use?

    I am making a directory with alumni information for my high school reunion. In one part of the book, I want to list bio information along with a current pix. In the back of the book, I want to alphabetize everyone's name and address and then cross-reference which page their bio is on. Can anyone tell me how to go about doing that? I want the end result to be a booklet (with 81/2 inch by 11 inch paper folded in half). I tried using one of the Pages templates (I believe it is the one for cooking because it was the only one I could find in the brochure section that was not a tri-fold). I am finding that it took so long to put just one page together. I need to be able to do it rather quickly since there are over 100 people already attending and I can't take forever to do this project. I would appreciate any input from anyone on this subject.
    Thanks in advance.

    I would start on a Word Processing blank document, Not a Page layout document. I'd use A4 paper size but I guess you'll have to use the US letter size.
    When I have created the bios of the people I would use a Heading style for their names. By doing this I can make a Table of Contents of there names. Don't forget adding page number.
    The table of Contents (TOC) will be created in the beginning of the brochure. Select the TOC and copy the content. Open TextEdit and Paste. To alphabetise you need to get the free app WordServices from [http://www.devon-technologies.com/products/freeware/services.html]
    do the alphabetising and copy and paste the text in the end of your Pages document. The TOC is the very last thing you should do before making the booklet.
    Save the document. I hope you have done that many times during the process creating it. And also save it as a PDF document.
    To make the booklet get either the app BookLightning 1.7.2 or Create Booklet PDF Service 1.1
    These application will take your document and create a booklet with the right pagination.

  • Indesign book files making a PDF with spreads????

    Hi, I am working with a book file but need to make a digital PDF with spreads. So the problem is obviously that I start with a right single page and finish with a left single page in each chapter which doesn't make a spread. Is there a way around this? (apart from copy and pasting the single pages at each beginning and ending together as spreads into an empty document and replacing these pages in the PDF)
    Thanks

    Re: Indesign book files making a PDF with spreads????
    When you make the pdf of the book from the book panel.
    Create a new document call it filenamespreads or something.
    Get the PDFplacer.jsx script http://indesignsecrets.com/placing-all-the-pages-of-a-pdf-inside-indesign.php
    Run a few pages to get the position right, then do the whole book.
    Export to pdf as spreads.
    It sounds longwinded but it isn't.
    @Eugene--
    This is the closest answer to solving my problem.
    To clarify, the reason I need spreads is NOT for final printing. Its for sending a reader proof to a client to send to someone for review. They need to see it as spreads to get a "feel" for the book. I feel like it should be possible to do this, easily, without too much stress in InDesign.
    I am going to try your solution but I am a newbie about using scripts in InDesign. Never done it before. I placed the script in the scripts folder and re-launched InDesign, but how do I launch the script?
    Thanks!
    Oh, and I should have specified before, I'm using CS2.

  • Zooming whenever I double-click on any margin of pages with Hand Tool or Selection Tool selected

    I have used Acrobat and recently upgraded it to Acrobat XI in order to use it with my tablet PC.
    But whenever I double-click with my digitizer pen, with Hand tool or Selection Tool selected, on any margin of pages, it zooms in. i.e. it automatically magnifies itself as if I did the same thing with magnifying tool. This happens even when I try to double-click on the textboxes to edit it!
    I don't want to zoom it all the time!!!

    Try switching off this setting: Edit - Preferences - General - Make hand
    tool use mouse-wheel zooming.

  • Problem when making new connection with user "sys"

    Hi, I'm having trouble on making new connection with user sys against local 10g installation, the password is correct and I've tried making new connection with other
    users which is fine.
    when I click "test" or "connect", the error msg is strange like this:
    "ORA-01017: invalid username/password; logon denied"
    can anybody help.
    Thx.

    Have you used the "Role" drop-down to "SYSDBA"? - if not, you get the ORA-01017 error.

  • [svn:fx-trunk] 8507: Making measureHeightOfItemsUptoMaxHeight consistent with the way we create rows in the datagrid .

    Revision: 8507
    Author:   [email protected]
    Date:     2009-07-10 10:13:11 -0700 (Fri, 10 Jul 2009)
    Log Message:
    Making measureHeightOfItemsUptoMaxHeight consistent with the way we create rows in the datagrid. MakeRow ensures reported row height is round to the nearest integer, measureHeightOfItemsUptoMaxHeight is now consistent.  Fixes a long standing PrintDataGrid issue.
    Bugs: SDK-20237.
    QE Notes: None
    Doc Notes: None
    Reviewer: Glenn/Alex
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-20237
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as

    Well, you could do the following:
    1) Create a stored procedure that assembles the data into a rowset with rows and fields like the format you want.
    2) Create stored procedures that handle insert, update, and delete.
    3) Create an entity object definition with all transient attributes. Make the attributes match the elements of one row.
    4) Override doDML() in the entity object class to call your procedures (the doc explains how to do this). You might also need to do a bit of research and figure out if you need to override some other method so you can report rows with transient attribute changes only as needing posting. (getPostState(), maybe?)
    5) Create a view object definition with entity-derived attributes based on your EO attributes.
    6) Override the appropriate methods to call your data assembly procedure rather than execute a query (this is also in the doc).
    Still kind of kludgy, but it keeps your business components pretty clean, especially if you use framework classes to do most of the work for you. (I have a partial example of how to do that here.) Of course, it keeps your business components clean by moving the real work to the DB, but some people find that more maintainable that a kazillion business components.
    Hope this helps,
    Avrom

  • Updating the camera's clock with "Image Capture" not working

    In Mac OS X 10.4 I used the application "Image Capture" to synchronise the camera’s clock with the clock of my Mac.
    Since updating to Mac OS X 10.5 this feature isn’t working anymore. I still get the option in the options panel for the camera, but the time isn’t updated.
    The camera is correctly set up, as it still works with my Mac OS X 10.4 iBook.
    Is this a problem with my Mac or is this a bug in Mac OS X 10.5?
    Is there a way to fix this problem?

    What camera? I have had the same problem with a Nikon D70. Nikon Transfer has the same feature, and I can't get it to work on Leopard either.

  • Display Synchronised System Clock With Milliseconds (HH:MM:SS:mm)

    Hello All,
    I need to display the system clock with hours, minutes, seconds and milliseconds (the system clock it synchronised via NTP or GPS and needs to be accurate)
    Using the Buddy API time functions I can display the time with an accuracy of seconds but the inbuilt lingo "the Milliseconds" and Ticks does not correspond to the system time.
    for example I tried using
    member("MyTimeStamp").text = baSystemTime("%0H"&":"&"%0M"&":"&"%0S"&":"&chars(""&the milliseconds, 6,7))
    but the seconds change out of synch with the milliseconds, the milliseconds are approximately 10-12 ms faster and I don't want to fudge the timing, I recorded the display with a slow motions camera and can see the seconds reset to 0 when the milliseconds are already at a value of 10 - 12.
    Any Idea how I can derive milliseconds using the system time? HH:MM:SS:mm
    thanks.

    10-12 ms delay (error) is the correspondent of a 80-100 FPS (polling interval).
    Theoretically speaking, to get 1ms delay (error) you need to run your script at 999 FPS (the max value allowed by D12).
    Practically speaking, that's not possible (many other factors are involved here).
    cheers

Maybe you are looking for