A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: XML not updating help?

  1. #1
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315

    XML not updating help?

    I have a working file that rotates SWF's in a loop from an XML file. The problem I'm having is that the loop isn't updating when XML file updates...

    I've tried the [.xml?vers="+vers] with no success. You can also see the other updates/refreshes that I've tried. Any ideas?

    Here's the AS:
    Code:
    #include "mc_tween2.as"
    Stage.scaleMode = "noscale";
    
    ///////////////////////////////////////
    next_btn._alpha = 50;
    prev_btn._alpha = 50;
    play_btn._alpha = 50;
    stop_btn._alpha = 50;
    
    // Fade functions
    function fadeIn(){
    container._alpha = 0;
    container.alphaTo(100,3,"easeOutExpo");
    }
    function fadeOut(){
    container.alphaTo(0,3,"easeOutExpo");
    }
    
    // Load XML
    function loadXML(loaded) {
    	if (loaded) {
    		xmlNode = this.firstChild;
    		swiff = [];
    		total = xmlNode.childNodes.length;
    		for (i=0; i<total; i++) {
    			swiff[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
    		}
    		firstswiff();
    		} 
    	else {
    		content = "ERROR: Not loaded!";
    	}
    }
    
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    
    xmlData.load("ondemand.xml");
    // End of xml
    
    my_loader = new MovieClipLoader();
    my_loader.addListener(this);
    function onLoadInit(mc:MovieClip) {
    	preloader._visible = false;
    }
    function onLoadProgress(container, bL, bT){
    	perc = Math.round((bL/bT)*100);
    	preloader._visible = true;
    }
    var k:Number = 0;
    
    function firstswiff(){
    	my_loader.loadClip(swiff[k], container);
    	fadeIn();
    }
    
    // External swf files call this function 
    // Call function AScode:    _root.nextswf();
    function nextswf(){
    	k++;
    	fadeIn();
    	if(k > total-1){
    		k=0
    		fadeIn();
    		my_loader.loadClip(swiff[k], container);
    	}
    	fadeIn();
    	my_loader.loadClip(swiff[k], container);
    }
    Last edited by intromo; 02-25-2009 at 04:32 PM.

  2. #2
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Anyone?

  3. #3
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Ok - I've tried all of these, with no sucess as well.... had anyone done this sucessfully?

    PHP Code:
    randNum Math.random() * 1000000;
    // the end of your XML call action
    // "filename.xml?" + randNum


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



    xmlData.load("yourxml.xml" "?uniq=" + new Date().getTime());


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

    Examplexml.load
    myXML
    .load("markers.xml?"+Math.random());

    Exampleloadvars
    var random Math.random();
    loadVariables("http://www.mysite.com/myASP.asp?foo="+random,"GET");


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

  4. #4
    newb of many sorts Ralgoth's Avatar
    Join Date
    Apr 2002
    Posts
    466
    All of those should work.

    I know this is obvious, but are you uploading the updated xml file to the correct url? I only ask because I've overwritten files in my root directory, only to find that I was calling to a sub-directory.

    You might try putting an xml in a new location, calling it with http://www.mysite.com/newfolder/filename.xml?1234

    then make a change, upload it and call it again with http://www.mysite.com/newfolder/filename.xml?5678
    Search first, asked questions later.

  5. #5
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Thanks for the response Ralgoth!

    I've tried everything above with no success....
    I've double-checked paths. All is good there, however, I think it may have something to do with [_root]. This code is NOT on the main timeline. It's within an MC. The main timline only has 1 frame. Could that be it, AND how could I get around it?

  6. #6
    newb of many sorts Ralgoth's Avatar
    Join Date
    Apr 2002
    Posts
    466
    The location of the code shouldn't matter.

    Does the problem occur when you're running the swf locally, from the server, or both?
    Search first, asked questions later.

  7. #7
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Quote Originally Posted by Ralgoth View Post
    The location of the code shouldn't matter.

    Does the problem occur when you're running the swf locally, from the server, or both?
    I'm running the xml from an http path.

    Here's my xml:

    PHP Code:

    <?xml version="1.0" encoding="iso-8859-1"?>

    <swf>

        <swiff>
            <id>Y:\NOWPLAYING\promo\drawingin.swf</id>
        </swiff>
        
    </swf>

  8. #8
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    Ok - for some reason, this thing just doesn't want to auto-update the XML file. Here's my latest AS:

    PHP Code:
    function loadXML(loaded) { 
        if (
    loaded) { 
            
    xmlNode this.firstChild
            
    swiff = []; 
            
    total xmlNode.childNodes.length
            for (
    i=0i<totali++) { 
                
    swiff[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue
            } 
            
    firstswiff(); 
            } 
        else { 
            
    content "ERROR: Not loaded!"
        } 


    xmlData = new XML(); 
    xmlData.ignoreWhite true
    xmlData.onLoad loadXML

    // make a timestamp, add to xml url to force fresh data
    vers = new Date().getTime();

    xmlData.load("http://www.domainname.com/ondemand.xml?vers="+vers); 

    _parent.my_brian = new MovieClipLoader(); 
    //var k:Number = 0; 
    function firstswiff(){ 
        
    _parent.my_brian.loadClip(swiff[0], _parent.container_drawingin); 


  9. #9
    I know nothing.
    Join Date
    Feb 2008
    Posts
    315
    I will post the [FLA] later tomorrow.
    Last edited by intromo; 04-16-2009 at 05:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center