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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:07:41+00:00 2026-05-23T15:07:41+00:00

Here’s the concept for this relatively simple Flash app I’m building: Check an XML

  • 0

Here’s the concept for this relatively simple Flash app I’m building:

  1. Check an XML file on a server.
  2. Display content based on tags, whether type is image or video.
  3. Each has a displayTime value. The content should only stay up for that long, then go on to the next.

So here’s my XML file:

<?xml version="1.0" encoding="UTF-8"?>

<livefeed>

    <timeUpdated string="121213" />

    <content type="image" url='image01.jpg' displayTime="5" />
    <content type="image" url='image02.jpg' displayTime="5" />
    <content type="image" url='image03.jpg' displayTime="5" />

</livefeed>

And here’s a bit of my ActionScript 3:

function onload(e:Event):void {
    var xml:XMLList = new XMLList(xmlholder.data);
    var xmlContent:XMLList = xml.content;
    if(xml.timeUpdated.@string != currentTimeUpdated) {
        currentTimeUpdated = xml.timeUpdated.@string;

        for each (var content:XML in xmlContent) {
            if (content.@type == 'image') {
                var myImageLoader:Loader = new Loader();
                var imageURLRequest:URLRequest = new URLRequest(content.@url);

                myImageLoader.load(imageURLRequest);
                myImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);

                function imageLoaded(e:Event):void {                                
                    var newTimer:Timer = new Timer(content.@displayTime * 1000); // update every 10 seconds
                    newTimer.start();
                    newTimer.addEventListener(TimerEvent.TIMER, addImage);

                    function addImage(e:TimerEvent):void {
                        addChild(myImageLoader);
                    }

                } 
            }
        }
    }
}

So it’s not working for me as I want it to. I know I’m going about this wrong but not sure how else to do it. I really wanted it to just show the content, pause, go to the next content, pause, then loop.

Any ideas/suggestions on how I should be doing this or how I can improve?

Thanks!

  • 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-23T15:07:42+00:00Added an answer on May 23, 2026 at 3:07 pm

    Does this code currently work? You seem to be pilling too much up into a single function – running a bunch of loaders all at once, and using nested functions to deal with the results. I haven’t tried it, but it looks a little confused. (I try an stay away from nested functions, btw).

    I would break all of this up into a separate chain of functions. You need a sequence that, once the xml has been loaded:

    1. initiates the image load
    2. responds to the load event
    3. then captures the image as loaded data,
    4. adds the image into the display list, removing the previously loaded image
    5. finally, start a timer, and when it fires, start the sequence up again.

    You will need another xml parser / controller function that attends to the image queue – something that just checks the current image count, increments it, and instigate the load sequence again.

    You may want to add a couple more steps to run a loading spinner graphic while the load is running, or something, or in some way deal with the interchange from one graphic / video to the next.

    Hopefully you’ve got a grasp on as3 and can figure this out from here. Let me know if you have any hangups. I do have complete classes built out that do exactly all this, and I can share if you need it.

    Cheers

    – update –

    For now, it “works” as in, the script
    pauses for 5 seconds (with a blank
    canvas), then displays all the images
    at once instead of sequentially

    This is because you are initiating all your loaders in a single foreach loop, instead of activating individual sequences over time. Definitely not what you want.

    – queue handling –

    So, you have your xml object, which is just a repeated data structure. Importantly, it has a length property, and can be navigated as an index. To traverse this in a chained sequence, you probably need an independent counter variable that you can increment / decrement.

    private var _count:uint = 0;
    
    private function controlQueue(){
    
        var target: String = xmlContent[_count].@url; //or however you are obtaining this
        initiateLoad(target);
    
        _count++: //increment counter
    
        if(_count > xmlContent.length){ _count = 0}; //if counter exceeds length, swing back around
    }
    
    private function initiateLoad(target:String){ ...
    

    If you are allowing for user control, then you could pass controlQueue a “direction” argument which could dictate _count++ or _count–;

    Pretty simple, but handy.

    Hope that helps-

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

Sidebar

Related Questions

Here's a coding problem for those that like this kind of thing. Let's see
Here is the scenario: I'm writing an app that will watch for any changes
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
I have just tried to save a simple *.rtf file with some websites and
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is my code, which takes two version identifiers in the form 1, 5,

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.