Making a customized clock

Hello  I'm building a customized clock at the moment. For seconds i'm using 12 movieclips with bars inside (fig1)
For every second a bar lights up. I can get the number of "group" to pick and the number of "bar" to light up but i can't actually make them light up because I'm not sure how to actually select the group of bars according to the time. My movieclips are called "group0", "group1" etc. and inside I made different states depending on how many bars light up (fig2)
fig1 fig2
Here's my code:
var now:Date;
var hour:Number;
var min:Number;
var sec:Number;
var group_access:Number;
var specificbar:Number;
addEventListener(Event.ENTER_FRAME, settime);
function settime (evt:Event) {
      //get time
      now = new Date();
      //check hours and set
      if (now.getHours() > 12) {
     hour = now.getHours() - 12;
      } else if (now.getHours()==0) {
       hour=12;
      } else {
       hour=now.getHours();
      //set min and sec
      min=now.getMinutes();
      sec=now.getSeconds();
addEventListener(Event.ENTER_FRAME, setSecs);
function setSecs (evt:Event) {
//Task: Light up a bar every second
group_access = (Math.floor ( (sec*2 )/10) ); // to selects the right group of bars eg. 33 seconds will be group 6
specificbar = sec-(group_access * 5); // to light up the right bar inside the group
// Need help with this part to work out how to access the moviclip according to the seconds on the clock
Really worried right now, please help and thank you

ok i've traced :
trace(group_access , specificbar);
result:
3  4
3  4
3  4
3  4
4  0
4  0
4  0
seems right =S
group no.3 and bar no. 4
then group 4

Similar Messages

  • What has happened to making the customer happy?

    I have 5 months left on my contract (November 2014) and yesterday I dropped my phone and it is completely dead.  I carry insurance on the phone so it can be replaced.  I would prefer to upgrade at this time to a new phone (Samsung Galaxy).  I went into the Verizon store and was told that unless I paid retail I would not be able to get a new phone as I was under contract.  Really?  Can I not extend my contract by another 2 years and get the phone I want now instead of waiting until November?  I told the employee that I would be going to T-Mobile since they are paying EFT's and offering the Galaxy for $0 down.  The monthly payment would be the same as I would get at Verizon.  He said "then that's what you should do".  Again, Really????  I have been with Verizon for more than 10 years!  I would consider myself a good and loyal customer.  What has happened to making the customer happy?  I was more than okay with extending my contract for an additional two years and completing the 5 months I have left.  All I wanted was to purchase a phone at a "customer rate" not a retail rate.  I am now shopping other carriers and plans.  Not the way to do business Verizon!

    You agreed to complete a 24 month contract, you are only 20 months into that contract. The Samsung you're referring to or any phone with T-Mobile won't be free, you will end up paying the full retail price of that phone like you said you did not want to do with Verizon. If you have insurance use it to get your phone replaced and then wait for your upgrade date.

  • Making a customer inactive in R12 Receivables

    I am using R12 and in receivables I am attempting to make customer inactive but cant seem to find how to do it in this form. I can make the account and site inactive but not the customer. I am sure that there is a simple way to do this but the customer form in R12 can be hard to follow at times. Any help would be greatly appreciated. Thanks

    Hi Helios
    Thanks for the info however the note refers to making a customer contact inactive, but does not refer to making the customer itself inactive. Also the AR user guide does not display how to do this either.
    Does anyone else have any idea how to make a customer inactive in the R12 AR customer form?
    Thanks

  • Uploading Data onto a buffer that outputs with a custom clock pulse

    Hello,
    I am currently trying to develop a program that will allow me to upload on or off values to a buffer, and then output these values based on a custom digital waveform I created.  Using a notepad file, I am able to create a digital waveform that is split into microsecond increments. For example if I type 1    0    1    0    0 in the notepad file, the LabVIEW program will create a digital waveform that is high for 1 microsecond and then low for 1 microsecond, then high for 1 microsecond and low for the next 2 microseconds.  After expanding this file to have high and low values covering 30 seconds of time  I was hoping to use this as a clock pulse for releasing the high and low values for 8 channels on a PCI 6220 DAQ board.  If anyone has suggestions on how to go about this it would be extremely helpful. Thank you 
    Attachments:
    Digital Waveform DAQ Assistant 2010 SP2.vi ‏31 KB

    Hi EESteve1992,
    Here are some resources to help you load your digital waveform onto your DAQ application.
    This forum post goes over how to generate a waveform using DAQ:
    http://forums.ni.com/t5/LabVIEW/digital-waveform-output/td-p/378020
    This example gives an example of how to load your data onto your DAQ:
    https://decibel.ni.com/content/docs/DOC-12482
    Hopefully this will help you get started.
    Paolo F.
    National Instruments
    Applications Engineer

  • Making a digital clock

    Hello, I am learning java and i can make simple programs. i have only taken 2 years of java programmin in school.
    i wanted to try something harder, i don't know if i am ready for it or not.
    I want to make a digital clock in java, and maybe modify it by adding buttons to increase hours and mins.
    I have kinda starte it. but i need a lot of help.

    by the nature of your questions, it appears that you don't know much about swing, timers, and java date time functions. We can't just tell you what you need for your clock, otherwise we'd be building it for you. What you need to do is study these areas and learn for yourself. I suggest that you start with the Sun Java Swing tutorials. Start out here:
    http://java.sun.com/docs/books/tutorial/ui/index.html
    and
    http://java.sun.com/docs/books/tutorial/uiswing/index.html

  • Making JTree custom renderer panel scalable

    Hi, everyone. I have made custom TreeCellRenderer which extends JPanel. Panel's background is in different color than JTree's backgound. I need to get my panel rendering the nodes to fill the whole space JTree has in it's parent panel horizontally. For now I have put static width to nodes and it looks fine, but it's not scalable. If I don't put any sizes the panel takes only the size it needs in cell and the outfit is crappy because of panel's different bgcolor. Is there any easy way to make rendering panel use the width which JTree has in it's container. I have implemented getPreferredSize() method in custom TreeCellRenderer and now it returns the static width and height of the rendering panel. Do I have to get JTrees container panel's width every time and pass it to renderer and get size somehow from there or is there some easier way.
    -e

    Yes, there is a reason. Different levels of nodes contain different components. Example main level nodes have print and save buttons on the most right of the panel. Only leafs have same bgcolor as the tree has and those are already now scalable, because size is not set for them.

  • Making some Custom Column Renderers for a JTable

    Hello People
    I've been playing around with a JTable by following the tutorial "How to Use Tables". (I am using netBeans 4.1 to "sculpt" my swing objects onto the nice palette in the IDE. I don't know if this has anything to do with the errors but, it seems like netBeans requires some Gui components be initialized via this abovementioned "palette")
    I believe that I need to somehow tell the JTable about what kinds of objects are in it so that it can render itself properly. I have a table set up with some default values in it
    ->Strings both Editable and Not-Editable
    -> Integers both Editable and Not-Editable
    -> Boolean rendered as a check box Editable
    So upon startup, my progarm renders the table correctly. I have a button to clear all of the elements in the table, which works fine. It is only when I switch to another window, then switch back to an empty table ... the JTable needs to redraw itself. This is when I'm getting the error:
    java.lang.NullPointerException
            at ElementHelp.PrimitiveManager$MyVectorTableModel.getColumnClass(PrimitiveManager.java:93)
            at javax.swing.JTable.getColumnClass(JTable.java:1752)
            at javax.swing.JTable.getCellRenderer(JTable.java:3700)
            at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:1148)
            at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1051)
            at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:974)
            at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
            at javax.swing.JComponent.paintComponent(JComponent.java:541)
            at javax.swing.JComponent.paint(JComponent.java:808)
    ...blah blah more exception stack.....
           I think that because there are no elements in the table that the call to "getClass" for an element in the table returns a NullPointerException. I think I can avoid this via telling the JTable about the types of objects each column will contain. The tutorial suggests one of two solutions: (neither of which I can get to work)
    1) Use a class that extends the DefaultTableCellRenderer
    2) I should write somthing that ...extends JLabel and implements TableCellRenderer.... such as the tutorials ColorRenderer example. Which solution should I work out if I want my table to add/delete rows and be able to have a few cells edited. (It will never be restructured .. the column types won't change)
    Also, I've created my own TableModel for it ... a class that extends AbstractTableModel ... (although not declaired, it also implemnts/overwrites functions from the TableModel interface)
    Any suggestions on avoiding the abovementioned error?
    thanks and happy holidays to everyone

    I think that because there are no elements in the table that the call to "getClass" for an element in the table returns a NullPointerExceptionWell, if you have no data in the table then your TableModel should be returning "0" for the number of rows in the table and it won't be a problem.
    Also, I've created my own TableModel for it ... Why? Use the DefaultTableModel it supports String, Integers and Booleans without any need for custom coding.

  • Accuracy in custom Clock

    Hi all! I've made a simple clock meant to measure computer uptime. I'm using javax.swing.Timer with a delay of 1000 milliseconds. By each event triggered by the timer a variable (long as datatype) holding the total elapsed seconds is incremented. My clock object is does NOT implement Thread, suggestions on this?
    Today I've noticed that my clock was running slower than the clock in Win2k Pro. During 4 hours and 45 minutes I lost 45 seconds!!! Is there a better way to measure time in Java? Would I gain if my clock object impements Thread?

    Thanks for your answer. However, I do not want to depend on any systemtime since I've encountered viruses that keeps adjusting systemtime. In Sweden we have so called Summer time meaning that the clock is set 1 hour earlier which would mess up my uptime application.
    Do you think I'll get more accuracy implementing Thread or Runnable?
    I've just noticed the method java.util.Timer.schedule() http://java.sun.com/docs/books/tutorial/essential/threads/timer.html which seem reasonable...

  • PDF Preset - making a custom PDF preset the "default" selection

    Hello- I always use the same PDF preset when saving pdfs at my job. But every time I go to save a document as a pdf I have to use the drop down menu to choose my preset. Is there anyway to make the program default to my custom preset? This seems to happen automatically in Indesign, but I cannot get it to work in illustrator.
    thanks!
    liz

    I'm having the same issue. The Adobe PDF Presets window (from the Edit menu) lets you add/delete and import/export. However, I see no method to designate a specific preset as the default. So as you describe, I'm having to choose the Preset from the drop-down menu each time. While I can make AppleScripts that utilize the preset I need, it's a pain to have to make the drop-down selection when I'm working on just one file. Since I use a particular PDF Preset +90% of the time, it would be great to have the option to set it as the default. If I find any work around, I'll post it here. Thanks - Josh

  • Making a customable resizable JPanel, but it only works in certain L&F

    Hi,
    I have created the following resizable JPanel (so that I can set a minimum size it can be dragged to).
    However, I need it to work under the system L&F, which is XP, but it wont work.
    The code is below. if you run it the first time, and try to resize the dialog to a small value, you will see it shrinks in size, to a certain point.
    then if you comment out the 2 lines i specified, and run it again, it wont. Anyone have any ideas? is this a known bug?
    import javax.swing.*;
    import java.awt.event.ComponentListener;
    import java.awt.event.ComponentEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.*;
    public class ResizeTest extends JDialog {
         public ResizeTest(JFrame owner) {
              super(owner);
              this.addComponentListener(resizeListener);
              /* comment out the following 2 lines */
              setUndecorated(true);                  
            getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
         private ComponentListener resizeListener = new ComponentListener() {
              public void componentHidden( ComponentEvent i_e ) { }
              public void componentMoved( ComponentEvent i_e ) { }
              public void componentResized( ComponentEvent i_e ) {
                   int width = ResizeTest.this.getWidth();
                   int height = ResizeTest.this.getHeight();   
                  if( width < 50 ) { width = 50; }
                   if( height < 50 ) { height = 50; }
                   ResizeTest.this.setSize( width, height );
             public void componentShown( ComponentEvent i_e ) { }
         private static void test() {
              final JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JButton launchButton = new JButton("showDialog");
              frame.setContentPane(launchButton);
              final ResizeTest testDialog = new ResizeTest(frame);
              testDialog.setMinimumSize(new Dimension(300, 300));
              testDialog.setSize(500, 500);
              testDialog.setPreferredSize(new Dimension(500, 500));
              launchButton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        testDialog.pack();
                        testDialog.setVisible(true);
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        frame.pack();
                        frame.setVisible(true);
         public static void main(String[] args) {
              test();
    }

    okay... I see what the problem is.
    1) With those lines uncommented: The L&F is handling the window decorations. Because of this, it's basically a JWindow with custom painting and mouse handling. When you resize, it's constantly calling setSize, which constantly firing events, so your minimum sizing works as you expect.
    2) With those lines commented: The OS is handling the window decorations. Because of this, there are 2 caveats:
    a) There is a minimum width of the window of what looks like about 120-130 pixels. So you can't go any smaller then that for width. And for height, no smaller then the titlebar and lower border.
    b) It only fires the component events when the mouse is released, cuz that's how the undelying native windows deal with it... or at least with Java.
    For #1 above, there's still a minimum size for the L&F decorated windows. But this is related to what content is showing in the titlebar. Which in the case of the decorations showing, is smaller then what your were defining as a minimum.
    So, basically, it's not a bug. It's just the way it is. It's always been like this.

  • Making a Custom Annotation similar to @Deprecated

    I want to make an annotation for a method (and annotation processor) that at compile-time will throw a custom warning/error if a user ever uses the annotated method during compile time.
    Currently I have a way to throw a warning/error at the declaration of the method, but not at the method's use.
    I'd like it to only throw an error at a usage of the method. I'm thinking i may have to do some tricky stuff with reflection, but I'd like to know if annotations already have some way to do this (I can't find any after several searches).
    I'm hoping that it is easy, since @Deprecated already does a similar thing (errors at use, not declaration)
    Here's my code at the moment (again, it causes errors for the declarations of the methods, not the uses).
    A) The actual annotation
    package unsupported;
    import java.lang.annotation.ElementType;
    import java.lang.annotation.Retention;
    import java.lang.annotation.RetentionPolicy;
    import java.lang.annotation.Target;
    @Retention(RetentionPolicy.SOURCE)
    @Target({ ElementType.METHOD})
    public @interface Unsupported {
    }B) The annotation processor
    package unsupported;
    import java.util.Set;
    import javax.annotation.processing.AbstractProcessor;
    import javax.annotation.processing.ProcessingEnvironment;
    import javax.annotation.processing.RoundEnvironment;
    import javax.annotation.processing.SupportedAnnotationTypes;
    import javax.lang.model.element.Element;
    import javax.lang.model.element.TypeElement;
    import javax.tools.Diagnostic.Kind;
    @SupportedAnnotationTypes("unsupported.Unsupported")
    public class UnsupportedProcessor extends AbstractProcessor {
        private ProcessingEnvironment env;
        @Override
        public synchronized void init(ProcessingEnvironment procEnv) {
            this.env = procEnv;
        @Override
        public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
            if (!roundEnv.processingOver()) {
                for (TypeElement myTypeElement : annotations) {
                    final Set< ? extends Element> elements = roundEnv.getElementsAnnotatedWith(myTypeElement);
                    for (Element elt : elements) {
                        env.getMessager().printMessage(Kind.ERROR,
                                String.format("%s : The Following Element is Unsupported: %s"
                                + "\nThe Compiler will now exit. \n\n", roundEnv.getRootElements(), elt),
                                myTypeElement);
            return true;
    }I then compile these 2 files into a JAR, along with the folder: "META_INF/services" that has the file: "javax.annotation.processing.Processor", with 1 line of text giving the path to the processor: "unsupported.UnsupportedProcessor" (this lets javac know to use the processor at compile time)
    I can then import this jar to my libraries and use the @Unsupported annotation like this:
    class OtherClass1
       @Unsupported
       public void unsupportedmethod()
          System.out.println("hi1") ;
    }Then, when compiling the above code i get this:
    error: [OtherClass1] : The Following Element is Unsupported: unsupportedmethod()
    The Compiler will now exit. Any ideas on how i can modify this to only throw an error when the method is used?
    Thanks,
    - JT
    Edited by: 00jt on Jul 6, 2011 7:57 AM

    Hi,
    I read your blog. The solution that you provided in the blog is creating new Assignment Block and integrate it in BT application on the UI level. The data is populated from the UI by calling Function Module and fill the value context node.
    This will not propagate to GenIL, therefore you will not see any thing on GenIL layer, because there is no integration on GenIL layer.
    The approach needs to be the other way around. Your approach is make something available in UI and you want to propagate it to backend(GenIL). The value node that you created in the UI is not dependent object. It is only a context node which is only available in UI. The right approach is you make the dependent object on the backend(GenIL) and than you propagate the dependent object to the UI.
    You can try transaction EEWB to create custom table for BT application and this will generate for you also the dependent object on the GenIL layer. This solution provided by EEWB has also a generic assignment block that displays the generated dependent object and show it in BT overview page. To see the generic assignment block from BT you can open the component BT_GEN_EXT.
    Regards,
    Steve

  • Making a customized Interactive Report visible to all users?

    Hi,
    Does anyone know if it is possible to make a customized Interactive Report visible to all Apex users, and if so - how?
    The Apex application I'm trying to do this in has a customized authentication scheme with each user having a distinct :APP_USER variable.

    Hi,
    you need to save the IRR as an APEX developer during the runtime of your application. Just make your IRR changes and save it as default.
    You could also take a look into this post: http://dpeake.blogspot.com/2009/01/preserving-user-saved-interactive.html,
    Best regards,
    Tobias

  • Making a custom error page

    Hi could some please tell me the staps to setting up a
    customized error page on the server. My host has told me to go
    ahead and do it but im not really sure of the staps. I have made te
    page i want to use. Just not sure what to do next. Any help would
    be ,ost appreciated.
    Thanks Mark

    I would suggest to check Ray's great entry.
    http://www.coldfusionjedi.com/index.cfm/2007/12/5/The-Complete-Guide-to-Adding-Error-Handl ing-to-Your-ColdFusion-Application
    :)

  • Text variables are missing after making a custom variable with no files open????

    I made a customer text variable with no files open hoping to make it available to ALL my files. Well, that backfired... when I open an existing file I can't see any variables unless I go and make a new one.
    The text variables only show up when I make a new file.
    Any way to fix this?

    That is how any preference, including variables, work. All new files inherit these items, existing files are left alone. If you need those variables in existing files, you can import them from an existing file that has them...which would be any new file that would contain them.
    For the above, go to Type, Text Variables, Define, then load, navigate to any document that has them, make sure the variables you want to include into the existing/former document are checked. If there will be a clash, you can choose what to do.
    Mike

  • Making Async custom message box

    I have created a Custom Message Box class which when called displays a message box on the current page. I have also provided buttons inside of message box to accept user preference. After the custom message box is added to the page execution of methods continue.
    I want to make the page wait until user opts an option from the message box just like existing MessageBox class.
    I have created a method show() which displays the custom message box on the current page. How do I make it async to stop the execution till an option is selected by the user?

    See
    Quickstart: Calling asynchronous APIs in  C# or Visual Basic and
    Asynchronous Programming with Async and Await for an overview of how the .Net async system works.
    The tl;dr for your scenario is to have your ShowAsync() method return a Task so it can be awaited:
    class CustomMessageDialog
    public Task ShowAsync()
    // Do whatever is needed to show the MessageDialog
    public Task<int> ShowAndReturnAsync()
    int indexChosen; // the index of the command picked by the user
    // Do whatever is needed to show the MessageDialog
    return indexChosen;

Maybe you are looking for

  • Problem with trigger and mutating table

    Hello, I have a problem with the following trigger. Everytime it starts I got an error message: ORA-04091: table ccq_test.QW_QUALIFIER is mutating, trigger/function may not see it ORA-06512: at "QW_AFTER_UPDATE_ALL", line 3 ORA-06512: at "QW_AFTER_UP

  • Zen Vision M: TERRIBLE music play and organization, starting to regret my purch

    I used to have a Cowon iAudio, which you could plug into your computer and arrange music however you wanted to using windows explorer. SO EASY. you could make folders of anything you wanted, move songs around just by dragging and dropping, it was the

  • Complex Header on RTF Template

    Hello all, I have an issue with an RTF template and I really hope you have a minute to help me out. I'm really new at this stuff. This is for Purchase Order (PO) printing on Oracle eBusinesss Suite. On the template I need the first rows from a table

  • J2EE Security

    Hi! I'm starting developing my first j2ee application and i'm using weblogic server 6.1 as a j2ee application server. My application will consist in jsp pages in the presentation tier and enterprise java beans in the business tier. I would like to kn

  • Reading the DAX query plan of a trace against a query on a Tabular model

    Hi, I'm monitoring a Tabular model queried by an Excel workbook. Inside SQL Profiler I've choosen as events the VertiPaq SE Query End, the Query End and the DAX Query Plan. But this last event isn't more readable. How can I read the info collected in