More trouble with for loops

This was my attempt:
function poor(){if(money < shopwin["prc"+$].text){shopwin["itm"+$].textColor = 0x999999;
shopwin["prc"+$].textColor = 0x999999;}
if(money >= shopwin["prc"+$].text){shopwin["itm"+$].textColor = 0xFFFFFF;
shopwin["prc"+$].textColor = 0xFFFFFF;}
for ($=1;$<9;$++){poor();}  
at compressing this:
function poor(){
if(money < shopwin.prc1.text){shopwin.itm1.textColor = 0x999999;
shopwin.prc1.textColor = 0x999999;}
if(money < shopwin.prc2.text){shopwin.itm2.textColor = 0x999999;
shopwin.prc2.textColor = 0x999999;}
if(money < shopwin.prc3.text){shopwin.itm3.textColor = 0x999999;
shopwin.prc3.textColor = 0x999999;}
if(money < shopwin.prc4.text){shopwin.itm4.textColor = 0x999999;
shopwin.prc4.textColor = 0x999999;}
if(money < shopwin.prc5.text){shopwin.itm5.textColor = 0x999999;
shopwin.prc5.textColor = 0x999999;}
if(money < shopwin.prc6.text){shopwin.itm6.textColor = 0x999999;
shopwin.prc6.textColor = 0x999999;}
if(money < shopwin.prc7.text){shopwin.itm7.textColor = 0x999999;
shopwin.prc7.textColor = 0x999999;}
if(money < shopwin.prc8.text){shopwin.itm8.textColor = 0x999999;
shopwin.prc8.textColor = 0x999999;}
if(money >= shopwin.prc1.text){shopwin.itm1.textColor = 0xFFFFFF;
shopwin.prc1.textColor = 0xFFFFFF;}
if(money >= shopwin.prc2.text){shopwin.itm2.textColor = 0xFFFFFF;
shopwin.prc2.textColor = 0xFFFFFF;}
if(money >= shopwin.prc3.text){shopwin.itm3.textColor = 0xFFFFFF;
shopwin.prc3.textColor = 0xFFFFFF;}
if(money >= shopwin.prc4.text){shopwin.itm4.textColor = 0xFFFFFF;
shopwin.prc4.textColor = 0xFFFFFF;}
if(money >= shopwin.prc5.text){shopwin.itm5.textColor = 0xFFFFFF;
shopwin.prc5.textColor = 0xFFFFFF;}
if(money >= shopwin.prc6.text){shopwin.itm6.textColor = 0xFFFFFF;
shopwin.prc6.textColor = 0xFFFFFF;}
if(money >= shopwin.prc7.text){shopwin.itm7.textColor = 0xFFFFFF;
shopwin.prc7.textColor = 0xFFFFFF;}
if(money >= shopwin.prc8.text){shopwin.itm8.textColor = 0xFFFFFF;
shopwin.prc8.textColor = 0xFFFFFF;}
poor();
I tried a similar code to the first (above) for the following list, but it also failed.
shopwin.itm1.text = m_shop.inv.itm1.nm; shopwin.prc1.text = m_shop.inv.itm1.prc;
    shopwin.itm2.text = m_shop.inv.itm2.nm; shopwin.prc2.text = m_shop.inv.itm2.prc;
    shopwin.itm3.text = m_shop.inv.itm3.nm; shopwin.prc3.text = m_shop.inv.itm3.prc;
//(I actually needed 5 more just like this for itm4 through itm8)
I based the top code on this:
function buy(){if(actionBox == m_shop.inv["itm"+n].nm && money >= m_shop.inv["itm"+n].prc){
    char.inv["itm"+n] = m_shop.inv["itm"+n]; money = money - m_shop.inv["itm"+n].prc;} ;}
for (n=1;n<9;n++){buy();}
which worked fine. I should mention this last code is nested inside an "onRelease" as are the others.

I will second the Flash suggestion. Great a .flv file and play it on your site with a flv player. Some are more difficult than others to use.
NOTHING is fool proof with this kind of stuff. Flash has the highest install rate on all computers and is as close as you can get to fool proof. You can also put a link on you site to download the latest flash player. The other plus is that it tends to have the best results with low file sizes. This is what YouTube and similar sites use to play their video.
PS. I highly suggest this flv player... It's free for non-commercial use and almost free for other uses...
http://www.jeroenwijering.com/?item=JWFLVPlayer

Similar Messages

  • Trouble with "for loop"

    Hi all,
    how can I fix this problem
    Rookie; LV 2011 on WIN 7
    Solved!
    Go to Solution.

    Jkhourigan wrote:
    Disable indexing on the right hand side of the for loop.
    Consider using shift registers instead.
    That will indeed clear the error message but then your For loop will want to know how many times to iterate and I suspect you will only want to iterate once so why use the For loop?
    Toss it.
    If you were using the For loop to ensure a delay ... after (?) the transmit ...
    THere is no guarentee the wait will happen after since the is no data flow dependencies. If wan to delay after, add another frame between Xmit and rcv. Please note that I am talking about the most basic data flow ideas that drive LabVIEW and in serious coding data flow alone should drive the program execution and seq frames are used sparingly.
    Quesion anything I said above. Since the paradigm shift for LV may be weird.
    You at least have gotten past the "how do I wire things up?" challenge that frustrated me when I got started.
    Have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Troubles with for-loop

    Hi I'm new her...
    Could anybody explain to me why my code is not doing what i want it to do.
    I want to get
    xxx
    xx
    x
    and not
    X
    X
    X
    X
    X
    X
    I'm doing a German course, but can't find it anywhere. Starting to get desparte after 3 hours searching!
    public class Aufgabe5 {
    public static void main (String[] args) throws Exception {
      for(int zeile = 1; zeile <=3; zeile++) {
       for(int spalte = 1; spalte <= zeile; spalte ++) {
        System.out.println("+");
       System.out.println(" ");
    }Edited by: javastartert on Nov 4, 2008 11:45 AM
    Edited by: javastartert on Nov 4, 2008 11:45 AM
    Edited by: javastartert on Nov 4, 2008 11:45 AM
    Edited by: javastartert on Nov 4, 2008 11:47 AM

    thanks for the help!i think it's an important clue....
    now i got a new thing, and a new question
    now i want to make a sandglass with java ( 5 stars, 3 stars, 1 star, 3 stars, 5 stars)
    xxxxx
    xxx
    x
    xxx
    xxxxx
    and than in the nice sandglass form offcourse.. (can't get it that way over here in this topic)
    but it doesn't seem to work.. where did i go wrong?
    public class Aufgabe5 {
         public static void main(String[] args) {
              final int memory = 5;
              final char sign = '+';
              int count = 0;
              int selection = 1;
              switch (selection) {
              case 1: {
                   for (int size = memory; size > 0; size -= 2, count++) {
                        if (count != 0) {
                             System.out.println();
                        for (int line = count; line > 0; line--) {
                             System.out.print(' ');
                        for (int digits = size; digits > 0; digits--) {
                             System.out.print(sign);
                   break;
              case 2: {
                   int size = memory;
                   while (size > 0) {
                        if (count != 0) {
                             System.out.println();
                        int line = count;
                        while (line > 0) {
                             line--;
                             System.out.print(' ');
                        int digits = size;
                        while (digits > 0) {
                             digits--;
                             System.out.print(sign);
                        count++;
                        size -= 2;
                   break;
    }

  • I am feeling so ripped off right now. I have wanted a Mac for years and believed the hype about it's stability and I have had more trouble with this Imac 2011 than I have ever had with a pc. It locks up with several software products from APP store.

    I am feeling so ripped off right now. I have wanted a Mac for years and believed the hype about it's stability and I have had more trouble with this Imac 2011 than I have ever had with a pc. It locks up with several software products from APP store. I have already had to have a technician to look at it and really couldn't figure out what the deal was.  I was told that the APP store software should give me no problems but the truth is that it locks up on the software. This machine is only 4 weeks old and I am using 37 g on a 1 T hard drive. There is no reason for it to be locking up. Also, when I try to use the help program, it always tells me that I am not connected to the internet even though I have used both the mail program and the browser with no problem just before that. I successfully used the help program on my pc lots of times. I did not need a $2000. plus machine to just get email. I just wanted to unload on somebody that might understand my pain and after checking out this site...I think there is a few of you out there.

    I was told that the APP store software should give me no problems but the truth is that it locks up on the software.
    The apps downloaded from the Mac App Store are written by third party developers, not Apple. If you have problems  with those apps you need to visit the support area for their websites. Launch the App Store, locate the app name. You should see a support link.
    when I try to use the help program, it always tells me that I am not connected to the internet even though I have used both the mail program and the browser with no problem just before that
    Go to ~/Library/Preferences. Move the com.apple.helpviewer.plist file from the Preferences folder to the Trash. Restart your Mac, try the Help menu.
    If you need help finding that file, hold down the Finder icon in the Dock then click: New Finder Window. From the menu bar top of your screen click: Go > Go to Folder. Type this in exactly as you see it here:   ~/Library/Preferences/com.apple.helpviewer.plist    That will take you right to that file.
    (.plist) files stores information about a particular app or in this case, the Help viewer. Often times deleting the .plist file resolves the issue.
    It's fine to "unload"... we understand that you expect your iMac to be stable but there are times when things go awry. That's why we have these forums so that you can you get help.
    You may want to read up on how to repair the disk if necessary or reintsall Lion >  OS X Lion: About Lion Recovery
    Apple - Find Out How - Mac Basics
    How to "switch" from PC to Mac >  Apple - Support - Switch 101
    I'm sorry you feel, "ripped off", but you are using the world's most advanced operating system and it may take some time to adjust to a new OS.   http://developer.apple.com/technologies/mac/

  • Help on changing array elements with For loop

    Hi,
    I'm wondering if anyone can help me with this problem.  I'd like to be able to modify elements of an array with For loop.  In the attached VI, my goal is to have an array of [0 1 2 3 4 5], but instead what I've got is [2 2 2 2 4 5].  I initialized the array with a value of 2 to help me identify which elements are changing.  Can anyone help me pointing where my mistake is?  Thanks.
    Peter
    Attachments:
    Array test.vi ‏19 KB

    It's a classic issue for LV newbies. In this case you HAVE to use a
    shift register otherwise the modifications of previous cicles are lost.
    It's all easier than it's seems, see attached vi.
    bye,
    manga
    Attachments:
    Array test 2.vi ‏19 KB

  • Having trouble with garageband loops are out of time with other loops

    having trouble with garageband have bought loops from primeloops and beat loops are not in time when i paste other loops down for example certain loops do not lock into measure region correctly .. so say for instance i lay down my beat then i try to add hi hat below and the beat is not in time with hi hat any awnsers may have pressed some setting accidently because this hasn t happened before as previously using these loops were all in time and locked at correct measures ..

    The GarageBand experts await you here:
    https://discussions.apple.com/community/ilife/garageband

  • Visa open and close with "for loops"

    Hello everyone
    In my program I used two "for loops" which include visa write and read for a RS32 port. it is not possible to close a devise with visa close as the out put is changed to 2D array!!! would you please help me with this error
    Attachments:
    ACU_232.png ‏108 KB

    sam009 wrote:
    Thanks for reply,
    It works for "for loop" but what about "event structure loop" still is error for that. 
    Right-click on the output tunnel and uncheck "Use Default if Unwired".  You will now be forced to wire the VISA Resource through each case.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Issue with FOR loop in Nested BEGIN and END terminals

    Hi All,
    I am trying to fetch row by row using FOR loop on CURSOR.An i am getting Error attached screen shot:
    Below is the logic:
    Create Procedure TEST1() LANGUAGE SQLSCRIPT AS
    BEGIN
    AN01 = Select * from AN.View;
    AN02 = SELECT DISTINCT F1,F2,F3 from :AN01 GROUP BY F1,F2,F3;
    BEGIN
    DECLARE CURSOR ITEM_RULE FOR select F1,F2,F3 from :AN02;
    FOR V_ITEM_RULE AS ITEM_RULE DO
    SELECT * from TABLE1 where F1 = V_ITEM_RULE.F1;
    END FOR;
    END;
    END;
    Here i an getting data from AN01..Then finding the Distinct in AN02.
    On AN02 i am applying CURSOR...and for each row i wanted to find an entry in TABLE1 and do a calculation further.
    -- But when i am using a FOR loop in the Nested BEGIN i am getting below Error.
    -- I tried to Activate successful without FOR Loop.
    Any Suggestion on the above issue.
    Thanks
    kalyan

    Hi Kalyan,
    Your procedure is incomplete.
    Why are you looping to make a select that you do not use? What is the target for ITEM_RULE_GDS selection?
    Also, like it is currently exposed a JOIN is highly recommended.
    Are you just playing around with procedure or you really have a scope to do ?
    Regards, Fernando Da Rós

  • More trouble with PDF folios

    Hi.
    I also have a trouble with PDF folios, where vertical article has 2 pages and horizontal article has 1 page.
    When i set that folio horizontal swipe only, there will be one extra blank page at the horizontal article.
    When there is more pages in articles (4 and 2 accordingly), there is no such artifact.
    Ants.

    have you tried my example that I just posted here: http://forums.adobe.com/message/4173179#4173179
    With kind regards,
    Klaasjan Tukker
    Adobe Systems

  • Move MCs with for loop?

    I'm trying to figure out a way to move movie clips with a for loop
    I've got 10 dots called dt1-dt10 and I want to be able to set them all to y = 200.
    I understand i can set i=1;i<11;i++
    like
    for(i=1;i<11;i++){
    dt+i._y = 200;}
    or
    for(i=1;i<11;i++){
    String("dt"+i)._y = 200;}
    but the rest of it is a mess and either doesn't work, or glitches. I have yet to find a for loop help file for moving multiple movie clips.

    If you just want to immediately change the positions of the instances, then using a for loop will work okay, you just need to use the bracket notation [ ] to have strings be interpreted as instance names...
    for(i=1;i<11;i++){
         this["dt"+i]._y = 200;

  • Help me with for loop please...............

    hi guys i m just new bie as you know
    i gotta print these things........
    from 7 stars to 1 star........
    i did it like this but it only produce
    in this way,,,,,,
    how do we actually padding the space and print it as the example........
    help me guys whoever experts in for loops my code is........
    class triangle
         public static void main (String[] args)
              a(7);
         public static void a (int num)
              for (int j = num ; j > 0 ; j--)
                   for (int i = 0 ; i < j ; i++)
                        System.out.print("*");
                   System.out.println ();
    }

    You really need a better screen name,
    The problem is is that you want to print out a descending number of stars
    preceded by a number of spaces . the number of spaces for a line is the number of characters - number of stars so
              for (int j = num ; j > 0 ; j--)
    HERE print the required spaces!
                   for (int i = 0 ; i < j ; i++)
                        System.out.print("*");
                   System.out.println ();

  • I feel ashamed but would someone help me with for loops?

    Hello all,
    Firstly, apologies. I feel ashamed. I am not new to programming but new to Java, so imagine my frustration at my blatant stupidity why I can't get this for loop to work....
    public void initGame(String[] arrTemp) {
    for (int i = 0; i > 4; i++) {
    frmGameOptions.append("hello" + arrTemp[i] + "-" + txtBully);
    basically the above method does not work!
    arrTemp does contain elements, trust me!
    it seems at though the loop isn't even getting entered!
    please help me!!!!!!!!!!!!!!!
    poncenby

    i think you want
    for (int i = 0; i < 4; i++)
        frGameOptions.append("hello" + arrTemp[i] + "-" txtBully);
    a better way would be
    for (int i =0; i < arrTemp.length; i++){
        frGameOptions.append("hello" + arrTemp[i] + "-" txtBully);
    }

  • More Trouble with queue permissions

    In my last message I was having trouble with enqueuing to a queue using a PL/SQL wrapper around my java eneque class. I was getting this message:
    JMS-173: Queue Table BPTEST2.COMMAND_TABLE not
    found
    It turned out I did not set the correct authorization on the stored procedure. I needed to add the clause AUTHID CURRENT_USER and my problem was fixed.
    Now i have attempted to take this one step further and execute the stored procedure from a trigger. Now I am back to the same error. Is there a way to set the authorization in a trigger? If not, whose authorization is the trigger running under, the definer or oracle itself?
    null

    have you tried my example that I just posted here: http://forums.adobe.com/message/4173179#4173179
    With kind regards,
    Klaasjan Tukker
    Adobe Systems

  • Trouble running for loop

         public void enterBackMultiple(int number)
              System.out.println("Number of times to run loop is: " + number);
              for(int i = 0; i < number; i++);
                   line.enqueue(new Customer());
                   System.out.println("Adding a customer.");
              System.out.println("Done running enterBackMultiple Method.");
         }When I pass in 5, the loop is suppose to run 5 times. Instead I get this:
    Number of times to run loop is: 5
    Adding a customer.
    Done running enterBackMultiple Method.
    Which shows that the for loop only ran once. It should've printed "Adding a customer" 5 times. Whats going on??
    EDIT: nvm i see whats wrong. stupid mistake. Thanks.
    Edited by: backtoreality15 on May 19, 2008 5:40 PM

    Here is your for loop again. See if you can spot the mistake now.
    for(int i = 0; i < number; i++); {
        line.enqueue(new Customer());
        System.out.println("Adding a customer.");
    }Edited by: flounder on May 20, 2008 10:54 AM
    Ah, so you already spotted the mistake.

  • So close but need help comparing strings in different subforms with for loop - Livecycle ES

    For some reason I was not able to post this in the Livecycle ES forum, even though I've posted there often in the past.
    I have created a form that I almost have working and I'm hoping someone can help me.
    We have eight billing teams in our company and each team works anywhere from 1 - 4 different clients. The form is used to track, per Billing Rep, the number of items of mail that each billing r5ep works each day. What I'm needing to add at the bottom is a subform that tracks the totals by client. So I'm trying to get the form to loop through all of the existing subforms (and the subforms within them) and compare a cell int he bottom subform to a cell in the other subforms, which are dynamically added, and then total ONLY those items. My script however is not working.
    What I have now is:
    var repCount = form1.P1._rep.count
    var itemCount = form1.P1.rep._ItemSet.count
    for (x=0; x<repCount; x++)
         for (i=0; i<itemCount; i++)
              if(clientName.rawValue == P1.rep[x].ItemSet[i].client.rawValue)
              this.rawValue = this.rawValue + P1.rep[x].ItemSet[i].corresp.rawValue;
    It seems like this should work but I'm getting the following error:
    P1.rep[x] is undefined
    So what it looks like is I'm missing is the proper way to reference the objects in these subforms.
    The form is here: https://acrobat.com/#d=20gWXZ4sBm4OPV6oO76zSg
    If someone could take a look at it I would be so grateful.
    Thanks,
    Jo

    I don't know that anyone else will ever have a similar problem as what I was having, but I figured I would go ahead and post the solution, just in case....
    The error I was getting (P1.resolveNode("rep[" + j + "].ItemSet[" + i + "]") is null) was occuring because the variable itemCount needed to be referenced within the repCount For Loop. I also needed to resolve the node for the itemCount, which I wasn't doing.
    So...my old code was this:
    var repCount = P1._rep.count;
    var itemCount = P1.rep._ItemSet.count;   //this part was throwing the error. Needed to use resolveNode...and needed to not declare the variable until inside the first For Loop.
    var nTotal = 0;
    for (var j=0; j<repCount; j++) {
        for (var i=0; i<itemCount; i++)    {
            if (P1.resolveNode("rep["+ j +"].ItemSet["+ i +"]").client.rawValue == clientName.rawValue) {
                nTotal = nTotal + P1.resolveNode("rep["+ j +"].ItemSet["+ i +"]").corresp.rawValue;
    this.rawValue = nTotal;
    ...which wasn't working because it was trying to reference the count of the ItemSet right up front...but it needed to wait until it got inside the first iteration of the repCount subfields...AND it needed to have resolveNode used.
    The corrected code is:
    var repCount = P1._rep.count;
    this.rawValue = 0;
    for (var j=0; j<repCount; j++) {
        var itemCount = P1.resolveNode("rep["+j+"]")._ItemSet.count;  //corrected code...node is resolved and variable is declared within the first subform repCount.
        for (var i=0; i<itemCount; i++)    {
            if (P1.resolveNode("rep["+ j +"].ItemSet["+ i +"]").client.rawValue == clientName.rawValue) {
                this.rawValue = this.rawValue + P1.resolveNode("rep["+ j +"].ItemSet["+ i +"]").corresp.rawValue;
    ...which now works perfectly...and I'm throwing a party to celebrate! LOL
    Jo

Maybe you are looking for

  • How to add a (new) Predefined Property in Search

    Hello All, I have created new Predefined Properties called as ReqNo and it holds an integer value. <b>I wanted to know how can I make this field available in the Search Functionality?</b> There is an option in Search wherein one may search using Pred

  • Message monitoring link error in RWB

    hi, When we select adapter engine in RWB in SAP XI It throws an error: java.lang.AbstractMethodError: com/sap/aii/mdt/api/server/AdapterFrameworkHome.create(Ljava/util/Locale;Ljava/util/TimeZone;Ljavax/ejb/Handle;Ljavax/management/ObjectName;Ljava/la

  • Come back to screen

    Hi All,       I am using a program which contains screen.       i have created Selection screen as we do for normal report.In start-of-selection i am calling screen1.       When i press back button in screen1 it should come to my selection screen.   

  • Access Profile

    Hi All, I have a query on the access profile, for a single user who is assigned to a role called FIELD SALES has two access profiles DEFAULT & OWNER. DEFAULT = Will be the acccess levels for the records not onwed by him & in the same book (book funct

  • Clear a buffer

    I have a buffer that is generating 5 min worth of data and feed it to a queue. The data is later dequeued into a seperate while loop and plot in a graph. My goal is programmatically refresh the buffer. I tried to used flush queue after the data is be