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 7732357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:42:39+00:00 2026-06-01T06:42:39+00:00

I’m trying to fill some data from an xml feed we made into my

  • 0

I’m trying to fill some data from an xml feed we made into my Flash movie. The main action of this is in the constructor for MediaElementJS’s .as file.

Anyway, the main problem is that I keep reading there is no way to load a URL synchronously in AS3 (which i still find hard to believe). This constructor calls both parse('url') and a function addEventListener(EVENT.ADDED_TO_STAGE, initializeAds);

Now the ads need info from the XML but the XML aint ready yet. I tried to call the ads at the end of the XML parser when I knew it would be prepped but it messes them up and the ad values never change from their defaults..

Oh wherefor art thou actionscript locking mechanism..

So is there anyway to preload data from a URL?

CODE:

    public function LoadXML(e:Event):void 
    {
        removeEventListener(Event.COMPLETE, LoadXML);
        var xmlData:XML = new XML(e.target.data);

        episodeData.pre.type    = xmlData.episode.pre.ad.@type;
        episodeData.pre.url     = xmlData.episode.pre.ad.text();

        episodeData.video       = Number(xmlData.episode.video.@id);    /*************** I CAN'T REMEMBER ***********/
        episodeData.pageTitle   = xmlData.episode.video.@pagetitle;
        episodeData.title       = xmlData.episode.video.@title;
        episodeData.source      = xmlData.episode.video.source.text();


        episodeData.post.type=xmlData.episode.post.ad.@type;
        episodeData.post.url=xmlData.episode.post.ad.text();

        episodeData.nextEpisode=xmlData.episode.post.nextepisode.text();    //if not empty redirect to this

        xmlLoading = false;
//THIS IS WHERE I TRIED TO CALL THE FUNCTION I NEED TO LOAD LATER
    }

    public function parse()
    {

        var xmlLoader:URLLoader = new URLLoader(); 
        //var xmlData:XML = new XML(); 
        xmlLoader.load(new URLRequest(rootURL + '/episode.aspx?associd=' + _episode)); 
        //xmlLoader.addEventListener(Event.COMPLETE, processXML);
        xmlLoader.addEventListener(Event.COMPLETE, LoadXML); 
    }

I’ve tried it with a static URL address and whatnot of course but no dice.

The code in the constructor works if I dynamically assign a static value but if I try chaining to events together to get the dynamic value and dynamic assignment it crunches.

In the constructor, definitely runs both by themselves:

        parse();

        // Google IMA EventListener
        addEventListener(Event.ADDED_TO_STAGE, initialize);
  • 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-06-01T06:42:40+00:00Added an answer on June 1, 2026 at 6:42 am

    Edit START

    When I have multiple asynchronous calls that happen and I need something to happen after both of them are done I usually use booleans to store if each one has happened yet, then in a third function they both call I check both the booleans.

    Here’s how I’d do that:

    protected function viewnavigatorapplication1_preinitializeHandler(event:FlexEvent):void
    {
        var loader1:Loader = new Loader();
        var loader2:Loader = new Loader();
    
        loader1.addEventListener(Event.COMPLETE, loader1_completeHandler);
        loader1.load(new URLRequest("http://www.whitehouse.gov"));
        loader2.addEventListener(Event.COMPLETE, loader2_completeHandler);
        loader2.load(new URLRequest("http://www.nasa.gov"));
    }
    
    private function loader1_completeHandler():void
    {
        loader1Done = true;
    
        //Maybe do some stuff here
    
        moveOn();
    }
    private function loader2_completeHandler():void
    {
        loader2Done=true;
    
        //Maybe do some stuff here
    
        moveOn();
    }
    
    
    private function moveOn():void
    {
        if(!loader1Done||!loader2Done)
            return;
    
        //Do whatever needs to be done once both asynchronous events have completed
    }
    

    If this isn’t your problem I think you need to provide more of the code in place of the comments that indicate other things happen, because it is a bit unclear.

    For example I’m not sure what you mean by “The code in the constructor works if I dynamically assign a static value but if I try chaining to events together to get the dynamic value and dynamic assignment it crunches.” Also since there’s no example of the data or what the rootURL is there’s no way to debug from here to understand what’s going wrong.

    Since there’s no error we would need to be able to re-compile some portion of your code locally to give any better feedback.

    Edit END

    Blocking or synchronous calls are a horrible idea with regard to network communications due to the lack of reliability of networks and/or servers. If a front end application locked up to wait for a response before doing any other processing it would result in a horrible user experience, this is why there is no synchronous remote calls.

    What happens with a synchronous call when the server bombs out, the client remains locked even though no response will result, the user can’t interact with anything else in the front-end because it’s waiting for said response which will never come? It’s much better that remote calls of any sort are done in an asynchronous fashion, the same is true with local disk access in Java (or otherwise) where using asynchronous non-blocking calls is generally a better way to go to allow the other processes within an application to continue regardless of the state or use on the disk.

    What you’re doing should work just fine, you make a call to a remote service, it responds with some result and hits your “listener” or “callback” function then you want to do something with the results you can call another function, and the data is there.

    It sounds to me like the only thing that’s not happening is updates after the fact aren’t being reflected in the UI, this is probably due to a lack of Bindable metadata/event dispatching for the properties. Have you inspected the result in the event that returns, have you put breakpoints in the method that is meant to be called after the data has returned? What you’re doing is completely possible and it even looks like you have most of it right, but there’s definitely something your doing wrong that’s resulting in you not being able to make this work. If you can explain the behavior a bit clearer that will help, also what do you do here:

    //THIS IS WHERE I TRIED TO CALL THE FUNCTION I NEED TO LOAD LATER

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string

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.