Scrolling arrays

I need to write a piece of code that loops through an array, selects the
current row in an ArrayField and puts up a dialog box. Something like the
following:
for x in 1 to set.Items do
arrayWidget.CurrentRow=x;
// put up question dialog, if yes do some stuff
end for;
The problem I'm having is with the scrolling of the ArrayField. Lets say my
ArrayField has 5 rows and my data set has 20 rows. When it gets to row 6 the
ArrayWidget generates some (focus) events to scroll the array and bring the 6th
row into view. The problem is these events are not processed until my code is
done and control returns back to the event loop. The user sees the first 5
dialog boxes along with their associated rows, but the remaining 15 dialog
boxes are all displayed while row 5 is highlighted. As soon as my code finishes
the system goes wild doing all the scrolling.
Is there some way of forcing the window to process the pending events (the
opposite of PurgeEvents)? I tried posting my own event to trigger the dialog
but it seemed to get processed before the scroll events. Are there multiple
queues for the window? Do the events have different priorites?
For Express users, you can do the same thing with the
ExpressClassWindow.ScrollToIndex() method. I also tried using
arrayWidget.RequestFocus as the documentation notes that CurrentRow is read
only but they appear to have work the same.
Any help would be appreciated.

The trick is to drive the process from the parent window's event loop
instead of from a FOR loop. That way all of the window events will be
handled promptly. You would need to define one or more custom events to
control this process. I envision the parent window event loop would look
something like this:
when <updateButton>.click do
<arrayWidget>.currentRow = 1;
post self.updateCurrentRow;
when self.updateCurrentRow do
// display dialog to update current row here
post self.updateNext;
when self.updateNext do
if <arrayWidget>.currentRow < set.items then
<arrayWidget>.currentRow = <arrayWidget>.currentRow + 1;
post self.updateCurrentRow;
end if;
Of course there are many variations of this scheme that will achieve the
same result.
Kevin Klein
Millennium Partners, Inc.
Milwaukee, Wisconsin, USA
-----Original Message-----
From: [email protected] <[email protected]>
To: [email protected] <[email protected]>
Date: Thursday, February 12, 1998 3:06 AM
Subject: Scrolling arrays
I need to write a piece of code that loops through an array, selects the
current row in an ArrayField and puts up a dialog box. Something like the
following:
for x in 1 to set.Items do
arrayWidget.CurrentRow=x;
// put up question dialog, if yes do some stuff
end for;
The problem I'm having is with the scrolling of the ArrayField. Lets say my
ArrayField has 5 rows and my data set has 20 rows. When it gets to row 6the
ArrayWidget generates some (focus) events to scroll the array and bring the6th
row into view. The problem is these events are not processed until my codeis
done and control returns back to the event loop. The user sees the first 5
dialog boxes along with their associated rows, but the remaining 15 dialog
boxes are all displayed while row 5 is highlighted. As soon as my codefinishes
the system goes wild doing all the scrolling.
Is there some way of forcing the window to process the pending events (the
opposite of PurgeEvents)? I tried posting my own event to trigger thedialog
but it seemed to get processed before the scroll events. Are there multiple
queues for the window? Do the events have different priorites?
For Express users, you can do the same thing with the
ExpressClassWindow.ScrollToIndex() method. I also tried using
arrayWidget.RequestFocus as the documentation notes that CurrentRow is read
only but they appear to have work the same.
Any help would be appreciated.

Similar Messages

  • Smooth Cluster Array Scrolling

    This is an odd question.  Is there anyway to have a "smooth scrolling" feature of an array where the horizontol or vertical scroll bars are enabled?  LabVIEW tends to "snap" scrolling to elements end-to-end.  This is awkward for the end user when moderatly sized clusters are used in an array.  The effect is kind of disorienting because it is hard to keep track of how-far you have scrolled.
    It can also be a pain for me because LabVIEW forces me to make the size of the array element some multiple of the size of the element type.  It would be nice if the elements scrolled by smoothly when the user adjusts the positioning of the scroll bar and if I wasn't limited in the size of the array window.
    Any solutions? 

    Scrolling arrays is "quantized" to whole elements. You cannot scroll in fractional steps. Is that what you want?
    LabVIEW Champion . Do more with less code and in less time .

  • Why is labview so slow when I use an array subset to scan through a large array

    I am using an array sub set to scroll  arrays across an intensity graph, and it works but when I load a large array (ex. 482 x 1000) the program is extremely slow, updating appox. every 3 seconds. What I'm I doing wrong?
    - there is always an easy way, but it is always the hardest to find

    Can you attach your code so we can see how you do this?
    How big are the subsets you are extracting?
    LabVIEW Champion . Do more with less code and in less time .

  • Set column width of a multicolumn listbox in LV touch panel module

    Hello,
    I am trying to build an application using LV Touch panel module 8.6 and I am having a problem with multicolumn listboxes. I am setting the the width of the columns by clicking and dragging the separator between the headers, but when I transfer and run my application to a winCE controller the width of the columns is the same for all columns (and very narrow actually).
    Does anyone know something about it?
    I also noticed the following two problems. When I transfer my application in the winCE controller, the line and column separators are disappeared and the column headers are also disappeared, although I have set them to be visible in my vi.
    Thanks in advance.

    The issues that you are having are because the LV touch
    panel Module does not support "Moveable column separators" and
    "Row and column headers". The limitations of using a touch panel are available
    in the LabVIEW help file.
    A possible workaround may be to use a series of arrays with a string data
    type then using a single scrollbar control multiple property nodes.
    I have attached an example.
    I hope this has helped.
    Philip
    Philip
    Applications Engineer
    National Instruments
    UK Branch
    ===If this fixes your problem, mark as solution!===
    Attachments:
    Scroll Array.vi ‏10 KB

  • How do I add a scroll bar to an array?

    I want to take a 2D array and change the row its is in with a scrollbar so that in a another array index I can pull out individual number from each row. 
    So I have a CSV file [time,1,2,3,4,5] and I want the user to able to vary the time with a scrollbar. 
    Thanks! 

    sofiakyle wrote:
    I want to take a 2D array and change the row its is in with a scrollbar so that in a another array index I can pull out individual number from each row. 
    So I have a CSV file [time,1,2,3,4,5] and I want the user to able to vary the time with a scrollbar. 
    A scrollbar is a cosmetic UI element that does not modify data (e.g. vary time) or "pull out numbers" (whatever that means).
    If you can only scroll through 8 values, maybe you need to transpose the array to swap rows with columns.
    LabVIEW Champion . Do more with less code and in less time .

  • Disable array indicator but enable scroll bar ?

    Dear All,
    is there a way to disable an array without disabling the ability to scroll down with the mouse (scroll bar is also disabled if you choose disable in properties). The array indicator is clickable althoug not writable but causes confusion for the user...as if you can write something.
    thank you .

    Hi mbhatti2000,
    - Could you put up a small example of what you mean?
    If you just want to disable the array indicator and gray it out, then you can use the property shown below.
    Regards,
    Peter D
    Attachments:
    DisableIndicator.vi ‏9 KB

  • Link a single scroll bar to two arrays

    I am trying to link a single scroll bar to a pair of arrays (one is dbl, one boolean; both single dimension), so they line up correctly as I move the bar. Any ideas on how to get this to work? I tried a cluster, but no luck (Maybe I missed somethng?). Thanks!

    Hi Templar,
    use property nodes:
    read shown array index (property "Index values") from 1st array and set the same indices for the 2nd array...
    Message Edited by GerdW on 07-26-2007 04:03 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Array scroll bar event

    Is there any way that I could get the event from array scroll bar in LabVIEW 8.5? I have an one-dimensional array and I made the vertical scroll bar visible. What I want to do is that when I drag the scroll bar to change array index value, I need to change the content of another array that will display the visible line number of the first array. Array index display only is not suitable for my application.

    Jason2006 wrote:
    I need to change the content of another array that will display the visible line number of the first array.
    I don't quite understand what you mean by "visible line number of the first array". Arrays don't have line numbers. Do you just want to scroll it to the same element as the first array?
    In this case you could do something like the following (hey, it even works for multidimensional arrays! ):
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    MultiScroll.vi ‏19 KB

  • Adding Scroll bar InPanel Array

    I want to add scroll bar in panel array .Kindly help me to sort this problem immdiatedly

    Kindly help me to sort this problem immdiatedly Based on the information provided, I doubt we will be able to.
    The general advice is add your panel to the scrollPane and add the scrollPane to the GUI. Its that simple.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • Scrolling a multi-dimensional array in a for-loop

    G'day everybody,
    I would like to be able to print all the array elements without incurring an ArrayIndexOutOfBounds exception, but it seems to be beyond me.
    My code is shown below and I would appreciate any suggestions to overcome this problem so that I can keep the code as generic as possible, thanks in advance!
    class FloatArray {
        public static void main (String[] args) {
            float[][] floatArray = {{-57.6f},
                                          {500.1f, 70.70f},
                    {100.9f, 0.5f, 20.20f}};
            for (int i = 0; i <= floatArray.length-1; i++) {
    for (int j = 0; j < floatArray[i].length; j++) {
         System.out.println("Array length: " + floatArray[i].length);
         System.out.println("Array element: " + floatArray[i][j]);

    Small error:
    for (int i = 0; i <= floatArray.length-1; i++) {
    for (int j = 0; j < floatArray<i>.length; j++) {

  • Touchpad no longer scrolls up and down on Satellite A

    So my HD crashed and i have to completely install Windows and all the Toshiba stuff with it a new.
    All is well - except for one thing, my touchpad no longer scrolls up and down using the side of it in IE or Chrome, but it still works in SeaMonkey.
    My Computer technician tells me it's an issue with getting some new driver for the touchpad, and i think i had to do that already about a year ago when i still had my original HD running.
    So i went to the Toshiba.ch website and tried to find something.
    I found all their "verfication" stuff and got inside the system and it instantly returned about 45 drivers by the looks of my "un"-driving eyeys they all could have been for whatever, so i searched especially for "touch pad" and yes, there was one for my Synapsis touchpad and XP as well, so i downloaded it - or i should say i opened it in Win Zip and checked first on the "readme file - wow, that was some Portugese in there, and that's when i kind of begun to feel lost.
    I check in at Toshiba.ch, get a ton of drivers in my face i have no clue whether i am supposed to download them all or what, and when i finally pick what i think i need the whole thing seems to be in Portugese, what the crickey in the afternoon is this???
    Anyway, before i download and try to install stuff i have no clue about i was hoping someone would actually give me a better hint on what i have to do exactly to get my touchpad to scroll up and down again also in Chrome, IE and where ever else.
    I use Service Pack 3 on Win XP Pro and was told that's maybe why the old original driver for this laptop needs to be updated, but which file, where to get it, and how to properly install it please anyone???

    Thanks for that, you confirm what i actually found out myself in the meantime.
    The way i got this issue solved was that i first tried to download and install the Synaptics driver from the Toshiba site - that simply failed miserably, glad with no negative side effects at least.
    Nesxt i used what unfortunately is way easier that sites like the Toshiba overload, i used Google to simply find the Synaptics website and instantly got the link to their driver download - eh voila, that actually gave me a .exe file, not an endless array of zipped files like the stuff on the Toshiba site in endless language versions!!!
    This worked, tested everything out alread since a while.
    - Which now leaves me with the question about the second driver you mentioned,
    Alps Electric
    what is that one needed for??
    I have not seen this name on my lappy before, so totally unsure about whether it still needs this dispite things are working everywhere, i did not even have to go into the Device Settings of the Mouse / touchpad to change or rearrange anything in there after the direct download from Synapsis, but well informed is always best, so if you could let me know about that
    Alps thing would appreciate...

  • Reading from file into an array

    Hello, new to Java and we need to modify a mortgage calculator to read interest rate from a file into an array and not have them hard coded in the program. I have read many post on how to perform this but am lost on where to put the new code and format. Here is my code and I hope I posted this right.
    import javax.swing.*;                                              // Imports the Main Swing Package                                   
    import javax.swing.event.*;
    import javax.swing.text.*;                                          // Used for  Text Box Caret Position
    import java.awt.*;                                                // Imports the main AWT Package
    import java.awt.event.*;                                         // Event handling class are defined here
    import java.text.NumberFormat;
    import java.text.*;                                              // Imports the Main Text Package
    import java.util.*;                                              // Imports the Main Utility Package
    public class mortgageCalculator1 extends JFrame implements ActionListener             // Creates class mortgageCalculator
        JLabel AmountLabel = new JLabel("   Enter Mortgage Amount:$ ");                   // Declares Mortgage Amount Label
        JTextField mortgageAmount = new JTextField(10);                                     // Declares Mortgage Amount Text Field
        JButton IntandTerm1B = new JButton("7 years at 5.35%");                    // Declares 1st Mortgage Term and Interest Rate
        JButton IntandTerm2B = new JButton("15 years at 5.50%");                    // Declares 2nd Mortgage Term and Interest Rate
        JButton IntandTerm3B = new JButton("30 years at 5.75%");                    // Declares 3rd Mortgage Term and Interest Rate
        JLabel PaymentLabel = new JLabel("   Monthly Payment: ");                     // Declares Monthly Payment Label
        JTextField monthlyPayment = new JTextField(10);                          // Declares Monthly Payment Text Field
        JButton exitButton = new JButton("Exit");                              // Declares Exit Button
        JButton newcalcButton = new JButton("New Calculation");                     // Declares New Calculation Button
        JTextArea mortgageTable = new JTextArea(35,65);                         // Declares Mortgage Table Area
        JScrollPane scroll = new JScrollPane(mortgageTable);                         // Declares ScrollPane and puts the Mortgage Table inside
        public mortgageCalculator1()                                        // Creates Method
             super("MORTGAGE CALCULATOR");                              // Title of Frame
             JMenuBar mb = new JMenuBar();                                   // Cretes Menu Bar
                JMenu fileMenu = new JMenu("File");                                 // Creates File Menu
             fileMenu.setMnemonic('F');                                      // Enables alt + f to Access File Menu
             JMenuItem exitItem = new JMenuItem("Exit");                     // Creates Exit in File Menu
             fileMenu.add(exitItem);                                   // Adds Exit to File Menu
                 exitItem.addActionListener(new ActionListener()                     // Adds Action Listener to the Exit Item
                     public void actionPerformed(ActionEvent e)                     // Tests to Verify if File->Exit is Pressed
                         System.exit(0);                                // Exits the Programs when File->Exit is Pressed
                mb.add(fileMenu);                                      // Adds the File Menu
                setJMenuBar(mb);                              
         setSize(600, 400);                                        // Sets Size of Frame
            setLocation(200,200);                                         // Sets the Location of the Window  
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);                                  // Command on how to close frame
         JPanel pane = new JPanel();                                   // Declares the JPanel
         pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));                          // Sets Panel Layout to BoxLayout
         Container grid = getContentPane();                               // Declares a Container called grid
         grid.setLayout(new GridLayout(4,3,5,5));                          // Sets grid Layout to GridLayout
         pane.add(grid);                                             // Adds the grid to the Panel
         pane.add(scroll);                                        // Addes the scrollPane to the Panel
            grid.setBackground(Color.yellow);                              // Set grid color to Yellow
         setCursor(new Cursor(Cursor.HAND_CURSOR));                         // Makes the cursor look like a hand
         mortgageAmount.setBackground(Color.black);                         // Sets mortgageAmount JPanel JTextField Background Color
            mortgageAmount.setForeground(Color.white);                         // Sets mortgageAmount JPanel JTextField Foreground Color
         mortgageAmount.setCaretColor(Color.white);                         // Sets mortgageAmount JPanel JTextField Caret Color
         mortgageAmount.setFont(new Font("Lucida Sans Typewriter", Font.PLAIN, 18));     // Sets mortgageAmount JPanel JTextField Font
         monthlyPayment.setBackground(Color.black);                         // Sets monthlyPayment JPanel JTextField Background Color
         monthlyPayment.setForeground(Color.white);                         // Sets monthlyPayment JPanel JTextField Foreground Color
            monthlyPayment.setFont(new Font("Lucida Sans Typewriter", Font.PLAIN, 18));     // Sets monthlyPayment JPanel JTextField Font
         mortgageTable.setBackground(Color.yellow);                         // Sets mortgageTable JTextArea Background Color
         mortgageTable.setForeground(Color.black);                         // Sets mortgageTable JTextArea Foreground Color
         mortgageTable.setFont(new Font("Arial", Font.PLAIN, 18));               // Sets JTextArea Font
         grid.add(AmountLabel);                                        // Adds the Mortgage Amount Label
         grid.add(mortgageAmount);                                   // Adds the Mortgage Amount Text Field
         grid.add(IntandTerm1B);                                        // Adds 1st Loan and Rate Button
         grid.add(PaymentLabel);                                    // Adds the Payment Label
         grid.add(monthlyPayment);                                    // Adds the Monthly Payment Text Field
           monthlyPayment.setEditable(false);                              // Disables editing in this Text Field
            grid.add(IntandTerm2B);                                        // Adds 2nd Loan and Rate Button
            grid.add(exitButton);
         grid.add(newcalcButton);                                    // Adds the New Calc Button
            grid.add(IntandTerm3B);                                        // Adds the Exit Button
         setContentPane(pane);                                          // Enables the Content Pane
         setVisible(true);                                          // Sets JPanel to be Visable
         exitButton.addActionListener(this);                                // Adds Action Listener to the Exit Button
         newcalcButton.addActionListener(this);                            // Adds Action Listener to the New Calc Button
            IntandTerm1B.addActionListener(this);                              // Adds Action Listener to the 1st loan Button
         IntandTerm2B.addActionListener(this);                              // Adds Action Listener to the 2nd loan Button
         IntandTerm3B.addActionListener(this);                               // Adds Action Listener to the 3rd loan Button
         mortgageAmount.addActionListener(this);                              // Adds Action Listener to the Mortgage  Amount Text Field
         monthlyPayment.addActionListener(this);                              // Adds Action Listener to the Monthly payment Text Field
        public void actionPerformed(ActionEvent e)                               // Tests to Verify Which Button is Pressed
            Object command = e.getSource();                                                 // Enables command to get data
            if (command == exitButton) //sets exitButton                         // Activates the Exit Button
                System.exit(0);  // Exits from exit button                         // Exits from exit button
            int loanTerm = 0;                                             // Declares loanTerm
            if (command == IntandTerm1B)                                   // Activates the 1st Loan Button
                loanTerm = 0;                                        // Sets 1st value of Array
            if (command == IntandTerm2B)                                   // Activates the 2nd Loan Button
                loanTerm = 1;                                        // Sets 2nd value of Array
            if (command == IntandTerm3B)                                   // Activates the 3rd Loan Button
             loanTerm = 2;                                        // Sets 3rd value of Array
                double mortgage = 0;                                   // Declares and Initializes mortgage
             double rate = 0;                                        // Declares and Initializes rate                                        
             double [][] loans = {{7, 5.35}, {15, 5.50}, {30, 5.75},};                 // Array Data for Calculation
                    try
                        mortgage = Double.parseDouble(mortgageAmount.getText());            // Gets user input from mortgageAmount Text Field
                      catch (NumberFormatException nfe)                          // Checks for correct number fformatting of user input
                       JOptionPane.showMessageDialog (this, "Error! Invalid input!");      // Outputs error if number is wrong format or nothing is entered
                       return;
             double interestRate = loans [loanTerm][1];                         // Sets interestRate amount
             double intRate = (interestRate / 100) / 12;                         // Calculates Interst Rate     
                double loanTermMonths = loans [loanTerm] [0];                    // Calculates Loan Term in Months
                int months = (int)loanTermMonths * 12;                          // Converts Loan Term to Months
                double interestRateMonthly = (intRate / 12);                                // monthly interst rate
             double payment = mortgage * intRate / (1 - (Math.pow(1/(1 + intRate), months)));    // Calculation for Monthly payment
                double remainingLoanBalance = mortgage;                              // Sets Reamaining Balance
                double monthlyPaymentInterest = 0;                                       // holds current interest payment
                double monthlyPaymentPrincipal = 0;                                    // holds current principal payment
                NumberFormat myCurrencyFormatter = NumberFormat.getCurrencyInstance(Locale.US);     // Number formatter to format output in table
                monthlyPayment.setText(myCurrencyFormatter.format(payment));
                mortgageTable.setText("Month\tPrincipal\tInterest\tEnding Balance\n" +                // Formats morgageTable Header
                                      "---------\t----------\t------------\t---------------------\n");
                    for (;months > 0 ; months -- )
                     monthlyPaymentInterest = (remainingLoanBalance * intRate);               // Calculation for Monthly Payment Toward Interest
                     //Calculate H = R x I
                     monthlyPaymentPrincipal = (payment - monthlyPaymentInterest);          // Calculation for Monthly Payment Toward Principal
                     //Calculate C = P - H
                  remainingLoanBalance = (remainingLoanBalance - monthlyPaymentPrincipal);     // Calculation for Reamining loan Balance
                  // Calculate R = R - C
                  // H = monthlyPaymentInterest
                  // R = remainingLoanBalance
                  // P = payment
                  // C = monthlyPaymentPrincipal
                  // I = interestRateMonthly
                  mortgageTable.setCaret (new DefaultCaret());                    // Sets Scroll position to the top left corner
                  mortgageTable.append(String.valueOf(months) + "\t" +               // Pulls in data and formats MortgageTable
                  myCurrencyFormatter.format(monthlyPaymentPrincipal) + "\t" +
                     myCurrencyFormatter.format(monthlyPaymentInterest) + "\t" +
                     myCurrencyFormatter.format(remainingLoanBalance) + "\n");
                           if(command == newcalcButton)                               // Activates the new calculation Button
                         mortgageAmount.setText(null);                         //clears mortgage amount fields
                      monthlyPayment.setText(null);                         //clears monthly payment fields
                            mortgageTable.setText(null);                              //clears mortgage table
    public static void main(String[] args)                               //This is the signature of the entry point of all the desktop apps
         new mortgageCalculator1();
    }

    OK, making a little progress but am still very confused.
    What I have is a file (int&term.dat) with three lines;
    5.75, 30
    5.5, 15
    5.35 ,7
    I have three JButtom that I what to read a seperate line and place the term in a term TextField and a rate in a Rate TextField
    I have added the following code and all it does now is output a black space to the screen; I am working with one Button and Just the rate for now to try and get it to work. I have been looking at the forums, reading the internet and several books to try and figure this out. I think I may be getting closer.
    public static void read()
        String line;
        StringTokenizer tokenizer;
        String rate;
        String term;
        try
            FileReader fr = new FileReader ("int&term.dat");
            BufferedReader inFile = new BufferedReader (fr);
            line = inFile.readLine();
            while (line != null)
            tokenizer = new StringTokenizer(line);
            rate = tokenizer.nextToken();
            line = inFile.readLine();
             inFile.close();
             System.out.println(new String());
             catch (FileNotFoundException exception)
                   System.out.println ("The file was not found.");
              catch (IOException exception)
                    System.out.println (exception);
    }

  • How do I reposition image scroller bar from middle to the right

    I am customising an image thumb scroller. and trying to follow up previously developed code.
    All worked fine until the last moment when thumbnails bar is positioned as if its starting point is in the middle of the screen. I suppose it was developed for the flash screen layout with centered coordinates. My stage probably has them set to the upper left corner.
    I can not make the bar move.
    My stage size is 1024 x 768
    Where do I do my math in the code so the thumbnails will be located in the middle of the screen rather than in its right hand.
    Here are the code snippets responsible for the thumbnails build up:
      const _THUMB_WIDTH:Number = 50;
      const _THUMB_HEIGHT:Number = 64;
      const _IMAGE_WIDTH:Number = 860;//550;original #
      const _IMAGE_HEIGHT:Number = 500;//355;original #
      const _THUMB_GAP:Number = 2;
      const _SCROLL_SPEED:Number = 12;
      const _SCROLL_AREA:Number = 150;
    var _progressBar:MovieClip;
    var _arrowLeft:MovieClip;
    var _arrowRight:MovieClip;
    var _slides:Array;
    var _curSlide:Slide; //Slide that is currently displaying
    var _loadingSlide:Slide; //only used when a Slide is supposed to show but hasn't been fully loaded yet (like if the user clicks "next" many times before all the images have loaded). We keep track of the one that's in the process of loading and should be shown as soon as it finishes, then we set _loadingSlide back to null.
    var _imagesContainer:Sprite; //the Sprite into which the full-size images are placed (this helps manage the stacking order so that the images can always be behind everything else and yet we can addChild() each image so that it shows up on top of the previous one)
    var _thumbnailsContainer:Sprite; //the Sprite into which the thumbnail images are placed. This also allows us to slide them all at the same time.
    var _destScrollX:Number = 0; //destination x value for the _thumbnailsContainer which is used for scrolling it across the bottom. We don't want to use _thumbnailsContainer.x because it could be in the process of tweening, so we keep track of the end/destination value and add/subtract from it when creating our tweens.
    var _minScrollX:Number; //we know the maximum x value for _thumbnailsContainer is 0, but the mimimum value will depend on how many thumbnail images it contains (the total width). We calculate it in the _setupThumbnails() method and store it here for easier/faster scrolling calculations in the _enterFrameHandler()
    _thumbnailsContainer = new Sprite();
    addChild(_thumbnailsContainer);
    //_thumbnailsContainer.x = -550;//moves x position of thumbnails, instead done in line 273 thumbnail.x = curX - 590;
    _thumbnailsContainer.y = _IMAGE_HEIGHT;//moves y position of thumbnails
    _thumbnailsContainer.alpha = 0; //we want alpha 0 initially because we'll fade it in later when the thumbnails load.
    _thumbnailsContainer.visible = false; //ensures nothing is clickable.
    var xmlLoader:XMLLoader = new XMLLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/data.xml", {onComplete:_xmlCompleteHandler});
    xmlLoader.load();
    function _xmlCompleteHandler(event:LoaderEvent):void {
    _slides = [];
    var xml:XML = event.target.content; //the XMLLoader's "content" is the XML that was loaded.
    var imageList:XMLList = xml.image; //In the XML, we have <image /> nodes with all the info we need.
    //loop through each <image /> node and create a Slide object for each.
    for each (var image:XML in imageList) {
    _slides.push( new Slide(image.@name,
    image.@description,
    new ImageLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/thumbnails/appThmb_imgs/" + image.@name + ".jpg",
    name:image.@name + "Thumb",
    width:_THUMB_WIDTH,
    height:_THUMB_HEIGHT,
    //centerRegistration:true,
    //x:260, y:320,//doesn't work here but works in line 69
    scaleMode:"proportionalInside",
    bgColor:0x000000,
    estimatedBytes:13000,
    onFail:_imageFailHandler}),
    //loops through all the thumbnail images and places them in the proper order across the bottom of the screen and adds CLICK_THUMBNAIL listeners.
    function _setupThumbnails():void {
    var l:int = _slides.length;
    var curX:Number = _THUMB_GAP;
    for (var i:int = 0; i < l; i++) {
    var thumbnail:Sprite = _slides[i].thumbnail;
    _thumbnailsContainer.addChild(thumbnail);
    TweenLite.to(thumbnail, 0, {colorTransform:{brightness:0.5}});
    _slides[i].addEventListener(Slide.CLICK_THUMBNAIL, _clickThumbnailHandler, false, 0, true);
    thumbnail.x = curX;
    thumbnail.y = -234;//defines y position of the thumbnails row
    curX += _THUMB_WIDTH + _THUMB_GAP;
    _minScrollX = _IMAGE_WIDTH - curX;
    if (_minScrollX > 0) {
    _minScrollX = 0;
    function _enterFrameHandler(event:Event):void {
    if (_thumbnailsContainer.hitTestPoint(this.stage.mouseX, this.stage.mouseY, false)) {
    if (this.mouseX < _SCROLL_AREA) {
    _destScrollX += ((_SCROLL_AREA - this.mouseX) / _SCROLL_AREA) * _SCROLL_SPEED;
    if (_destScrollX > 0) {  //this number is 1/2 the stage size, previously was at 0 it defines the left position of the thumbnails scroll end, has to be indentical to the number below
    _destScrollX = 0;    //this number is 1/2 the stage size, previously was at 0 it defines the left position of the thumbnails scroll end, has to be indentical to the number above
    TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});
    } else if (this.mouseX > _IMAGE_WIDTH - _SCROLL_AREA) {
    _destScrollX -= ((this.mouseX - (_IMAGE_WIDTH - _SCROLL_AREA)) / _SCROLL_AREA) * _SCROLL_SPEED;
    if (_destScrollX < _minScrollX) {
    _destScrollX = _minScrollX;
    TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});

    Hi, thanks for taking a look at my problem.
    I assume that the code was difficult to read due to an unusual line brakes, which somehow I got when pasting on this site.
    Please take a look I am pasting the code anew in it entirety:
    (please let me know if you would like me to separate the areas which I believe give me troubles to address my previously describe problem:
    All worked fine until the last moment when thumbnails bar is positioned as if its starting point is in the middle of the screen. I suppose it was developed for the flash screen layout with centered coordinates. My stage probably has them set to the upper left corner.
    I can not make the bar move.
    My stage size is 1024 x 768
    Where do I do my math in the code so the thumbnails will be located in the middle of the screen rather than in its right hand.)
    (Also wanted to mention that there an external file Slide.as which is not responsible for the construction and positioning of the thumbnails)
              import com.greensock.*;
              import com.greensock.loading.*;
              //import com.greensock.events.LoaderEvent;
              import com.greensock.loading.display.*;
              //import com.greensock.TweenLite;
              import com.greensock.events.LoaderEvent;
              //import com.greensock.loading.ImageLoader;
              //import com.greensock.loading.SWFLoader;
              //import com.greensock.loading.LoaderMax;
              //import com.greensock.loading.XMLLoader;
              import com.greensock.plugins.AutoAlphaPlugin;
              import com.greensock.plugins.ColorTransformPlugin;
              import com.greensock.plugins.GlowFilterPlugin;
              import com.greensock.plugins.BlurFilterPlugin;//i added this filter to blur the progressBar
              import com.greensock.plugins.TweenPlugin;
              import flash.display.MovieClip;
              import flash.display.Sprite;
              import flash.events.Event;
              import flash.events.MouseEvent;
              //public class SlideshowExample extends MovieClip {
                          const _THUMB_WIDTH:Number = 50;
                          const _THUMB_HEIGHT:Number = 64;
                          const _IMAGE_WIDTH:Number = 860;//550;original #
                          const _IMAGE_HEIGHT:Number = 500;//355;original #
                          const _THUMB_GAP:Number = 2;
                          const _SCROLL_SPEED:Number = 12;
                          const _SCROLL_AREA:Number = 150;
                         var _progressBar:MovieClip;
                         var _arrowLeft:MovieClip;
                         var _arrowRight:MovieClip;
                         var _slides:Array;
                         var _curSlide:Slide; //Slide that is currently displaying
                         var _loadingSlide:Slide; //only used when a Slide is supposed to show but hasn't been fully loaded yet (like if the user clicks "next" many times before all the images have loaded). We keep track of the one that's in the process of loading and should be shown as soon as it finishes, then we set _loadingSlide back to null.
                         var _imagesContainer:Sprite; //the Sprite into which the full-size images are placed (this helps manage the stacking order so that the images can always be behind everything else and yet we can addChild() each image so that it shows up on top of the previous one)
                         var _thumbnailsContainer:Sprite; //the Sprite into which the thumbnail images are placed. This also allows us to slide them all at the same time.
                         var _destScrollX:Number = 0; //destination x value for the _thumbnailsContainer which is used for scrolling it across the bottom. We don't want to use _thumbnailsContainer.x because it could be in the process of tweening, so we keep track of the end/destination value and add/subtract from it when creating our tweens.
                         var _minScrollX:Number; //we know the maximum x value for _thumbnailsContainer is 0, but the mimimum value will depend on how many thumbnail images it contains (the total width). We calculate it in the _setupThumbnails() method and store it here for easier/faster scrolling calculations in the _enterFrameHandler()
                         //function SlideshowExample() {
                                  //super();
                                  //activate the plugins that we'll be using so that TweenLite can tween special properties like filters, colorTransform, and do autoAlpha fades.
                                  TweenPlugin.activate([AutoAlphaPlugin, ColorTransformPlugin, GlowFilterPlugin, BlurFilterPlugin]);//i added BlurFilterPlugin at the end
                                  _progressBar = this.getChildByName("progress_mc") as MovieClip;
                                  _arrowLeft = this.getChildByName("arrowLeft_mc") as MovieClip;
                                  _arrowRight = this.getChildByName("arrowRight_mc") as MovieClip;
                                  //////////my additions to make progress bay blurry
                                  TweenLite.to(progress_mc.progressBar_mc.gradientbar_appLoader_mcPopUp_mc, 0, {blurFilter:{blurX:21, blurY:8}});//i added this line to make ProgressBar_mc to blur
                                  TweenLite.to(progress_mc.rectangleGray, 0, {blurFilter:{blurX:21, blurY:8}});//i added this line to make ProgressBar_mc to blur
                                  _arrowLeft.visible = _arrowRight.visible = false;
                                  _imagesContainer = new Sprite();
                                  this.addChildAt(_imagesContainer, 0);
                                  _thumbnailsContainer = new Sprite();
                                  addChild(_thumbnailsContainer);
                                  //_thumbnailsContainer.x = -550;//moves x position of thumbnails, instead done in line 273 thumbnail.x = curX - 590;
                                  _thumbnailsContainer.y = _IMAGE_HEIGHT;//moves y position of thumbnails
                                  _thumbnailsContainer.alpha = 0; //we want alpha 0 initially because we'll fade it in later when the thumbnails load.
                                  _thumbnailsContainer.visible = false; //ensures nothing is clickable.
                                  var xmlLoader:XMLLoader = new XMLLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/data.xml", {onComplete:_xmlCompleteHandler});
                                  xmlLoader.load();
                         function _xmlCompleteHandler(event:LoaderEvent):void {
                                  _slides = [];
                                  var xml:XML = event.target.content; //the XMLLoader's "content" is the XML that was loaded.
                                  var imageList:XMLList = xml.image; //In the XML, we have <image /> nodes with all the info we need.
                                  //loop through each <image /> node and create a Slide object for each.
                                  for each (var image:XML in imageList) {
                                            _slides.push( new Slide(image.@name,
                                                                                                        image.@description,
                                                                                                        new ImageLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/thumbnails/appThmb_imgs/" + image.@name + ".jpg",
                                                                                                                                                          name:image.@na me + "Thumb",
                                                                                                                                                          width:_THUMB_W IDTH,
                                                                                                                                                          height:_THUMB_ HEIGHT,
                                                                                                                                                          //centerRegist ration:true,
                                                                                                                                                          //x:260, y:320,//doesn't work here but works in line 69
                                                                                                                                                          scaleMode:"pro portionalInside",
                                                                                                                                                          bgColor:0x0000 00,
                                                                                                                                                          estimatedBytes :13000,
                                                                                                                                                          onFail:_imageF ailHandler}),
                                                                                                        new SWFLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/images/" + image.@name + ".swf",
                                                                                                                                                  name:image.@name + "Image",
                                                                                                                                                  width:_IMAGE_WIDTH,
                                                                                                                                                  height:_IMAGE_HEIGHT,
                                                                                                                                                  //centerRegistration:true,
                                                                                                                                                  x:-420, y:-260,
                                                                                                                                                  scaleMode:"proportionalInside",
                                                                                                                                                  bgColor:0x000000,
                                                                                                                                                  estimatedBytes:820000,
                                                                                                                                                  onFail:_imageFailHandler})
                                  //now create a LoaderMax queue and populate it with all the thumbnail ImageLoaders as well as the very first full-size ImageLoader. We don't want to show anything until the thumbnails are done loading as well as the first full-size one. After that, we'll create another LoaderMax queue containing the rest of the full-size images that will load silently in the background.
                                  var initialLoadQueue:LoaderMax = new LoaderMax({onComplete:_initialLoadComplete, onProgress:_progressHandler});
                                  for (var i:int = 0; i < _slides.length; i++) {
                                            initialLoadQueue.append( _slides[i].thumbnailLoader );
                                  initialLoadQueue.append(_slides[0].imageLoader); //make sure the very first full-sized image is loaded initially too.
                                  initialLoadQueue.load();
                                  _setupThumbnails();
                         function _initialLoadComplete(event:LoaderEvent):void {
                                  //now that the initial load is complete, fade out the progressBar. autoAlpha will automatically set visible to false once alpha hits 0.
                                  TweenLite.to(_progressBar, 0.5, {autoAlpha:0});
                                  //fade in the thumbnails container
                                  TweenLite.to(_thumbnailsContainer, 1, {autoAlpha:1});
                                  _setupArrows();
                                  //setup the ENTER_FRAME listeners that controls the thumbnail scrolling behavior at the bottom
                                  this.stage.addEventListener(Event.ENTER_FRAME, _enterFrameHandler, false, 0, true);
                                  //now put all the remaining images into a LoaderMax queue that will load them one-at-a-time in the background in the proper order. This can greatly improve the user's experience compared to loading them on demand which forces the user to wait while the next image loads.
                                  var imagesQueue:LoaderMax = new LoaderMax({maxConnections:1});
                                  for (var i:int = 1; i < _slides.length; i++) {
                                            imagesQueue.append( _slides[i].imageLoader );
                                  imagesQueue.load();
                                  //now start the slideshow
                                  _showNext(null);
                        //loops through all the thumbnail images and places them in the proper order across the bottom of the screen and adds CLICK_THUMBNAIL listeners.
                         function _setupThumbnails():void {
                                  var l:int = _slides.length;
                                  var curX:Number = _THUMB_GAP;
                                  for (var i:int = 0; i < l; i++) {
                                            var thumbnail:Sprite = _slides[i].thumbnail;
                                            _thumbnailsContainer.addChild(thumbnail);
                                            TweenLite.to(thumbnail, 0, {colorTransform:{brightness:0.5}});
                                            _slides[i].addEventListener(Slide.CLICK_THUMBNAIL, _clickThumbnailHandler, false, 0, true);
                                            thumbnail.x = curX;
                                            thumbnail.y = -234;//defines y position of the thumbnails row
                                            curX += _THUMB_WIDTH + _THUMB_GAP;
                                  _minScrollX = _IMAGE_WIDTH - curX;
                                  if (_minScrollX > 0) {
                                            _minScrollX = 0;
                         function _setupArrows():void {
                                  _arrowLeft.alpha = _arrowRight.alpha = 0;
                                  _arrowLeft.visible = _arrowRight.visible = true;
                                  _arrowLeft.addEventListener(MouseEvent.ROLL_OVER, _rollOverArrowHandler, false, 0, true);
                                  _arrowLeft.addEventListener(MouseEvent.ROLL_OUT, _rollOutArrowHandler, false, 0, true);
                                  _arrowLeft.addEventListener(MouseEvent.CLICK, _showPrevious, false, 0, true);
                                  _arrowRight.addEventListener(MouseEvent.ROLL_OVER, _rollOverArrowHandler, false, 0, true);
                                  _arrowRight.addEventListener(MouseEvent.ROLL_OUT, _rollOutArrowHandler, false, 0, true);
                                  _arrowRight.addEventListener(MouseEvent.CLICK, _showNext, false, 0, true);
                         function _showNext(event:Event=null):void {
                                  //if there's a _loadingSlide we should assume that the next Slide would be AFTER that one. Otherwise just get the one after the _curSlide.
                                  var next:int = (_loadingSlide != null) ? _slides.indexOf(_loadingSlide) + 1 : _slides.indexOf(_curSlide) + 1;
                                  if (next >= _slides.length) {
                                            next = 0;
                                  _requestSlide(_slides[next]);
                         function _showPrevious(event:Event=null):void {
                                  //if there's a _loadingSlide we should assume that the previous Slide would be BEFORE that one. Otherwise just get the one before the _curSlide.
                                  var prev:int = (_loadingSlide != null) ? _slides.indexOf(_loadingSlide) - 1 : _slides.indexOf(_curSlide) - 1;
                                  if (prev < 0) {
                                            prev = _slides.length - 1;
                                  _requestSlide(_slides[prev]);
                         function _requestSlide(slide:Slide):void {
                                  if (slide == _curSlide) {
                                            return;
                                  //kill the delayed calls to _showNext so that we start over again with a 5-second wait time.
                                  TweenLite.killTweensOf(_showNext);
                                  if (_loadingSlide != null) {
                                            _cancelPrioritizedSlide(); //the user must have skipped to another Slide and didn't want to wait for the one that was loading.
                                  //if the requested Slide's full-sized image hasn't loaded yet, we need to show the progress bar and wait for it to load.
                                  if (slide.imageLoader.progress != 1) {
                                            _prioritizeSlide(slide);
                                            return;
                                  //fade the old Slide and make sure it's not highlighted anymore as the current Slide.
                                  if (_curSlide != null) {
                                            TweenLite.to(_curSlide.image, 0.5, {autoAlpha:0});
                                            _curSlide.setShowingStatus(false);
                                  _curSlide = slide;
                                  _imagesContainer.addChild(_curSlide.image); //ensures the image is at the top of the stacking order inside the _imagesContainer
                                  TweenLite.to(_curSlide.image, 0.5, {autoAlpha:1}); //fade the image in and make sure visible is true.
                                  _curSlide.setShowingStatus(true); //adds an outline to the image indicating that it's the currently showing Slide.
                                  TweenLite.delayedCall(5, _showNext); //create a delayedCall that will call _showNext in 5 seconds.
                         function _prioritizeSlide(slide:Slide):void {
                                  TweenLite.to(_progressBar, 0.5, {autoAlpha:1}); //show the progress bar
                                  _loadingSlide = slide;
                                  _loadingSlide.imageLoader.addEventListener(LoaderEvent.PROGRESS, _progressHandler);
                                  _loadingSlide.imageLoader.addEventListener(LoaderEvent.COMPLETE, _completePrioritizedHandler);
                                  _loadingSlide.imageLoader.prioritize(true); //when the loader is prioritized, it will jump to the top of any LoaderMax queues that it belongs to, so if another loader is in the process of loading in that queue, it will be canceled and this new one will take over which maximizes bandwidth utilization. Once the _loadingSlide is done loading, the LoaderMax queue(s) will continue loading the rest of their images normally.
                         function _cancelPrioritizedSlide():void {
                                  TweenLite.to(_progressBar, 0.5, {autoAlpha:0}); //hide the progress bar
                                  _loadingSlide.imageLoader.removeEventListener(LoaderEvent.PROGRESS, _progressHandler);
                                  _loadingSlide.imageLoader.removeEventListener(LoaderEvent.COMPLETE, _completePrioritizedHandler);
                                  _loadingSlide = null;
                         function _completePrioritizedHandler(event:LoaderEvent):void {
                                  var next:Slide = _loadingSlide; //store it in a local variable first because _cancelPrioritizedSlide() will set _loadingSlide to null.
                                  _cancelPrioritizedSlide();
                                  _requestSlide(next);
                         function _progressHandler(event:LoaderEvent):void {
                                  _progressBar.progressBar_mc.scaleX = event.target.progress;
                         function _clickThumbnailHandler(event:Event):void {
                                  _requestSlide(event.target as Slide);
                         function _rollOverArrowHandler(event:Event):void {
                                  TweenLite.to(event.currentTarget, 0.5, {alpha:1});
                         function _rollOutArrowHandler(event:Event):void {
                                  TweenLite.to(event.currentTarget, 0.5, {alpha:0});
                         function _enterFrameHandler(event:Event):void {
                                  if (_thumbnailsContainer.hitTestPoint(this.stage.mouseX, this.stage.mouseY, false)) {
                                            if (this.mouseX < _SCROLL_AREA) {
                                                      _destScrollX += ((_SCROLL_AREA - this.mouseX) / _SCROLL_AREA) * _SCROLL_SPEED;
                                                      if (_destScrollX > 0) {  //this number is 1/2 the stage size, previously was at 0 it defines the left position of the thumbnails scroll end, has to be indentical to the number below
                                                                _destScrollX = 0;    //this number is 1/2 the stage size, previously was at 0 it defines the left position of the thumbnails scroll end, has to be indentical to the number above
                                                      TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});
                                            } else if (this.mouseX > _IMAGE_WIDTH - _SCROLL_AREA) {
                                                      _destScrollX -= ((this.mouseX - (_IMAGE_WIDTH - _SCROLL_AREA)) / _SCROLL_AREA) * _SCROLL_SPEED;
                                                      if (_destScrollX < _minScrollX) {
                                                                _destScrollX = _minScrollX;
                                                      TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});
                        //if an image fails to load properly, remove it from the slideshow completely including its thumbnail at the bottom.
                         function _imageFailHandler(event:LoaderEvent):void {
                                  var slide:Slide;
                                  var i:int = _slides.length;
                                  while (--i > -1) {
                                            slide = _slides[i];
                                            if (event.target == slide.thumbnailLoader || event.target == slide.imageLoader) {
                                                      slide.dispose();
                                                      _slides.splice(i, 1);
                                                      _setupThumbnails();
                                                      return;

  • Painting Graphics from an Array

    I have a GUI that displays the Towers of Hanoi solution in a JPanel. Everything actually works except for a slight repainting issue.
    Currently I am overriding the paint() function, I know that for my purpose using paintComponent() would probably be the better route, however that's not my issue...
    The images (disks) in my JPanel are not redrawing properly, and I have no idea why...
    Basically:
    - I call setup() to set the number of disks and the co ordinates they should be drawn. (store them in an array)
    - I call moveDisk() to change the co ordinates of each disk as they are being moved.
    - then drawDisk() is called to go through the array of disks and print them.
    currently paint() calls drawDisk() in order to display the current position of all the disks.
    It seems to work fine for the first 2 moves, then disks start disappearing until there is one (the last disk) left...BUT if I print the co ordinates of the disks they seem to be correct, just not drawing.
    could someone take a look at my code and see what is wrong?
    below is the meat of the code, minus the GUI:
        public class HanoiFrame extends javax.swing.JFrame {
        private static final int STATE_SETUP = 0;
        private static final int STATE_ANIMATE = 1;
        private static final int POLE_AREA_HEIGHT = 356;
        private static final int POLE_AREA_WIDTH = 205;
        private static final int DISK_ARC_HEIGHT = 15;
        private static final int DISK_ARC_WIDTH = 15;
        private static final int DISK_HEIGHT = 23;
        private static final int MAX_DISKS = 10;
        private static final int MAX_ANIMATION_DELAY = 30000;
        private static final int MAX_PHYSICAL_DELAY = 100000;
        private static final int MIN_DISKS = 1;
        private static final int MIN_ANIMATION_DELAY = 1;
        private static final int MIN_PHYSICAL_DELAY = 1;
        private static final int EMPTY_CELL_VALUE = -1;
        private static final int CELL_HEIGHT = 25;
        private static final int COLUMNS = 3;
        private static final int ROW = 11;
        private  static final int MILLISECONDS_PER_SECOND = 1000;
        private final static String newline = "\n";
        private static Disk[] disks;
        private static Disk newDisk;
        private static int[][] diskCells;
        public static  int startX = 2;
        public static  int startY = 340;
        public static int setDiskAmount = 0;
        public static int setAnimationDelay = 0;
        public static int  setPhysicalDelay = 0;
        public static int  moveNumber = 0;
        public static int intMovesLeft = 0;
        private boolean  buttonPressed = false;
        private double movesLeft = 0;
        private int windowState = 0;
        /** Creates new form HanoiFrame */
        public HanoiFrame() {
            initComponents();
            /* initialize the "poles" to hold a certain number of "cells */
            this.diskCells = new int[ROW][COLUMNS];
            for (int row = ROW - 1;row >= 0; row--) {
                for (int col = 0;col < COLUMNS ; col++) {
                    diskCells[row][col] = EMPTY_CELL_VALUE;
        private void resetButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           
            /* reset all the variable to original state */
            setDiskAmount = 0;
            setAnimationDelay = 0;
            setPhysicalDelay = 0;
            moveNumber = 0;
            movesLeft = 0;
            intMovesLeft = 0;
            buttonPressed = false;
            windowState = 0;
            this.startButton.setEnabled(true);
            this.diskAmount.setEditable(true);
            this.animationDelay.setEditable(true);
            this.physicalDelay.setEditable(true);
            /* reset all the cell vales to empty (this could be its own function) */
            for (int row = ROW - 1;row >= 0; row--) {
                for (int col = 0;col < COLUMNS ; col++) {
                    diskCells[row][col] = EMPTY_CELL_VALUE;
            /* reset the content of the TextFields and Area */
            this.diskAmount.setText("");
            this.animationDelay.setText("");
            this.physicalDelay.setText("");
            this.outTextArea.setText("");
            /* repaint the display panel */
            this.hanoiPanel.repaint();
        /* i have no idea why this is here...It was generated by Netbeans when I
         *made the reset button.  As you can see it made 2.  The one above it the same
         *except it contains code.  Since it was automatically generated
         *I cannot delete it.
        private void resetButtonMouseReleased(java.awt.event.MouseEvent evt) {                                         
        /* is executed when the start button is pressed.
         *also executes a field check and intializes key variables. Finally,
         *it executes the solution and generates the solve time
        private void startButtonMouseReleased(java.awt.event.MouseEvent evt) {                                         
            /* check if the program has already been run (without being reset) */
            if (!buttonPressed){
                /* check the fields to ensure the input is correct and useable */
                if (checkFields()){
                    /* give button a pressed status if all info valid */
                    buttonPressed = true;
                    windowState = 1;
                    /* disable the button */
                    this.startButton.setEnabled(false);
                    /* disable the fields */
                    this.diskAmount.setEditable(false);
                    this.animationDelay.setEditable(false);
                    this.physicalDelay.setEditable(false);
                    /* setup the disks on the starting pole */
                    setup();
                    /* initialize the number of moves required. 2 to the power of n minus 1 */
                    movesLeft = Math.pow(2, setDiskAmount) - 1;
                    /* convert the number to an integer */
                    intMovesLeft = (int)movesLeft;
                    /* set the physical delay */
                    setPhysicalDelay = Integer.parseInt(this.physicalDelay.getText());
                    /* create and start a new thread.  This is EXTREMELY important
                     *as it allows for GUI to be repainted while the soulution
                     *is animated */
                    SolveEngine s = new SolveEngine();
                    s.start();               
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new HanoiFrame().setVisible(true);
        /*returns the Animation panel area graphics
         *@return Animation area graphics
        public static Graphics getAnimationArea(){
            /* get the usable area of poleA */
            Container clientArea = hanoiPanel;
            //Container clientArea = this.getContentPane();
            /* get the graphics to the display panel*/
            Graphics gfx = clientArea.getGraphics();
            return gfx;
         *set up the requested amount of disks on the first pole
         *@param diskAmount the amount of disks entered by the user
        public void setup(){
            int numberOfDisks = setDiskAmount;
            this.disks = new Disk[numberOfDisks];
            int diskNumber = 0;
            int diskWidth = POLE_AREA_WIDTH - 4;
            int arcH = DISK_ARC_HEIGHT;
            int arcW = DISK_ARC_WIDTH;
            int x = startX;
            int y = startY;
            int row = 0;
            int col = 0;
            /* get the graphics to the display panel*/
            //Graphics gfx = getAnimationArea();
            /* set the color of the disks */
            //gfx.setColor(Color.MAGENTA);
            /* draw the specified number of disks */
            while (diskNumber < numberOfDisks){
                /* reduce the y position */
                y = startY - diskNumber * CELL_HEIGHT;
                /* draw the disk */
                //gfx.fillRoundRect(x, y, diskWidth, DISK_HEIGHT, arcH, arcW);
                /* create a new instance of disk */
                newDisk = new Disk(x, y, diskWidth);
                /* give the new disk an id */
                this.disks[diskNumber] = newDisk;
                /* add the id to the cell array of poleA */
                this.diskCells[row][col] = diskNumber;
                /* make the disk smaller and center */
                x = x + 8;
                diskWidth = diskWidth - 16;
                /* increase disk number */
                diskNumber++;
                /* move to the next row */
                row++;
            repaint();
         *move the disk from a source pole to the destination pole.
         *this should take the source col and destination col to determine where to draw the
         *disk.  It will also need to know to draw the disk in the first available cell
         *in a col
         *@param source the starting pole of the next move
         *@param destination the end pole of the next move
        public void moveDisk(int src, int dest){
            /* the lines below would not be necessary if I were to pass the Graphics
             *gfx object as a parameter.  I may have to use this option in order
             *to work around the current repainting issue */
            /* get the graphics to the display panel*/
            Graphics gfx = getAnimationArea();
            /* get the id of the disk to be moved */
            int disk = getDiskId(src);
            /* get the to and from rows */
            int sourceRow = getRow(src);
            int destinationRow = getRow(dest);
            /* set the co ordintates of the destination */
            int col = dest * POLE_AREA_WIDTH;
            int x = disks[disk].getStartX() + col;
            int y = startY - (destinationRow * CELL_HEIGHT);
            int width = disks[disk].getDiskWidth();
            disks[disk].setStartX(x);
            disks[disk].setStartY(y);
            disks[disk].setDiskWidth(width);
            //System.out.println("startX " + x);
            //System.out.println("startY " + y);
            //System.out.println("destination row " + destinationRow);
            //System.out.println("disk " + disk);
            //System.out.println("Width " + width);
            diskCells[sourceRow - 1][src] = EMPTY_CELL_VALUE;
            /* set the destination row to the disk id */
            diskCells[destinationRow][dest] = disk;
            drawDisk();
            repaint();
        public void drawDisk(){
            int diskNum = setDiskAmount -1;
            int i = 0;
            Graphics gfx = getAnimationArea();
            gfx.setColor(Color.MAGENTA);
            while(diskNum >= 0){
                //System.out.println("here is the disk IDs " + diskNum);
                //System.out.println("the startY during draw " + disks[diskNum].getStartY());
                gfx.fillRoundRect(disks[diskNum].getStartX(), disks[diskNum].getStartY(), disks[diskNum].getDiskWidth(), DISK_HEIGHT, DISK_ARC_WIDTH, DISK_ARC_HEIGHT);
                diskNum--;
        public void paint(Graphics gfx){
            if(windowState == 0){
                super.paint(gfx);
                setup();
            } else if (windowState == 1){
                super.paint(gfx);
                drawDisk();
         *returns the id of the disk
         *@param col the the designated column
         *@return the disk identification number
        public static int getDiskId(int col){
            int diskIdent = 0;
            /* initialize the row number to max -1, because the array start at 0 */
            int row = MAX_DISKS - 1;
            /* do a cell check while row is greater than 0
             *this is done so that is starts at the top row
             *and moves down
            while (row > EMPTY_CELL_VALUE){
                /* when the first cell that is not -1 is reached get the disk number
                 *that disk will be the smallest in the stack */
                if(diskCells[row][col] != -1){
                    //diskIdent = this.diskCells[row][col];
                    diskIdent =diskCells[row][col];
                    break;
                row--;
            return diskIdent;
         *returns the first available row
         *@param col the designated col
         *@return the first available row number
        public static int getRow(int col){
            int rowNumber = 0;
            /* cycle through the cells until it finds an empty one */
            while (diskCells[rowNumber][col] != -1){
                rowNumber++;
            return rowNumber;
         *calculate the total time it takes for the tower of hanoi game to be
         *solved, given the amount of disk and the amount of time it takes
         *to physically move a disk from one pole to the other.
        public static void totalTime(){
            int timeInSeconds = setPhysicalDelay * intMovesLeft;
            int i = 0;
            int seconds = 0;
            int minute = 0;
            int hour = 0;
            int day = 0;
            int month = 0;
            int year = 0;
            while (i < timeInSeconds){
                if(seconds > 60){
                    minute++;
                    seconds = 0;
                if(minute > 60){
                    hour++;
                    minute = 0;
                if(hour > 24){
                    day++;
                    hour = 0;
                if(day > 30){
                    month++;
                    day = 0;
                if(month > 12){
                    year++;
                    month = 0;
                seconds++;
                i++;
            updateMessageCenter("It would take:" + year + " years " + month + " months " + day +
                    " days " + hour + " hours " + minute + " minutes and " + seconds + " seconds, to move " + setDiskAmount +
                    " disks at " + setPhysicalDelay + " seconds per move");
       

    Sorry if my post was a little too cryptic...
    "How do you know? You have a problem you can't solve. Anything could be your issue." Agreed. However, using the process of elimination and debug statments I have been able to narrow the scope of the issue.
    "If you can't solve it by executing the code and adding debug statements how to you expect us to help."If I could solve but "executing code and adding debug statements" there would be no need to post the problem here.
    "We don't know exactly what you are attempting to do."Trying to paint my graphics to a JPanel based on a set of co ordinates.
    "We don't know why you are passing the Graphics object around."Why not? is it impossible to do it this way?
    "The big problem is in the alogorithm you use to determine the location of each component."Who said you couldn't read minds?
    "If you are using some kind of animation then I would use a Timer to schedule the moving of components. I don't even see how you are doing this in your code."Sorry I guess stating that I didn't post my entire code may have threw things off...I do use a timer in a seperate class. I will include it in the next post.
    "I can't tell if you are using Threads of not."guess you overlooked these lines of code:
                    /* create and start a new thread.  This is EXTREMELY important
                     *as it allows for GUI to be repainted while the soulution
                     *is animated */
                    SolveEngine s = new SolveEngine();
                    s.start();   Here is the code once again:
    public class HanoiFrame extends javax.swing.JFrame {
        private static final int STATE_SETUP = 0;
        private static final int STATE_ANIMATE = 1;
        private static final int POLE_AREA_HEIGHT = 356;
        private static final int POLE_AREA_WIDTH = 205;
        private static final int DISK_ARC_HEIGHT = 15;
        private static final int DISK_ARC_WIDTH = 15;
        private static final int DISK_HEIGHT = 23;
        private static final int MAX_DISKS = 10;
        private static final int MAX_ANIMATION_DELAY = 30000;
        private static final int MAX_PHYSICAL_DELAY = 100000;
        private static final int MIN_DISKS = 1;
        private static final int MIN_ANIMATION_DELAY = 1;
        private static final int MIN_PHYSICAL_DELAY = 1;
        private static final int EMPTY_CELL_VALUE = -1;
        private static final int CELL_HEIGHT = 25;
        private static final int COLUMNS = 3;
        private static final int ROW = 11;
        private  static final int MILLISECONDS_PER_SECOND = 1000;
        private final static String newline = "\n";
        private static Disk[] disks;
        private static Disk newDisk;
        private static int[][] diskCells;
        public static  int startX = 2;
        public static  int startY = 340;
        public static int setDiskAmount = 0;
        public static int setAnimationDelay = 0;
        public static int  setPhysicalDelay = 0;
        public static int  moveNumber = 0;
        public static int intMovesLeft = 0;
        private boolean  buttonPressed = false;
        private double movesLeft = 0;
        private int windowState = 0;
        /** Creates new form HanoiFrame */
        public HanoiFrame() {
            initComponents();
            /* initialize the "poles" to hold a certain number of "cells */
            this.diskCells = new int[ROW][COLUMNS];
            for (int row = ROW - 1;row >= 0; row--) {
                for (int col = 0;col < COLUMNS ; col++) {
                    diskCells[row][col] = EMPTY_CELL_VALUE;
        private void resetButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           
            /* reset all the variable to original state */
            setDiskAmount = 0;
            setAnimationDelay = 0;
            setPhysicalDelay = 0;
            moveNumber = 0;
            movesLeft = 0;
            intMovesLeft = 0;
            buttonPressed = false;
            windowState = 0;
            this.startButton.setEnabled(true);
            this.diskAmount.setEditable(true);
            this.animationDelay.setEditable(true);
            this.physicalDelay.setEditable(true);
            /* reset all the cell vales to empty (this could be its own function) */
            for (int row = ROW - 1;row >= 0; row--) {
                for (int col = 0;col < COLUMNS ; col++) {
                    diskCells[row][col] = EMPTY_CELL_VALUE;
            /* reset the content of the TextFields and Area */
            this.diskAmount.setText("");
            this.animationDelay.setText("");
            this.physicalDelay.setText("");
            this.outTextArea.setText("");
            /* repaint the display panel */
            this.hanoiPanel.repaint();
        /* i have no idea why this is here...It was generated by Netbeans when I
         *made the reset button.  As you can see it made 2.  The one above it the same
         *except it contains code.  Since it was automatically generated
         *I cannot delete it.
        private void resetButtonMouseReleased(java.awt.event.MouseEvent evt) {                                         
        /* is executed when the start button is pressed.
         *also executes a field check and intializes key variables. Finally,
         *it executes the solution and generates the solve time
        private void startButtonMouseReleased(java.awt.event.MouseEvent evt) {                                         
            /* check if the program has already been run (without being reset) */
            if (!buttonPressed){
                /* check the fields to ensure the input is correct and useable */
                if (checkFields()){
                    /* give button a pressed status if all info valid */
                    buttonPressed = true;
                    windowState = 1;
                    /* disable the button */
                    this.startButton.setEnabled(false);
                    /* disable the fields */
                    this.diskAmount.setEditable(false);
                    this.animationDelay.setEditable(false);
                    this.physicalDelay.setEditable(false);
                    /* setup the disks on the starting pole */
                    setup();
                    /* initialize the number of moves required. 2 to the power of n minus 1 */
                    movesLeft = Math.pow(2, setDiskAmount) - 1;
                    /* convert the number to an integer */
                    intMovesLeft = (int)movesLeft;
                    /* set the physical delay */
                    setPhysicalDelay = Integer.parseInt(this.physicalDelay.getText());
                    /* create and start a new thread.  This is EXTREMELY important
                     *as it allows for GUI to be repainted while the soulution
                     *is animated */
                    SolveEngine s = new SolveEngine();
                    s.start();
         *Check all the fields at once to ensure that they are valid
        private boolean checkFields(){
            String numberOfDisks = null;
            String animationDelay = null;
            String physicalDelay = null;
            numberOfDisks = this.diskAmount.getText();
            animationDelay = this.animationDelay.getText();
            physicalDelay = this.physicalDelay.getText();
            /* initiate my array of error messages */
            ArrayList errMsg = new ArrayList(0);
            /* check if the number of disks was left blank */
            if (numberOfDisks.equals("")){
                errMsg.add("Please enter the Number of Disks (MAX " + MAX_DISKS + ")");
            }else{
                /* check if the input given is valid */
                try {
                    /* parse the disk amount entered into an integer */
                    setDiskAmount = Integer.parseInt(numberOfDisks);
                    /* check the # of disks entered is greater than 0 and less than 10 */
                    if (setDiskAmount < MIN_DISKS){
                        errMsg.add("Number of Disks must be greater than " + MIN_DISKS);
                    } else if (setDiskAmount > MAX_DISKS){
                        errMsg.add("Number of Disks must be less than" + MAX_DISKS);
                } catch (NumberFormatException ex) {
                    errMsg.add("Number of Disks must be a Number");
            /* check if animation delay was left blank */
            if (animationDelay.equals("")){
                errMsg.add("Please enter disk Animation Delay");
            } else {
                /* check if the input given is valid */
                try {
                    /* parse the animation delay entered into an integer */
                    setAnimationDelay = Integer.parseInt(animationDelay);
                    /* check range of animation delay */
                    if (setAnimationDelay < MIN_ANIMATION_DELAY){
                        errMsg.add("Animation Delay must be greater than 0");
                    } else if (setAnimationDelay > MAX_ANIMATION_DELAY){
                        errMsg.add("Animation Delay must be less than " + MAX_ANIMATION_DELAY);
                } catch (NumberFormatException ex) {
                    errMsg.add("Animation Delay must be a Number");
            /* check if physical delay was left blank */
            if (physicalDelay.equals("")){
                errMsg.add("Please enter the Physical disk delay");
            } else {
                /* check if the input given is valid */
                try {
                    /* parse the physical delay entered into an integer */
                    setPhysicalDelay = Integer.parseInt(physicalDelay);
                    /* check check the range of the physical delay */
                    if (setPhysicalDelay < MIN_PHYSICAL_DELAY){
                        errMsg.add("Physical Delay must be greater than 0");
                    } else if (setPhysicalDelay > MAX_PHYSICAL_DELAY){
                        errMsg.add("Physical Delay must be less than " + MAX_PHYSICAL_DELAY);
                } catch (NumberFormatException ex) {
                    errMsg.add("Physical Delay must be a Number");
            /* if there is any problem, add the message to the popup and display */
            if (!errMsg.isEmpty()){
                JOptionPane.showMessageDialog(this, errMsg.toArray());
                return false;
            return true;
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new HanoiFrame().setVisible(true);
        /*returns the Animation panel area graphics
         *@return Animation area graphics
        public static Graphics getAnimationArea(){
            /* get the usable area of poleA */
            Container clientArea = hanoiPanel;
            //Container clientArea = this.getContentPane();
            /* get the graphics to the display panel*/
            Graphics gfx = clientArea.getGraphics();
            return gfx;
         *set up the requested amount of disks on the first pole
         *@param diskAmount the amount of disks entered by the user
        public void setup(){
            int numberOfDisks = setDiskAmount;
            this.disks = new Disk[numberOfDisks];
            int diskNumber = 0;
            int diskWidth = POLE_AREA_WIDTH - 4;
            int arcH = DISK_ARC_HEIGHT;
            int arcW = DISK_ARC_WIDTH;
            int x = startX;
            int y = startY;
            int row = 0;
            int col = 0;
            /* get the graphics to the display panel*/
            //Graphics gfx = getAnimationArea();
            /* set the color of the disks */
            //gfx.setColor(Color.MAGENTA);
            /* draw the specified number of disks */
            while (diskNumber < numberOfDisks){
                /* reduce the y position */
                y = startY - diskNumber * CELL_HEIGHT;
                /* draw the disk */
                //gfx.fillRoundRect(x, y, diskWidth, DISK_HEIGHT, arcH, arcW);
                /* create a new instance of disk */
                newDisk = new Disk(x, y, diskWidth);
                /* give the new disk an id */
                this.disks[diskNumber] = newDisk;
                /* add the id to the cell array of poleA */
                this.diskCells[row][col] = diskNumber;
                /* make the disk smaller and center */
                x = x + 8;
                diskWidth = diskWidth - 16;
                /* increase disk number */
                diskNumber++;
                /* move to the next row */
                row++;
            repaint();
         *move the disk from a source pole to the destination pole.
         *this should take the source col and destination col to determine where to draw the
         *disk.  It will also need to know to draw the disk in the first available cell
         *in a col
         *@param source the starting pole of the next move
         *@param destination the end pole of the next move
        public void moveDisk(int src, int dest){
            /* the lines below would not be necessary if I were to pass the Graphics
             *gfx object as a parameter.  I may have to use this option in order
             *to work around the current repainting issue */
            /* get the graphics to the display panel*/
            Graphics gfx = getAnimationArea();
            /* get the id of the disk to be moved */
            int disk = getDiskId(src);
            /* get the to and from rows */
            int sourceRow = getRow(src);
            int destinationRow = getRow(dest);
            /* set the co ordintates of the destination */
            int col = dest * POLE_AREA_WIDTH;
            int x = disks[disk].getStartX() + col;
            int y = startY - (destinationRow * CELL_HEIGHT);
            int width = disks[disk].getDiskWidth();
            disks[disk].setStartX(x);
            disks[disk].setStartY(y);
            disks[disk].setDiskWidth(width);
            //System.out.println("startX " + x);
            //System.out.println("startY " + y);
            //System.out.println("destination row " + destinationRow);
            //System.out.println("disk " + disk);
            //System.out.println("Width " + width);
            diskCells[sourceRow - 1][src] = EMPTY_CELL_VALUE;
            /* set the destination row to the disk id */
            diskCells[destinationRow][dest] = disk;
            drawDisk();
            repaint();
            String output = "";
            //must initialize row to max - 1 and increment 'til = 0
            //since the array position starts at 0
            //this will print the array from the top down
            for (int row = ROW - 1;row >= 0; row--) {
                for (int colm = 0;colm < COLUMNS ; colm++) {
                    output = output + diskCells[row][colm];
                output = output + "\n";
            System.out.println(output);
            System.out.println(newline);
        public void drawDisk(){
            int diskNum = setDiskAmount -1;
            int i = 0;
            Graphics gfx = getAnimationArea();
            gfx.setColor(Color.MAGENTA);
            while(diskNum >= 0){
                //System.out.println("here is the disk IDs " + diskNum);
                //System.out.println("the startY during draw " + disks[diskNum].getStartY());
                gfx.fillRoundRect(disks[diskNum].getStartX(), disks[diskNum].getStartY(), disks[diskNum].getDiskWidth(), DISK_HEIGHT, DISK_ARC_WIDTH, DISK_ARC_HEIGHT);
                diskNum--;
        public void paint(Graphics gfx){
            if(windowState == 0){
                super.paint(gfx);
                setup();
            } else if (windowState == 1){
                super.paint(gfx);
                drawDisk();
         *returns the id of the disk
         *@param col the the designated column
         *@return the disk identification number
        public static int getDiskId(int col){
            int diskIdent = 0;
            /* initialize the row number to max -1, because the array start at 0 */
            int row = MAX_DISKS - 1;
            /* do a cell check while row is greater than 0
             *this is done so that is starts at the top row
             *and moves down
            while (row > EMPTY_CELL_VALUE){
                /* when the first cell that is not -1 is reached get the disk number
                 *that disk will be the smallest in the stack */
                if(diskCells[row][col] != -1){
                    //diskIdent = this.diskCells[row][col];
                    diskIdent =diskCells[row][col];
                    break;
                row--;
            return diskIdent;
         *returns the first available row
         *@param col the designated col
         *@return the first available row number
        public static int getRow(int col){
            int rowNumber = 0;
            /* cycle through the cells until it finds an empty one */
            while (diskCells[rowNumber][col] != -1){
                rowNumber++;
            return rowNumber;
         *calculate the total time it takes for the tower of hanoi game to be
         *solved, given the amount of disk and the amount of time it takes
         *to physically move a disk from one pole to the other.
        public static void totalTime(){
            int timeInSeconds = setPhysicalDelay * intMovesLeft;
            int i = 0;
            int seconds = 0;
            int minute = 0;
            int hour = 0;
            int day = 0;
            int month = 0;
            int year = 0;
            while (i < timeInSeconds){
                if(seconds > 60){
                    minute++;
                    seconds = 0;
                if(minute > 60){
                    hour++;
                    minute = 0;
                if(hour > 24){
                    day++;
                    hour = 0;
                if(day > 30){
                    month++;
                    day = 0;
                if(month > 12){
                    year++;
                    month = 0;
                seconds++;
                i++;
            updateMessageCenter("It would take:" + year + " years " + month + " months " + day +
                    " days " + hour + " hours " + minute + " minutes and " + seconds + " seconds, to move " + setDiskAmount +
                    " disks at " + setPhysicalDelay + " seconds per move");
         *add the message to the diplay window
         *currently this is not necessary, but may be required to
         *dynamically display the contents of message into the text area
         *@param message the message to be added/appended the the text area
        public static void updateMessageCenter(String message){
            /* append text to the message */
            outTextArea.append(message + newline);
            /* ensure the the most recent line is viewable - auto scroll */
            outTextArea.setCaretPosition(outTextArea.getDocument().getLength());
        public class SolveEngine extends Thread {
            /** Creates a new instance of SolveEngine */
            public SolveEngine() {
            public void run(){
                /* start the engine/animation */
                solutionEngine(HanoiFrame.setDiskAmount,0, 2, 1);
                /* calculate and print the total time after the solution is complete */
                HanoiFrame.totalTime();
         *the recursive solution to the Towers of Hanoi problem
         *@param diskAmount the number of disks that need to be moved
         *@param start the identity of the starting column
         *@param end the identity of the ending column
         *@param temp the identity of the temporary column
            public void solutionEngine(int diskAmount,int start, int end, int temp){
                int disks = diskAmount;
                int startPole = start;
                int endPole = end;
                int tempPole = temp;
                try {
                    if ( disks == 1 ) {
                        HanoiFrame.moveNumber++;
                        HanoiFrame.updateMessageCenter("Moving disk from  "+ startPole + " to "+ endPole + " Move #: " + HanoiFrame.moveNumber + " of " + HanoiFrame.intMovesLeft);
                        /* delay the movement of the disk */
                        Thread.sleep(HanoiFrame.setAnimationDelay);
                        /* move the disk */
                        moveDisk(startPole, endPole);
                    } else {
                        solutionEngine( disks - 1, startPole, tempPole, endPole);
                        HanoiFrame.moveNumber++;
                        HanoiFrame.updateMessageCenter("Moving disk from  "+ startPole + " to "+ endPole + " Move #: " + HanoiFrame.moveNumber + " of " + HanoiFrame.intMovesLeft);
                        /* delay the movement of the disk */
                        Thread.sleep(HanoiFrame.setAnimationDelay);
                        moveDisk(startPole, endPole);
                        solutionEngine( disks - 1, tempPole, endPole, startPole);
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
        }

  • Help creating an external array for a scoreboard

    I'm trying to create an array in an external file that will recieve and arrange scores sent from Quiz.fla upon clicking the submit score button.  I also want another fla file to be able to reference this external array and pull the top 15 scores from it, and then display those scores on a scrolling banner.  I want the banner to be able to update dynamically (I assume reloading the banner fla each time it reaches the end of its cycle, having the first frame load the external array on an onClipEvent action would accomplish this), that way it will update while remaining open.  The main reason I need two separate files for the quiz and the score banner is they will be displayed on two different monitors.  What would be the most efficient way of accomplishing this?  I know a little about actionscript but I don't have much experience with calling data and functions from external fla or as files (the array and the function designating how the data will be arranged within said array are going to be in a separate .as file).
    I'm currently working in AS2, since I've had almost no experience with AS3.

    So if I wanted to avoid using a server, I'd basically have to set up the
    array storing the high scores in an external .as or .swf file which would
    then be called into the quiz game to store the scores, and then called by
    the banner each time it hits frame 1 to refresh the numbers?  But then that
    would run into the problem of a shared object being used by two different
    clients I guess?  Servers setup and accessing confuses the hell out of me
    right now, so I'm trying not to make things to hellish for myself...
    Would there be a way to create 2 external database files within the folder
    holding the .swf files to somehow get around the issue of one sharedobject
    being accessed by two clients?

Maybe you are looking for

  • Error while executing Jdev10g Appl

    Hi, Please note that I am getting following error while executing my application. Although I have access to update and insert the record on the table,but still it gives the following error. The difference is Its a synonym of the current connected db

  • I updated Firefox to version 29.0.1 and now it won't let me set a home page.

    When I open Firefox, it opens to the Trovi search page, which I don't want. I tried setting the home page by opening the site that I want and dragging its tab to the Home icon, but it didn't change the home page. I also cannot change the default sear

  • Create Purchase Order - Account Assignment Category Q

    Hi experts, I'm trying to create a purchase order with account assignment category "Q" and the system show me the error message ME083 - Enter GR non-valuated. The material type is HIBE. The Quantity and value updating are flagged. Does anybody can he

  • Net price is zero in Header Level

    Hello Experts, I am a newbie in SAP and I have a problem wherein on item level there the net price can be seen however when you view the net price in Header, cumulative net price is = 0. any help will be greatly appreciated. Thanks in advance.

  • Re: QM In Procurement

    Dear All, I am in a situation where I am required to use 103 & 105 while carryimg out the procurement process. I need that when I do the 103 step material should go to quality stock & I should not be able to carry out 105 step untill the result recor