Flex mobile while loop silently failing (halp!)

Here is my code - fairly simple, just trying to add years to an array to use as a data object later.
     public var yearsvar:Array;
     private function createDates():void
     var x:int = new int(1);
     var curYear:Date = new Date();
     var z:int = new int(curYear.fullYear);
     var i:int = new int(z-90);
     while (i < z)
          yearsvar[x] = i;
          i++;
          x++;
     year_dd.dataProvider = new ArrayCollection(yearsvar);
Using some debugging i've narrowed it down to something to do with the yearsvar[x] = i; statement - it gives me no errors and bombs out of the function silently. I'm at a loss as this seems like it should work. Perhaps I'm going crazy and have missed something.

I'm sure there are dozens of ways to do this, here is one.  Sorry about the formatting, this is through email.
public var acYearList:ArrayCollection = new ArrayCollection();
//Populate the yearlist arraycollection with years.
protected function CreateYearList():void
   var dCurrentDate:Date = new Date();
   var nYearCount:int = dCurrentDate.fullYear;
   //Add 90 to the current year for the total, add one to offset for the LT (<)
   var nYearTotal:int = nYearCount + 90 + 1;
   //Loop until year count equals year total.
   for (nYearCount; nYearCount < nYearTotal; nYearCount++)
      //Add the current year to the arraycollection.
      acYearList.addItem(nYearCount);
<!-- Years in a List  -->
<s:DropDownList id="ddlYears" dataProvider="" />
Hope this helps some.

Similar Messages

  • Actionscript - Flex mobile - thread while loading data?

    I am using Flash builder actionscript 3 Flex mobile. I have a very heavy function that loads data from the local device and creates many graphic elements. While this function runs, the device freezes for 6 seconds or so. I want to show a progress bar and let the device continue working, is there any way I can use threading to do this ? Other ideas are also welcome.
    Thanks, Koby.

    Is it the size of the data you're loading (if so have you tried URLStream? or HTTPService with AsyncToken?) and if it's not just a single heavy data load and is the entire operation of loading plus performing the operations on the loaded data then you'll need to consider breaking up those operations into chunks to give the user some feedback.

  • Text positioning not correct while typing in Flex Mobile Text Area

    When I try to write text in Flex mobile TextArea, the text positioning is not correct. What might be the issue? Do I need to specify some Skin Class for it?

    Could be that the font doesn't have Hindi chars support and the text you paste is HTML chars.
    You could try to embed a font you know has the appropriate chars and use that for global and Applications CSS classes.

  • Save data while closing Flex mobile application using HTTPService

    On close of the Flex mobile application I need to save some information to the back-end by using HTTPService.
    On creationComplete() of the application I am adding :
    NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit);
    On close of the mob application, the following method will get call.
    private function onExit(e:Event):void
        httpServiceCall("log event data");
    The request itself is not reaching backend. I have tested this by installing Wireshark, there is no entry if I close the application in wireshark(wireshark will just catch any kind of requests from frontend to backend).
    I am introducing delay to achieve this :
    public var closeTimer:Timer;
                private function onExit(e:Event):void
                    e.stopImmediatePropagation();
                   httpServiceCall("log event data");
                    closeTimer = new Timer(3000,1);
                    closeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, closeApp);
                    closeTimer.start();
                protected function closeApp(event:Event):void{
                    NativeApplication.nativeApplication.exit();
    The above code is not working. As soon as control comes to onExit() method, application is closing.
    According to my understanding, I have to introducesome delay before closing the application to achieve this requirement. How can I introduce delay in this case?

    Try opening Task Monitor and killing any existing "adl" process before launching.
    Does this help ?

  • Flex Mobile : URLLoader bytesTotal always at 0 when loading file

    Hi !
    I'm trying to load external file with UrlLoader in a Flex Mobile Project ( Initialy it was with Data/Services Options of Flash Builder, but I have the same problem ). On the complete event, it work on the desktop ( bytesTotal, xml... ), but when i install my application on my nexus one ( air version : 2.5.0.1660 ), i've no data ( bytesTotal = 0 ), but the cache of the application has grown
    The application has these autorisations :
                <uses-permission android:name="android.permission.INTERNET"/>
                <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
                <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    If someone can help me...
    Thx !
    Vince

    After messing with the URLLoader for a native windows AIR app I gave up on it. That object will return 200, ok, complete, while failing to do what it says it did.
    I never found any way to catch a real error from the server with any of the event listeners for URLLoader.  Instead I used HTTPService, it acutally returns useful data on server errors.  Here is an example, all this is tucked into my own class.
    var service:HTTPService = new HTTPService();
                   service.url = url;
                   service.resultFormat = HTTPService.RESULT_FORMAT_E4X;
                   service.method = URLRequestMethod.POST;
                   service.addEventListener(ResultEvent.RESULT,serviceResult);
                   service.addEventListener(FaultEvent.FAULT,faultResult);
                   service.send(vars);
    private function serviceResult(eResult:ResultEvent):void
                   var objResult:Object = eResult;              
                   if( objResult.result is XML )
                        xmlData = eResult.result as XML;
                        trace(xmlData);
                        dispatchEvent( new Event('eComplete') );
                   else
                        //something wrong
                        trace('BAD! No XML Returned: '+eResult.result);
                        dispatchEvent( new Event('eError') );
    private function faultResult(e:Event):void
                   if( e is ErrorEvent )
                        trace( ErrorEvent(e).text );                   
                   else if ( e is FaultEvent )
                        trace( FaultEvent(e).message.toString() );
                   else
                        trace( 'Unhandled error' );
                   dispatchEvent( new Event('eError') );

  • Windowed Application for Flex Mobile Project

    I have a project intended for both deskotp and mobile, and so I began it as a Flex Mobile project.  I then imported the source into a Flex Air project and everything has been working great--until I added cut and paste functionality using the NativeApplication/NativeWindow model.  On a Mac, because there is a default set of menus, this works just fine, but on a pc, the menu is not present unless you define it.  My top level class is a ViewNavigatorApplication, and I can't for the life of me figure out how to get my NativeWindow NativeMenu built.  I have tried plugging code into creationComplete, initialize, preinitialize, but nothing works.  I also tried putting a WindowedApplication around the ViewNavigatorApplication, but that too failed.
    So is there a way to make this work?  While menu support would be nice, I would settle for just shortcut key support.
    Thanks in advance,
    Adrian

    Umm, overall it's doable but you may come up against two or three hurdles:
    The program may have to run for hoursThat may require keeping the phone handset connected to a charger, especially if the display backlight is configured to be on continuously.
    a sample rate of 20Hz from the sensor.You'll have to cross that bridge when you get there, but I suspect that many handsets won't be able to handle receiving, processing and displaying of data every 50 ms.
    log the data and produce simple statistics from a session.Keeping all data in memory probably won't be feasible; writing it to the record store may make the program still slower, further limiting the sampling frequency that can be handled.
    In future all Java ME related questions should be posted on the [CLDC and MIDP forum|http://forum.java.sun.com/forum.jspa?forumID=76].
    any pointers as to how to beginIf you have never programmed in Java, go through [The Java&#8482; Tutorials|http://java.sun.com/docs/books/tutorial/index.html]. If you have some experience in Java but none in Java ME, [this tutorial|http://today.java.net/pub/a/today/2005/02/09/j2me1.html] will get you through the basics.
    luck, db

  • Flex Mobile Project unable to run on android device

    Hi,
    I Have created basic flex mobile project using flash builder and i could able to run on desk top, but while running the same on device i am getting force close exception also dint get any error log. i am using samsung galaxy pop GT-S5570 as my testing device. i have configured usb driver and enabled usb debugging in  my device too. any help to resolve this process?

    08:20:45.751 Raw device 'sd=sd1,lun=/dev/rdsk/c3t5000CCA03EC50D5Dd0s0' does not exist, or no permissions.
    Looks like either your lun doesnt exist  OR you running vdbnech session not as root.
    (Only a guess )

  • How to run a do-while loop on the 2nd execution after a stop on failure occurs?

    I am trying to use the Stop on Failure process model callback from the TestStand Examples.
    If a step fails within a Do-While loop and the test is terminated, the second time the test is run (continuing to the Next UUT in the process model), the condition for the do-while loop is checked first before it ever enters the loop. This is incorrect because the Do-While loop should execute once and then check the "while" condition.
    Also, If I was to stop the execution altogether and then restart the test (instead of continuing with the Next UUT), it runs the loop once, then checks the "while" condition.
    I'm not sure if I am describing this clearly enough. The execution seems to flow like this:
    Start test
    Do
    NumericTest step FAILS  -> terminate
    Next UUT starts
    While (condition is false and skips over Numeric Test step).
    So it seems that TestStand thinks it's still within that Do-While loop on the second execution and whatever runtime variables are not reset correctly.
    Is this a TestStand bug?  It happens in both TestStand 3.1 and 3.5.
    Is there any way around this?
    Thanks for any help.

    If it is what I think it is, it is a bug. Try unchecking Sequence Properties>>Optimize Non-Reentrant Calls to This Sequence and please tell me if that fixes it.

  • Can't break out of a while loop

    Hi, I am doing a networking course, for which an assignment was to write an echo client and server. I did the assignment in Java and it works just fine. However, there is something I don't understand that is bugging me. I wanted a way to stop the server by either detecting when the client entered "quit" or when the user of the server entered "quit". This was not part of the assignment, but after trying many different things I really want to know (1) what I am doing wrong and (2) what the correct way to do things would be.
    I tried to put an "if" clause within the while loop so that if the client entered "quit" the server would detect that, close the socket connections, and break the while loop. But... it seems that I have done this wrong and I am not sure why.
    (Note - I am not a Java programer - just a beginner, and the course in question isn't a programming course. I did the program below by following some brief guidelines/tutorial. I don't even have any books on Java to consult right now - just ordered few from Amazon for any future projects.)
    The code:
    // EchoServer.java     - a simple server program. It listens on a predetermined port for an incoming connection.
    //                After a client connects they can input a line of text and
    //                the server will echo the exact same line back.
    import java.io.*;
    import java.net.*;
    public class EchoServer {
         protected static int DEFAULT_PORT = 3004;
         public static void main (String args[]) throws Exception {
              int portNumber;          
              try {
                   portNumber = Integer.parseInt(args[0]);
              } catch (Exception e) {
                   portNumber = DEFAULT_PORT;
              ServerSocket myServer = null;
                try{
                   myServer = new ServerSocket(portNumber);      
                   System.out.println("Echo Server started. Listening on port " + portNumber);
              } catch (IOException e) {
                   System.out.println("Could not listen on port: " + portNumber);
                   System.out.println(e);
              Socket clientSocket = null;                         
              try{          
                     clientSocket = myServer.accept();
              } catch (IOException e) {
                     System.out.println("Accept failed:  " + portNumber);
                   System.out.println(e);
              BufferedReader input = null;     
              PrintWriter output = null;
              try {               
                   input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                   output = new PrintWriter(clientSocket.getOutputStream(), true);
              } catch (IOException e) {
                   System.out.println(e);
              String theLine;     
              while(true){
                   theLine = input.readLine();
                   output.println(theLine);     
                   output.flush();
                        if (theLine.equals("quit"))  {
                             input.close();
                             output.close();
                             clientSocket.close();
                             myServer.close();     
                             break;
                        }     // end if
              }     // end while     
         }     // end main
    }          // end EchoClient

    A few observations:
    - You might as well exit after you have caught your exceptions, since none of the conditions I see would allow your program to run properly afterwards. You can either do that by a System.exit(int) or a return;
    - Although this s an example program, you should take advantage of doing things right. Addining a try-finally would be good for tidying things up. First declare your variables before the main try, otherwise the finally won't be able to do its job. For example (this won't compile as is):
    Socket clientSocket = null;
    ServerSocket myServer = null;
    InputStream in = null;
    OutputStream out =null;
    try {
      String theLine = null;     
      while( (theLine = input.readLine()) != null ){
        output.println(theLine);     
        output.flush();
        if (theLine.equals("quit"))  {
           break;
      }     // end while
    } catch ( IOException ex ) {
      ex.printStackTrace();
    } finally {
      if ( in != null ) {
         in.close();
      if ( out != null ) {
         out.close();
      // add other conditions to close other closeable objects
    }The reasoning is that if an exception were ever to happen you would be sure that the clean up would be done. In your current example you may risk having an inputstream left open. Also note that BufferedReader.readLine() returns null when its arrived at the end of its content.

  • Problem with While Loop.

    Hi guys,
    i'm doing a pass exam java question, below is the question criteria.
    Write a program that allows a user to enter their mark attained in each unit and displays their grade. After all marks are entered the average mark is displayed.
    The main method should:
    Prompt the user to enter the number of units taken (check for NumberFormatException)
    Write a for loop to repeat for each subject, where each iteration
    Prompts the user to enter a mark ( a double) for unit 1, unit 2 etc. This should be in a while loop so if mark entered is less than 0 or greater than 100 the prompt will be repeated.
    Pass the mark to a method called getGrade.
    Display the returned grade
    Accumulate each mark
    Print the average mark to 2 decimal places
    The getGrade method should:
    Accept the parameter passed from the main method
    Determine the grade according to the following scale
    Return the grade
    The words that i highlighted in bold is the criteria.
    As you can see from the above question, i create an array , even though the question does not prompt me to create as what i know from tackling JavaQuestions "if it does not prompt me to add a criteria, it is ok to add it" :)
    below is my program code , in which the result i get is the same as the question result. BUT, from the above question it ask me to add a while loop, so if mark entered is less than 0 or greater than 100 the prompt will be repeated.
    But instead i use a do loop. :(
    so can anyone help me or show me how to create the while loop for mark entered is less than 0 or greater than 100 the prompt will be repeated, from my program code below. cause i want to know whether it possible to have a while loop instead of do loop for the my program and the while loop can work with an array criteria.
    thanks
    htw.
    import javax.swing.*;
    import java.text.DecimalFormat;
    public class Mark
        public static void main (String [] args)
            String unitStr;
            String markEnterStr;
            int validUnit;
            double total = 0;
            boolean validInput = true;
            DecimalFormat fmt = new DecimalFormat("#0.00");
            while (validInput)
            unitStr = JOptionPane.showInputDialog(null,"Enter number of units: ");
            try
            validUnit = Integer.parseInt(unitStr);
            double[] markArray = new double[validUnit];
            validInput = false;
            for (int index = 0;index < validUnit; index++)
                do
                markEnterStr = JOptionPane.showInputDialog("Please enter mark " +(index+1) +":");           
                markArray[index] = Double.parseDouble(markEnterStr);
                while(markArray[index] < 0 || markArray[index] >100);
                String correctMark = getGrade(markArray[index]);
                System.out.println(correctMark);
                total = total + markArray[index];       
            double average = (double)total / validUnit;
            System.out.println("Average = " +fmt.format(average));                   
            catch (NumberFormatException e)
            public static String getGrade(double x)
                String grade;
                if (x < 50)
                grade = "Fail";
                else if (x < 60)
                grade = "Pass";
                else if (x < 70)
                grade = "Credit";
                else if (x < 80)
                grade = "Distinction";
                else grade = "High distinction";
                return grade;
    }

    Hope u got it.
               markArray[index] = -1;
                while(markArray[index] < 0 || markArray[index] >100);
                markEnterStr = JOptionPane.showInputDialog("Please enter mark " +(index+1) +":");           
                markArray[index] = Double.parseDouble(markEnterStr);
                }VJ

  • Issues with file upload in flex mobile application (sharepoint as backend)

    Hello,
    I am working on flex mobile application for android platform for which we are having sharepoint as a backend.
    (Flex SDK 4.6 and AIR 3.9)
    Issue which we are facing is as follows:
    We are communicating with the backend server using webservices: example:
    <s:WebService id="kWebService" wsdl="http://www.kservice.net/kdatabaseservice.asmx?WSDL" >
                <s:operation name="AddPost"
                             resultFormat="object"
                             result="addPostResult(event)"
                             fault="postsfaulterr(event)" />
    </s:WebService>
    Above services are working fine but we are facing issue with one service which is related to file upload.
    File upload for <10 MB is working fine but when we try to upload larger file on server it fails to process.
    We are sending bytearray to the backend and backend code is writing those bytearray into file.
    We have tried many ways to overcome from this situation. like we have checked configuration for file upload size on server , we have tried wcf services as well. Please help us on this criticle point as soon as possible
    Thanks
    Dhwani

    Prashant8809 wrote:
    Hi
    >
    > I have already gone through the video by Thomas Jung for multiple file upload but it saves the contents in server and not in >transparent table. So please suggest me alternative solutions.
    >
    >
    > Regards
    > Prashant Chauhan
    What do you mean that my video saves the contents int he server and not in transparent table?  I save the data into a temporary database table so it can be accessed by the parent WDA session. From there the WDA session can do whatever it wants with it.  What do you mean by transparent table - that would be a database table. Do you actually mean internal table?  if so, just read the data from the temporary database table into memory.

  • Wrong use of "Scan From String" function in a while loop?

    Hi,
    I've got a "Scan From String" function inside a while loop. On the first iteration it converts correctly the number passed by the input string (for example 4) But on the second one it has only spaces (one or more \s) as input string.
    I expected to obtain a zero as output (as it does always that it can not make any conversions, as I am supposed to) but indeed, i subtracts 1 from the previous number (according to the number indicated as example I would obtain a 3 as output)
    What's wrong with this?
    Does the function fails on this case?
    The rest of the diagram o the VI is expected to manage a 0 on that situation, like others in which the conversion is not made.
    Andres.

    I have simplified the VI evading calls to other VIs and trying to reproduce the mistake.
    The type of string I introduce to reproduce the mistake is:
    clock 3 (30) clock (40)
    Forgetting to introduce a number between the second "clock" and the following parenthesis, I would manage it programmatically with code that isn't included.
    Then "Scan From String" is supposed to do not make a conversion. But it leaves a 2 as output (in this example)
    I have realised, unbelievable but true, that it has matter with the number I substract to the output number (if it were 2, I would obtain 1 as output and so on)
    Excluding that, I got the conversion made before as output, 3, on the second time that "Scan From String" executes. But, how can this func
    tion as bad?
    I am using LV4 on an old PC. I have tried to reproduce it with LV6 and it works. But it isn't desirable for me, I would have to convert a lot of VIs and surely I will find a lot of errors due to the conversion (I have already tried)
    Attachments:
    EXTCLOCK.VI ‏26 KB

  • Multiple instances of identical vi inside a while loop

    We have a while loop that is monitoring 6 sensors in a heated water bath.
    Each sensor has the same basic switching parameters.
    While the loop runs, it does not tie the shift register value to the same instance every time it runs.
    The 6 instances of the Switch Pass or Fail.vi in the attached project have a dummy 1, 2, 3, 4, 5, 6 value and we don't know how to tell the main program which instnace to run when a switch switches.....
    So far, everything else works, but we can't get the Switch Pass or Fail.vi to run the same way twice...
    Attachments:
    switch pass or fail vi question Oct 17 2011.zip ‏575 KB

    Stepping back to our "inception" problem.. we have a problem, within a problem, within a problem...
    Before we can answer our other problems, we need to be able to test our VI and can't figure out how to update a bank of shift registers, one at a time, without having the wires break when we don't update each output from the case structure on each case.  The VI won't let us run by populating one output from a wire to different shift registers in a "bundle" vi.
    The goal of the attached VI is to have "TMP Reg" input, initial, shift register, values into the "switch pass or fail.vi" and have the output on the "trip temp out" wire update only the shift register in the "bundle" associated with that switch.
    example: the first case structure entry "1" would output the "trip temp out" value to the first entry in the bundle to update the first shift register.  Then, when the second case ran, it would update the second entry in the bundle to update the second shift register, and so on, until all six cases (switches) had thier shift register values updated.
    Attachments:
    cycle through updating shift registers without re-writing the others.png ‏148 KB
    clusters now feed the RGTR_FX.png ‏195 KB

  • Flash Builder 4.5.1 - Problem compile Flex Mobile release build

    I am building a flex mobile applicaiton using Flash Builder 4.5.1. The application works fine on the device (Nexus S) and desktop in the debug mode however, whenever I export the release build the app is not installed on the device automatically. When I manually install .apk it also fails (get Application not installed message with green check mark). Any thoughts?

    Getting a big closer... Compiled .swf using mxmlc, then manually packaged .apk without any issues... When I try to run: adb install -r myapp.apk: I get the following error:
              pkg: /data/local/tmp/myapp.apk
    Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
    Perhaps certificates are not respected?

  • Imaging.s - while loop - preboot bundle

    I've noticed that either 11.2 or 11.2.1 has added a while loop to imaging.s
    the comments indicate it is to allow multiple activities to take place.
    i have a preboot bundle that runs img to lay down some zmg files. nice and simple.
    in this new scenario, the preboot script just repeats (never exits).
    I've had a look around but i haven't found anything that i'm suppose to change to suit the new regime.
    anyone else in this situation ?
    currently, i've comment out the while loop in imaging.s to allow execution as we would expect it, but it's not the right answer as it will have to be edited for every update.
    in my script should i be attempting to export a result code so that the "export IMGSUCCESS=1;break;" lines can get acitivated ?
    Code:
    #!/bin/bash
    # imaging.s
    . /bin/config.s auto
    mountFloppyifLS120
    # Do imaging in a loop and break out when done.
    # This allows advanced script in an auto session to check for more work to do
    while [ 1 ]; do
    #check for environment variable with command to run
    if [ "a0" = "a"${#IMGCMD} ] ; then
    /bin/img a
    #Return codes for img:
    # 0 SUCCESSFUL, but no changes on hard drive(s)
    # 1 SUCCESSFUL, new image placed on hard drive(s)
    # 2 SUCCESSFUL, proxy had no work to be done
    # 4 SUCCESSFUL, advanced script brought down to be run
    # 1124 SUCCESSFUL, Third Party Imaging Task
    else
    if test -f "$IMGCMD" ; then
    # if the file is a regular file, assume it is a script and in unix format
    /usr/bin/dos2unix $IMGCMD
    /bin/chmod +x $IMGCMD
    fi
    $IMGCMD
    fi
    RESULT=$?
    if [ $RESULT"a" = "0a" ] || [ $RESULT"a" = "1a" ] || [ $RESULT"a" = "2a" ] || [ $RESULT"a" = "1124a" ] ; then
    export IMGSUCCESS=1
    break;
    elif [ $RESULT"a" = "4a" ] ; then
    dos2unix /bin/zenAdvancedScript
    chmod +x /bin/zenAdvancedScript
    . /bin/zenAdvancedScript
    mv /bin/zenAdvancedScript /bin/zenAdvancedScript.sav
    else
    echo ZENworks imaging failed with error:$RESULT.
    echo ZENworks imaging failed with error:$RESULT. > /tmp/img.log
    break;
    fi
    done
    #always run sidChange. It checks to determine if it will do any work or not
    sidChange
    if test -f /update/ZUpdate.s ; then
    #update to new version of ZEN imaging client
    . /bin/update.s
    fi
    /bin/grub.s auto

    peterhine,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

Maybe you are looking for