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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:30:59+00:00 2026-05-20T14:30:59+00:00

I’m at a lose end and would really appreciate some help as it is

  • 0

I’m at a lose end and would really appreciate some help as it is way out of my comfort zone with as3. Basically I have a sales presentation showing on a screen in various offices where I work. These show daily sales figures that can change as and when somebody makes a sale. I have an swf loading data from an XML file into slides and everything works great apart from if the XML file changes at the moment I need to force a refresh (manually). I’d like to make it so that if the file changes it automatically reflects in the swf. So far my research has pointed me to AS3 Socket Communication but I haven’t been sucessful in finding a relevant tutorial.My code is below, if anyone could point me in the right direct i’d greatly appreciate it.

//
//XML LOADING
//

var xmlfile:String;
var xmlf:String =  stage.loaderInfo.parameters.xmlfile;

if(xmlf!=null){
    xmlfile = xmlf;
}else{
    xmlfile = "file path";
}

var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, function(evt:IOErrorEvent):void {},false,0,true);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadingDone);
xmlLoader.load(new URLRequest(xmlfile));

////////////////////////////////////////////////////////////////////////////////////////////


//
//socket connection text  
//
var xmlSocket:XMLSocket = new XMLSocket();
var hostName:String = "hostname";

var connectionOpen:Boolean = false;

xmlSocket.addEventListener(Event.CONNECT, onSocketConnection, false, 0, true);
xmlSocket.addEventListener(DataEvent.DATA, onSocketResponse, false, 0, true);
xmlSocket.addEventListener(Event.CLOSE, onSocketClose, false, 0, true);
xmlSocket.addEventListener(IOErrorEvent.IO_ERROR, onIOError, false, 0, true);

function onSocketConnection(evt:Event):void {
//option to go here
connectionOpen = true;
trace("connection open");
      }

function onSocketResponse(evt:DataEvent):void {
    //option to go here
}

function onIOError(evt:IOErrorEvent):void {
//option to go here for error
}

function onSocketClose(evt:DataEvent):void {
    //option to go here
    xmlSocket.close();
    connectionOpen = false;
}

///////////////////////////////////////////////////////////////////////////////////////////

//
//XML DATA PARSING AND IMAGE LOADING STARTER
//

function xmlLoadingDone(e:Event):void {
    xmlLoader.removeEventListener(Event.COMPLETE, xmlLoadingDone);

    var XMLdata:XML = new XML(e.currentTarget.data);

    }
  • 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-20T14:31:00+00:00Added an answer on May 20, 2026 at 2:31 pm

    You will need to a polling loop, basically set up a Timer and have the elapsed timer handler reload the XML.

    Make the loop interval as long or as short as you think necessary.

    Update:

    This code sample can be added to your existing code…

    // Add these imports at the top...
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    
    
    // Then insert this code...
    var delay:int = 30000;   // 30 seconds. (as milliseconds)
    var repeat:int = 0;      // continue until the Timer is stopped.
    
    var pollingLoop:Timer = new Timer(delay, repeat);
    pollingLoop.addEventListener(TimerEvent.TIMER, timerHandler);
    
    pollingLoop.start();     // begin polling.
    
    function timerHandler(e:TimerEvent):void{
        // We do the xmlLoading in the timer handler...
        xmlLoader.load(new URLRequest(xmlfile));  
        // So remove the other copy of this ^ line from your code.
    } 
    
    // The xmlLoader handler now looks after the rest.
    

    That should do what you need.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.