Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 854081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:51:52+00:00 2026-05-15T07:51:52+00:00

I want to access a webservice:getMonitorData() , on creationcomplete and returns an array, in

  • 0

I want to access a webservice:getMonitorData() , on creationcomplete and returns an array, in an infinite loop so that the getIndex0.text is updated each time.

Flex is not able to handle an infinite loop and gives a timeout error 1502. If I run the for loop until i<2000 or so it works fine.

How can replace the loop so that my webservice is accessed continiously and the result is shown in getIndex0.text.

This is how my application looks like:

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark" 
         xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" 
         xmlns:plcservicebean="server.services.plcservicebean.*"
         creationComplete="clientMonitor1()">
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.rpc.CallResponder;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;


            [Bindable] public var dbl0:Number;

//-----------Infinite Loop, Works fine if condition = i<2000------------------------
            public function clientMonitor1():void{
                for(var i:int = 0; ; i++){
                    clientMonitor();                    
                }
            }

            public function clientMonitor():void{
                var callResp:CallResponder = new CallResponder();
                callResp.addEventListener(ResultEvent.RESULT, monitorResult);
                callResp.addEventListener(FaultEvent.FAULT, monitorFault);
                callResp.token = plcServiceBean.getMonitorData();
            }

            public function monitorResult(event:ResultEvent):void{
                var arr:ArrayCollection = event.result as ArrayCollection;
                dbl0 = arr[0].value as Number;
            }

            protected function monitorFault(event:FaultEvent):void{
                Alert.show(event.fault.faultString, "Error while monitoring Data ");
            }
        ]]>
    </fx:Script>
    <fx:Declarations>
        <plcservicebean:PlcServiceBean id = "plcServiceBean" 
                                       showBusyCursor="true" 
                                       fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" />
    </fx:Declarations>

    <mx:Form x="52" y="97" 
             label="Double">
        <mx:FormItem label = "getMonitorValue">
            <s:TextInput id = "getIndex0"
                         text = "{dbl0}"/>
        </mx:FormItem>
    </mx:Form>

</s:Group>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:51:53+00:00Added an answer on May 15, 2026 at 7:51 am

    Your problem is that your loop runs synchronously while the actual web service calls are asynchronous. Flex uses a frame-based execution model and only has a single thread of execution — when you make a call to the webservice, it initiates the connection and returns immediately. Looping forever, then, means that you’ll never actually get to the next frame, where the result could be processed. Looping 2000 times means you spawn 2000 connections straight away, which will be queued up as you’re not allowed to make that many connections at once. They will then complete over the next few minutes.

    The way to do what you want to do is probably to wait until one request is complete before firing the next. To achieve this, you can call clientMonitor() from the end of your event handlers, or set up an extra event handler specifically to call clientMonitor() when the request completes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nested movie clip instance that I want to access. The path
I want to access a inventory system which is accessible through webservice, What is
I want to access the call stack at runtime in a Native C++ application.
I want to access a UIImage programmatically... i.e. myImage.hidden = TRUE; etc. I can
I want to access my sql server database files in a INTEL SS4000-E storage.
I want to access a MySQL database directly from JavaScript code in an HTML
I want to access MySQL through ruby on a shared linux server. I figure
I have an versioned document store which I want to access through an dict
I wrote a DLL in .NET and I want to access it in VBScript.
I want with ant access a subversion-repository and get a list of files available

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.