Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
suppenhuhn

Is it possible to load my XML not from cache?

Recommended Posts

Hi,

 

i load my external swf's via your fantastic!!! XMLLoader object. I'm adding from time to time a new swf to this XML. Now, to load the "new" XML i thought to make it via:

 

<meta http-equiv="expires" content="0">

 

But here it loads always the whole content new ( and that is quit a few ). But the "old" content does not change, i will only add one or two swf's to it.

 

Due to the fact i'm wondering if it's possible to load the xml always from the server and not from the browser-cache?

Link to comment
Share on other sites

If you don't want it to use the browser cache for a particular asset, you can add noCache:true to that loader's vars. For example:

new XMLLoader(..., {noCache:true, ...});
Link to comment
Share on other sites

  • 1 year later...

 

If you don't want it to use the browser cache for a particular asset, you can add noCache:true to that loader's vars. For example:

new XMLLoader(..., {noCache:true, ...});

 

Hi!

 

Now i do have a question on a detail.

 

 

I'm loading a XML into my movie like this:

var LoadRequest:URLRequest = new URLRequest("myURL");		
			
			
			LoaderMax.activate([SWFLoader]);
			
			queue = new XMLLoader(LoadRequest,{ name:"xmlDoc",
					noCache:true,
					maxConnections:1, 
					estimatedBytes:5000, 
					onComplete:queueCompleteHandler,
					onProgress:queueProgressHandler,
					onChildProgress:swfProgressHandler,
					onChildComplete:swfCompleteHandler
					});
		
			
			queue.load();

My XML looks like this:


<?xml version="1.0" encoding="iso-8859-1"?> 
<data>
	
	<SWFLoader name="Name-1" url="myUrlToSWF-1.swf" load="true" autoPlay="false" width="250" height="330" centerRegistration="true"  estimatedBytes="232000" x="0" y="0"  />
	<SWFLoader name="Name-2" url="myUrlToSWF-2.swf" load="true" autoPlay="false" width="250" height="330" centerRegistration="true"  estimatedBytes="232000" x="0" y="0"  />
	<SWFLoader name="Name-3" url="myUrlToSWF-3.swf" load="true" autoPlay="false" width="250" height="330" centerRegistration="true"  estimatedBytes="232000" x="0" y="0"  />
	etc ...	
</data>

When loading with this XML new XMLLoader(..., {noCache:true, ...}) will there be only the XML not been loaded from cache or will the SWFs also not load from cache?

 

I want to load only the XML not from cache - because i want to load different XMLs on/for specific date-periods.

Link to comment
Share on other sites

setting noCache:true on the XMLLoader does not affect the children. They will still load from the cache.

 

You can test your files in Google Chrome and use dev tools to track network activity and see which assets get loaded from the cache

 

http://i.imgur.com/ynqN4GY.png

 

notice in the image above that the XML file has a cacheBusterID and you can see how much file size was downloaded, whereas the png images say "from cache"

Link to comment
Share on other sites

setting noCache:true on the XMLLoader does not affect the children. They will still load from the cache.

 

Hi, it's me again ;-)

 

Sorry but i can't find it in the Docs and don't use Chorme -> If i want one specific swf to be not loaded from cache..can i mark this param within the XML like this ( the second Child ):

<?xml version="1.0" encoding="iso-8859-1"?> 
<data>
	
	<SWFLoader name="Name-1" url="myUrlToSWF-1.swf" load="true" autoPlay="false" width="250" height="330" centerRegistration="true"  estimatedBytes="232000" x="0" y="0"  />
	<SWFLoader name="Name-2" url="myNoChacheSWF.swf" noCache="true" load="true" autoPlay="false" width="250" height="330" centerRegistration="true"  estimatedBytes="232000" x="0" y="0"  />
	<SWFLoader name="Name-3" url="myUrlToSWF-3.swf" load="true" autoPlay="false" width="250" height="330" centerRegistration="true"  estimatedBytes="232000" x="0" y="0"  />
	etc ...	
</data>

Or how can i get this done? Thanks in advance.

Link to comment
Share on other sites

It works ! :-) But only online and not on localhost ?

 

But one question:

 

I load various SWFs into my mainSWF and all are added to the Stage as a Child and also pushed into a array.

 

But there is one special SWF i'd like to handle different:

It needs to be added into an existing empty mc on the stage: mySpecialSWFContainer and also not pushed into the array

 

Is it possible / How can i set this SWF in the XML to be handled different?

Link to comment
Share on other sites

From the XMLLoader docs:

 

You may put extra data in the LoaderMax-related nodes that you'd like associated with that particular loader. XMLLoader will put all of the attributes from the XML node into the vars object of the resulting loader

 

 

so you can do something like this

 

<data>
<ImageLoader name="whale" url="images/whale.png" estimatedBytes="60000" load="true"  x="0" y="0" />
<ImageLoader name="crab" url="images/crab.png" estimatedBytes="94000" load="true"  x="320" y="0"/>    
<ImageLoader name="lobster"  special="true" url="images/lobster.png" estimatedBytes="94000" load="true"  x="0" y="200"/>
<ImageLoader name="bird" url="images/bird.png" estimatedBytes="60000"  load="true"  x="320" y="200" />
</data>
 
and then in  your childComplete callback do
 
 
function imageCompleteHandler(event:LoaderEvent):void
{
    
var loadedImage:ContentDisplay = event.target.content as ContentDisplay;


//if the loader has special = "true" attribute
if(event.target.vars.special) {
  trace("i'm special");
  loadedImage.scaleX = 0.25
  someMC.addChild(loadedImage);
} else {

  //all other loaders place on stage
  addChilde(loadedImage);
 someArray.push(loadedImage);
}


}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×