Add the HTTPService call event listener

Hi, I use a HTTP service in my flex application.
My HTTPServeice connects to an XML file:


< mx:HTTPService
ID = 'myResults '.
' URL =' http://localhost/myResults.xml '
resultFormat = "e4x".
result = "resultHandler (Event)" / > "

the data in the XML file are constantly changing (the structure remains the same, but changing the actual data in the structure of the XML), so I am refreshing my HTTPService results every 5 seconds:

[Bindable]
public var myDataFeed:XML;

private function initApp (): void
{
var timedProcess:uint = setInterval (refreshResults, 5000);
}

private function refreshResults (): void
{
myResults.send ();
}

private void resultHandler(event:ResultEvent):void
{
myDataFeed = event.result as XML;
}


My problem is that sometimes the XML file needs more than 5 seconds to load / refresh the data (as it is quite heavy) etc... that is why I want to implement some sort of event on the HTTPService listener to notify the application when the results have been refreshed so I can limit / 5 seconds refresh taking place until the previos refresh is complete etc...

is it possible - to an event listener for an HTTPService to know when it has finished refreshing results to an XML file?

Thank you
Jon.

Instead of having a timer object runs the service every 5 seconds let the service itself run itself once the result is successful.

Both in the
private void resultHandler(event:ResultEvent):void {}
myDataFeed = event.result as XML;

couple options-
1. call the service again... maybe build a kind of late here.
2. run another object that has a delay, then runs the service
I work late here because put the send here will keep your communications with your server constantly active.
myResults.send ();
}

All you need to do is run this service on the initialization of the application and will continue to call itself.

However, I think you may have a fundamental problem with two approaches that your communication with the server is constant. If you need to make other calls to the server, for example to save data or fill out another form, you need to manage your connections.

Tags: Flex

Similar Questions

  • On the motion tween event listener

    Hi all

    I have worked with Flasg CS4 HAVE 3.0 for a few weeks now, and I touched something that left me open-mouthed all by building a portfolio site.

    Staging:

    In order to maintain the low initial file size, I currently use UILoaders to control the content that is currently viewing.  I have five total UILoaders that change the source in that based on what the user clicks on the button.  Each UILoader is nested inside two clips so that I can control the transition animations and so they do not overlap.   Example:

    I.Index/Stage

    A.Parent Movie Clip

    1. nested Movie Clip with custom entering and leaving the motion tweens on the UILoader child.

    a. UILoader

    So far, I was able to use the buttons on the main to shoot to the top of the UILoaders eco-friendly stage.  When you click a button, an event listener calls the UILoader, sets its source and anime 'in' thanks to its parent movie clip.  When you click a different button to replace the source of the UILoader, the original source is anime 'out' with the same parent movie clip.

    Here's the problem:

    I can't understand how to change the source of the UILoader that after the custom motion tween is completed.  I know how to configure a listener of events on each button to change the source of its respectful UILoader, but I need the animation 'out' motion tween to complete to the UILoader before the new source is caught.

    It seems to me that there should be an event listener to attach to button, listen to an interpolation of specific movement at the end and attach a function to change the source of the UILoader only at this time there.

    Here's a sample script that toggles the IULoader source:

    content_mc.profile_btn.addEventListener (MouseEvent.CLICK, profileClick);


    function profileClick(e:MouseEvent):void {}
    profile_mc.profile_mc.profileLoader.source = "Profile.swf";
    profile_mc.gotoAndPlay ("Enter");
    }

    content_mc.work_btn.addEventListener (MouseEvent.CLICK, workClick);

    function workClick(e:MouseEvent):void {}
    profile_mc.gotoAndPlay ("Exit");
    }

    Any ideas?

    I would really appreciate it.

    Yes, you might have a function coded everywhere where he would be executed better and you could call this function at the end of the Tween.  If interpolation is inside a movieclip, then you can precede the function call with MovieClip (parent).  or MovieClip (root).  Depending on how deep you are on children...

    MovieClip (parent) .callFunction ();

    You can also assign an event listener personalized to the movieclip that listen to the parents.  At the end of the Tween in the mc, you might have...

    dispatchEvent (new Event ("imDone"));

    In your parent assign you a listener for the event to the mc.

    youTweeningMC. addEventListener ("imDone", eventHandler);

    function eventHandler(event:Event):void {}
    Regardless of your intentions
    }

  • SX80 xcommand to add the second call

    Hello

    Everyone was able to add a second appeal in a call using xcommands and merge the calls?

    Thanks for the help

    Andrew

    Hi André,.

    I tried a few days ago on the SX20 in my laboratory using the following command and it worked

    xCommand call Join

    Manish

  • remove the on ROLL_OUT event listener

    I am trying to build a miniature scroll from scratch for my first time and I can't thumbs to scroll when the mouse over the arrow to scroll, but I can't seem to stop scrolling, once the mouse takes place. Here's what I have, if anyone can help identify where the function should go.

    leftscroll_mc.addEventListener (MouseEvent.ROLL_OVER, scrollLeft);

    function scrollLeft(e:MouseEvent):void {}

    addEventListener (Event.ENTER_FRAME, goLeft);

    function goLeft(e:Event):void {}

    grds1_mc.x += 6;

    grds2_mc.x += 6;

    grds3_mc.x += 6;

    grds4_mc.x += 6;

    grds5_mc.x += 6;

    grds6_mc.x += 6;

    grds7_mc.x += 6;

    grds8_mc.x += 6;

    grds9_mc.x += 6;

    grds10_mc.x += 6;

    grds11_mc.x += 6;

    leftscroll_mc.addEventListener (MouseEvent.ROLL_OUT, lremoveFast);

    function lremoveFast(e:MouseEvent):void {}

    leftscroll_mc.removeEventListener (Event.ENTER_FRAME, scrollLeft);

    }

    }

    }

    I tried to move the function entire roll_out in all directions, but I would get errors not being is not able to find any lremoveFast but anyway I can't get it to funciton

    The first thing you need to do is to move all these functions outside of the function they are in.  You shouldn't be nested named functions because they do not compile.  When you assign the listener ENTER_FRAME, to remove it you must remove it from where it is added and be sure you clear added - you have things mixed up-wrong target, bad listener.  Another thing you could do is reduce your code using a loop for all those similarly named movieclips.

    leftscroll_mc.addEventListener (MouseEvent.ROLL_OVER, scrollLeft);

    leftscroll_mc.addEventListener (MouseEvent.ROLL_OUT, lremoveFast);

    function scrollLeft(e:MouseEvent):void {}

    this.addEventListener (Event.ENTER_FRAME, goLeft);

    }

    function lremoveFast(e:MouseEvent):void {}

    this.removeEventListener (Event.ENTER_FRAME, goLeft);

    }

    function goLeft(e:Event):void {}

    for (var i: int = 1; i<12;>

    This ["grds" + String (i) + "_mc"] .x += 6;

    }

    }

  • How can I add the show called "Digital camera" by Pixedelic?

    I'm a real novice (Beginner) so if this question seems like a mute, please remember that I am a very simple person.

    I created a Web site that is really just a portfolio company of my wife.  I created four pages (they open in a new window) which are full-screen slideshows.  They agree, but what I really want, isn't slideshows to look like the slideshow which has Pixedelic which is called "Camera".  It's really cool!  See the link below:

    http://www.pixedelic.com/plugins/camera/development/camera_1.0.6/demo/fullscreen.htm

    Can someone give me instructions step by step on how to create this slideshow working on my site of Muse?

    I'd be for always in your debt if you can help!

    Thank you

    Hello

    To use images rasterized, you must do it outside of the Muse and then use in the slide show, use any image editor like photoshop and create images.

    There are similar with wowslider effects if you want to try it.

    http://Wowslider.com/CSS-Gallery-Galaxy-collage-demo.html

    Thank you

    Sanjit

  • Issue to the PPR calling event where it deposits the validation of the page

    Hello

    I need to display the field based on the value of the checkbox.
    I used event PPR clicking chekbox bean. event: update

    I put SPEL in the fields in the form.

    but when ever I select the value in the box, submit the page and pop-up (check all fields mandatory or not)
    It shows failiures of form validation:

    Enter the mandatory fields...

    How to handle this.

    Please help in this.


    Thank you

    Hello

    Please make sure that the event on the box is firePartialAction and disable clietSideValidations.

    Thank you
    Mukesh Uchaniya

  • Help! With the help of event listener to trigger the text

    I use the following code to create the fast Word for a translator who made a direct translation of a cat.

    keyListener = new object()();

    keyListener. ( onKeyDown = function()(){ }

    if (Key. isDown (Key. CONTROL )){

    if (Key. isDown (51) ){

    txt. text = "Sarah says: ';

    }

    }

    }

    Key. addListener () keyListener ();

    keyListener = new object()();

    keyListener. ( onKeyDown = function()(){ }

    if (Key. isDown (Key. CONTROL )){

    if (Key. isDown (51) ){

    txt. text = ' Client says: ";"

    }

    }

    }

    Key. addListener () keyListener ();

    the word is correctly generated, only problem, it deletes all the text in the box of text as well. Is it possible to make a keyboard shortcut that doesn't only add this text on the same line I'm on?

    Otherwise I am also happy to settle for a button that generates this text as long as it does not remove the other text in the text box. any response would be appreciated.

    Thank you

    When you use =, it affects the value on the right to the variable (or text in this case) to the left. Try using +=. For example,.

    txt. Text = 'Hello '.

    txt. Text += "there." //would make "Hello there."

  • The low level event listener?

    One of my screens implements scrolling on curve/bold by implementing the navigationMovement method.  To work properly on a storm, to do the same thing on 'touchEvent.  Can I substitute touchEvent and implement in my screen, but then the screen won't compile for the curve / "BOLD".  I am kicking around ideas to create an application for both types of bberrys file.

    (1) I can detect OS version 4.7 or more old, so I know what I'm running on.

    (2) I could use Class.forName to load two different classes, depending on the version of the OS, but my class of the screen is big enough and I won't maintain 2 nearly identical classes.

    I can not simply substitute touchEvent when compiling with 4.3 because the TouchEvent message is not defined.

    protected boolean touchEvent (TouchEvent message)

    Code of the RIM is mapped TouchEvent.MOVE with the navigationMovement method?  How do you géreriez it?

    Thank you

    Gerry

    Yes, you are always creating dependence on the TouchEvent class.

    There are two ways to reach your goal: compile the views in two libs, one under 4.2 and the other minus 4.7 and compile the main program in 4.2.  Now you can use your policy "getClassForName." The downside is that you have now three files of COD.

    OR... you can use the proprocessor, as I suggested earlier. In this case, you will use the preprocessor inside your factory class so that only the correct view is instantiated. The disadvantage of this strategy is that you will need two projects and two builds. The advantage is a tree of code one and only COD by 'distribution '.

  • Add the new IP address to the listener

    We use RAC Oracle 11g R2 64 bit on Windows Server 2008. The DB of RAC was installed successfully with the good IP scan and the VIP. We have added another NIC with a different IP address. How can I add this IP address to the listener? In version 10g, I can simply add the similar entry in listener.ora. With IP scan, it seems complicated. Someone's done it before? Thank you very much in advance.

    Hello

    11 GR 2 headphones are managed and started since GI home. However, you can always have additional listeners. So, if you want you can configure and start this additional listener say, OH and use a different IP address and/or port. Point to keep in mind that, as the listening port is not managed by the CRS, so this listener will have to be managed manually or in theory, you can also add what CRS managed resource.

    LISTENER_1522 =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP (PORT = 1522))(HOST = ip))
    )
    )

    SID_LIST_LISTENER_1522 =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = sid1)
    )
    )

    sqlplus un/pw@ip:1522/sid1

    Thank you
    Rohit Véronique CHASSAGNE
    http://www.rohitchandok.com

  • Several HTTPService calls...

    Several HTTPService calls to different XML files...

    I have several XML files with data. They all have the same structure but different content. I want to call these XML files and display them in the same provision, having a substitute the previous result. Sounds simple, but I are confused...

    Let's say I have two buttons of the HTTPService calls,
    < mx:Button... click = "Serv1.send ()" >
    < mx:Button... click = "Serv2.send ()" >

    < mx:HTTPService id = "Serv1" url = "data1.xml" >
    < mx:HTTPService id = "Serv2" url = "data2.xml" >

    I have a provision any which goes something like this...
    < mx:TileList... dataprovider="{Serv1.lastResult.collection.object}"/ >

    Let's say I want the second button and call Serv2 and its results place in the TileList. I read about ArrayCollections and models and by sending the service-results of a function and import utilities and result of the event, but I'm a little confused.

    QUESTION:
    Can I just that and please correctly interpret me here... "Serv1.result = Serv2.result;" If you catch my drift?

    PS: As you can imagine, I had trouble getting a thing going and expanded on it quite well and all I want is to add another button, without having to redo everything from scratch...

    Ok. To make it work.


    public function copyHTTP (): void {}
    SERV1 = Serv2;
    }



  • With the help of event with edge to animate and to Captivate listeners

    I just finished to design and develop a custom table of contents on board animate and connected to "get/set" information of Captivate 9.0.2. When you click on a button of Captivate within the project, it will trigger the animation of the table of contents to play, information display you. However, the narrow closure of TOC button is edge animate. When you click the close button in the animation animate dashboard, the animation of the table of contents will reverse play. I also nicely put in place so that the audio/video on the Captivate slide will pause when the table of contents is visible and continue to play when the table of contents are hidden.

    Here's my problem: when you reach the end of the slide and open the edge animate TOC everything behaves as it should. When you then close the border lead the table of contents, the Captivate project continues to play to advance to the next slide. I need that remains in pause/stop until the learner clicks on the button "Next" to move forward. I'll have a hard time integrating event listeners CPAPI_MOVIEPAUSE, CPAPI_MOVIERESUME and CPAPI_MOVIESTOP while maintaining a successful communication between Captivate and animate dashboard. Does anyone know how to get there? Thank you!

    As I do this is to add a variable to the cpInfoCurrentFrame change event listener at the same time the listener to slides of entry. You check if you have reached the end of the slide and to set a variable. If you put this in the head of the index.html:

    var interfaceObj, eventEmitterObj, CSTO = 0; endSlide = false;

    window.addEventListener ("moduleReadyEvent", function (e)
    {
    interfaceObj = e.Data;
    eventEmitterObj = interfaceObj.getEventEmitter ();
    initializeEventListeners();
    });

    function initializeEventListeners()
    {
    If (interfaceObj)
    {
    If (eventEmitterObj)
    {
    eventEmitterObj.addEventListener ("CPAPI_SLIDEENTER", function (e)
    {
    endSlide = false;
    CSTO = e.Data.to;
       
    window.cpAPIEventEmitter.addEventListener ("CPAPI_VARIABLEVALUECHANGED", function (e)
    {
    If (e.Data.newVal > CSTO - 5)
    {
    endSlide = true;
    }}, "cpInfoCurrentFrame".
    );
    });
    }
    }
    }

    Then in the dashboard check file the value of endSlide (window.parent.window.endSlide), if it is true not to resume.

  • Add the line in a table

    Hello

    I am creating a coloring book simple application and I have for the most part work based on the code I found on the web and tutorials. I use a table for my color chart and I'm trying to add a race, but it does not work. The markers in the table are based on a symbol called "Colours".

    Image.jpg

    Here is the action script that I use.

    Table to hold the colors

    var colorArray:Array = new Array(0xE97DB1,0xF58240,0xF9ED41,0x82C34D,0x00B0F0,0x935CA4,0xFFFFFF);

    A new instance of the class of color transformation.

    var colorTrans:ColorTransform = new ColorTransform;

    var currentColor:int = 0;

    This adds the ovals on the scene with the corresponding color of the table

    and the mouse click events.

    for (var i: int = 0; i < colorArray.length; i ++) {}

    var c = new Colours();

    c.y = 500 + i * 50;

    c.buttonMode = true;

    addChild (c);

    colorTrans.color = colorArray [i];

    c.transform.colorTransform = colorTrans;

    c.addEventListener (MouseEvent.CLICK, ovalsClick);

    c.arrayIndex = i;

    }

    This sets the value of currentColour of dynamic property array index.

    function ovalsClick(e:MouseEvent):void {}

    currentColor = e.currentTarget.arrayIndex;

    }

    Adds the mouse click event to the holder.

    holder.addEventListener (MouseEvent.CLICK, holderHandler);

    This function changes the color of the clip to the inside

    When he is selected.

    function holderHandler (e:MouseEvent): void {}

    for (var i: int = 0; i < holder.numChildren; i ++) {}

    If (holder.getChildAt (i) .hitTestPoint (mouseX, mouseY, true)) {}

    colorTrans.color = colorArray [currentColor];

    holder.getChildAt (i).transform.colorTransform = colorTrans;

    }

    }

    }

    Thanks in advance,

    -Owen

    For what I described the code of the loop would be similar to the following...

    for (var i: int = 0; i< colorarray.length;="" i++)="">
    var marker: Sprite = new Sprite();
    Marker.y = 500 + i * 50;
     
    var c = new Colours();
    c.buttonMode = true;
    marker.addChild (c);

    colorTrans.color = colorArray [i];
    c.transform.colorTransform = colorTrans;
    c.addEventListener (MouseEvent.CLICK, ovalsClick);
    c.arrayIndex = i;
     
    var o: Outline = new Outline();
    marker.addChild (o);
     
    addChild (marker);
    }

    In this way your color coding objects remains as it was and you add just a few band-aid around it.

  • Correct the sequence of events for the loading of XML

    I have a complex object in Actionscript that I managed test and loading on a local computer. However, when I publish on the web, different network conditions cause the application trying to access the properties of the complex object before the XML file that defines it is finished processing. So I get null reference errors.

    I'm trying to understand the correct event system to notify my application I want only to access the properties of my complex once the XML file has been finished read to and populated my complex object properties. Any suggestions on what to do?

    I really wish that these forums have a tag formatting code or something so it's horrible, but in general this is what I have:

    package {}

    import flash.events.Event;
    import flash.events.IEventDispatcher;
    import flash.net.URLLoader;
    import flash.net.URLRequest;

    public class {ComplexObject
    private var xmlDoc:XML;
    private var request: URLRequest;
    private var loader: URLLoader;

    private var property1:String;
    private var property2:Number;
    etc.
    Supposed getter and setter functions
    }
    public void loadData() {}
    This.Request = new URLRequest ("config.xml");
    This.loader = new URLLoader (this.request);
    this.loader.addEventListener (Event.COMPLETE, xmlLoaded);
    }
    private void xmlloaded(evt:Event) {}
    this.xmlDoc = XML (this.loader.data);
    fill the object with the elements read from XML file
    This.Property1 = xmlDoc.property1
    etc.
    }
    }

    I can import and instantiate an object of this class in the main MXML file and call the function loadData fine locally. When there are network issues involved (IE on the web) I want the XML processing to occur independently and complete before doing anything else. What is the correct order of events management? My question may be too complex, but any tips or pointers to resources would be appreciated.

    I see nothing obviously 'wrong' with what you do; the complete event should not be distributed until the data has been loaded. I don't see where you apply the actual load.

    However, I use this technique to load XML data. There are easier ways. I would like to use HTTPService with resultFormat = "e4x". The HTTPService result event will be triggered when completely loaded data. You can do either in MXML or ActionScript.

  • How can I check if a function is or is not called the event listener? in Flash CS4 (AS3)

    Hello

    I ran into a small problem.

    I put an event listener inside a loop for and the loop inside a function.

    I want the loop for to end as soon as the listener of events inside the for loop calls the function.

    Here is the general code for a better image.

    Code:

    this.addEventListener(Event.ENTER_FRAME, function#1);
    function function#1(event:Event):void{
              if(something is true){
                        for(var i = 0; i < numOfmy_mcs; i++){
                                  this["my_mc_"+String(i)].addEventListener(MouseEvent.CLICK, function#2);
                        }
              }
    }
    function function#2(e:Event):void{
    //do something cool here
    } 
    

    Thanks for any help!

    You can determine what the event object dispatched using e.target and e.currentTarget.  and it is not supposed to return anything to a listener.

    everything you try to do?  Click on one of a large number of objects and make and/or determine what?

  • Add the event handler as the Internet or through prototype?

    I would try to increase my knowledge of javascript here.

    So, here's what I got so far, and I would like to do better. I have seen that if you click on 1 pixel at the border of a drop-down list in CC ScriptUI, it will have the adverse effect of the selection "null", which has overwritten some of my scripts. This is why I made this 'prototype' which selects the first element, someone should trigger a null inadvertently selection effect by clicking on the border of the dropdownlist control.

    DropDownList.prototype.selectWell = function() {}

    CC will allow you to select the null value

    this.addEventListener ('change', function() {}

    If (this.) Selection == null) {}

    This.items = This.Selection [0];

    }

    });

    }

    The way it works is like this:

    var d = window.add ("dropdownlist', undefined, ["Item 1","2"]");

    d.selectWell ();

    OK, it works, but then you I write "() d.selectWell;' after each dropdown. "

    Each new instance of a DropDownList already it would be possible to write a code that comes with this event listener is added?

    In javascript of the browser, they have querySelector (element) to add a listener for each element of the desired type. I don't know it is also available in ScriptUI.

    I suppose it would be possible to mass of the port of listening via the recursive function assignments, but should be repeated in the windows where the new drop-down menus are added dynamically.
    Also, I could make my own constructor, call SuperDropDownList and in this constructor adds all the necessary headphones and use it to add a menu drop-down that I want to have custom features.

    However, if it could be done with a simple ""DropDownList.prototype ", I would like to know how to do! "

    where is this 1px? I couldn't click on it...

    Here's a way to do

    DropDownList.prototype.onChange = function() {
        //CC will let you select null
    
        alert('on change ' + this.properties.name);
        if (this.selection == null) {
            this.selection = this.items[0];
        }
    
    }
    
    var w = new Window('dialog', '');
    var d = w.add("dropdownlist", undefined, ["Item 1", "Item 2"], {name: 'one'});
    var d2 = w.add("dropdownlist", undefined, ["Item 1", "Item 2"], {name: 'two'});
    //d.selectWell();
    
    w.show();
    

Maybe you are looking for

  • Are there stationery in Thunderbird?

    I'm looking for an e-mail with stationery program. I went through all the information I can find on Thunderbird and I can't seem to find out if it has one or not and if yes, how to use it.

  • IDE #1 error on my Tecra 9000

    I have a combo DVD/CD-RW drive in my Tecra 9000, model number UJDA710. Unfortunately, when I start the laptop, I get the message Error in IDE #1.It will always start in Windows XP, but the drive is not available and isnot shown in Device Manager. I r

  • memory iPhone problem

    Hi all Im having memory problem with my iPhone more than 6 s. It seems I've lost memory without explanation. For 3 days, documents and the data saved in the phone has tripled its registered memory. Is this a virus? < personal information under the di

  • MacBook air will not connect to wifi at all the

    so my air was bought last year (June 3, 2015, to be exact) and the other to have me recheck everythings password a few times was fine, but today the wireless connection just stopped working and I have no idea why? I called my service provider and the

  • Can I use an iphone not activated and unlocked more 6s?

    Hi I want to buy an iphone 6 s more, but I want to use it as a small tablet can I carry everywhere I go to play games and to entertain me. I don't want or need a provider, I just want to be able to use freely as an ipad. Can I use the phone normally