PDA

View Full Version : Refresh new .swf file after update problem


asammons
07-15-2008, 09:48 PM
I am designing a site that has a flash slideshow in it. All the pages used to have the same slideshow, but I just changed one page to have a different slideshow, where the .swf file is named differently, and is in a completely new directory.

The index page is here:
http://www.tincanstudios.com/dev/casaAgave/index.html
This page has the slideshow with three photographs of a house.

The page with the new slideshow is here:
http://www.tincanstudios.com/dev/casaAgave/borrego.html
This page should have the slideshow with three desert photographs.

The borrego page has the correct path to the new .swf file, but still loads the old file (the one on the index page and others) where the new slideshow should be. Is this showing up on other people's browsers as well, or is it a cache issue with me. I have cleared my cache in both IE6 and Firefox, but it still loads the same house images.

Any help would be appreciated. Thanks!

ramm19
07-15-2008, 11:40 PM
It's not a cache issue, you are loading a different .swf file, but maybe you missed to correct the code, it may be a duplicate swf or you simply duplicated the pics folders...

Start troubleshooting from basic to advanced... coders usually think of the worse first and find that the dumbest solution is the right one :)

asammons
07-16-2008, 12:12 AM
I'm sure it is something very simple, but I don't think that it has to do with the file.

Here is the code in the borrego.html file, and this is the correct animation.


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="600" height="410">
<param name="movie" value="desertShow/image_loader_desert.swf" />
<param name="quality" value="high" />
<embed src="desertShow/image_loader_desert.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="410"></embed></object>


If I type in the url as based on the relative link, I get the proper animation:
http://www.tincanstudios.com/dev/casaAgave/desertShow/image_loader_desert.swf

This shows that the file is there.. but I'm still not sure why the wrong animation is playing.

ramm19
07-16-2008, 12:27 AM
ahh I think I know what the problem is... pretty simple.

As both HTML files are under the same directory "casaAgave", your desert movie is being loaded into that directory, and you are more likely using the same XML file name, so you are loading the wrong set of photos... your "image_loader_desert.swf" needs to load the XML that's located inside the desertShow folder.

asammons
07-16-2008, 01:14 AM
Thanks for your thoughts.

I'm not sure that's it either because the .swf is in the same directory as the .xml and the 3 .jpg's in both cases.

I made the original .swf, and had all the necessary files in the same directory (the root directory).

When I made the second swf, I made a new directory (desertShow), renamed the .swf and put all the new files in there.

Just to double check if your solution was correct, I renamed all the desert .jpg files, and called them in the original .xml file, which didn't work.

Other ideas?

ramm19
07-16-2008, 06:24 PM
did you change the name of the desert XML and fixed that from the desert .swf?

That pretty much has to be the problem because you are clearly loading the wrong set of pics, and you are loading them though xml.

ramm19
07-16-2008, 06:36 PM
I've checked to see if it could be a cache problem, but it's not since I freshly opened the desert link in IE (which I just use for compatibly checkup) and it displays the wrong set of pics by default... so yeah, it's loading the wrong xml file and pics.

asammons
07-16-2008, 09:48 PM
I feel like you're right. So here's the actionscript in the .swf. The part that calls the .xml file is a little fuzzy to me, as I'm not the greatest actionscripter.


#initclip 1
ImageFader = function () {
this.__init__ ();
};
ImageFader.prototype = new MovieClip ();
// ** init class ** //
ImageFader.prototype.__init__ = function () {
this._xscale = 100
this._yscale = 100
this.bounding_box.unloadMovie()
this._fader_.unloadMovie()
this._dataProvider = new Array ();
this._count = 0;
this._depth = 1;
this._isLoaded = -1;
if (this._S_) {
clearInterval (this._S_);
}
if (this._xmlfile != "") {
this.loadXML (this._xmlfile);
}
};
// *** load the external xml ** //
ImageFader.prototype.loadXML = function (x) {
var _xml = new XML ();
_xml.ignoreWhite = true;
_xml.path = this;
_xml.load (x);
_xml.onLoad = function () {
for (var a = 0; a < this.firstChild.childNodes.length; a++) {
var _trans = this.firstChild.childNodes[a].attributes.TRANSITION;
// some changes made by Emanuele Feronato
var _alt_pause = this.firstChild.childNodes[a].attributes.ALT_PAUSE;
var _pause = this.firstChild.attributes.PAUSE;
_passed_pause = _pause;
if(Math.abs(_alt_pause) > 0){
_passed_pause = _alt_pause;
}
var _img = this.firstChild.childNodes[a].firstChild.nodeValue;
this.path._dataProvider.push ({img:_img, transition:_trans, pause:_passed_pause});
// end of some changes made by Emanuele Feronato
}
this.path.startFading ();
delete this;
};
};
// ** start fading procedure ** //
ImageFader.prototype.startFading = function () {
if (this._dataProvider.length > 0) {
this.makeFader(true)
}
};
// ** load images ** //
ImageFader.prototype.makeFader = function (first) {
this._isLoaded = -1;
this._tmp = this.attachMovie ("ImageLoader", "ImageLoader" + this._depth, this._depth++);
this._old1 = this['ImageLoader' + (this._depth - 1)]
this._old2 = this['ImageLoader' + (this._depth - 2)]
this._tmp.loadHandler ("isLoaded", this._count);
this._tmp.autoStart = false;
this._tmp.transition = this._dataProvider[this._count].transition
this._tmp.loadImage (this._dataProvider[this._count].img);
this._t1 = getTimer()
this.onEnterFrame = function(){
this._t2 = getTimer()
if((this._t2 - this._t1) > this._dataProvider[this._count].pause || first==true){
if(this._isLoaded == this._count || this._isLoaded == 1 && this._count == 0){
delete this.onEnterFrame;
this._tmp.start()
this._old1.fadeOut()
this._old2.removeMovieClip()
if(this._count + 1 < this._dataProvider.length){
this._count++
this.makeFader()
return;
} else {
if(this._loop == true){
this._count = 0
this.makeFader()
}
}
}
}
}
};
// ** which has been loaded ? ** //
ImageFader.prototype.isLoaded = function (num) {
this._isLoaded = num;
};
Object.registerClass ("ImageFader", ImageFader);
#endinitclip


The "_xml.path = this;" must be where the .xml file is called, but how is this set up? Does it look in the current directory for the .xml file? I was expecting to see a reference to "images.xml" which is the xml file name in the directory.

If I want to name the .xml file something to ensure that the correct file is being used, how would I change it in the actionscript?

ramm19
07-16-2008, 10:41 PM
asammons, usually you would set the XML location here: "_xml.load (x);" **BUT** it seems like you are using some sort of component thingy.. go to the top of the timeline and if it is a component you are using, select it, and click on the "Parameters" tab, you should be able to set the XML file path there..

when you find it, I would recommend you to rename it to desert_images.xml and of course also rename the actual file (make sure you point to the right folder, where the right pics are at).

Let me know if you have any other questions.

ramm19
07-16-2008, 10:47 PM
if that's too complicated, you could just change this line:

_xml.load (x);

to be:

_xml.load ("desert_images.xml");

That should be a safe change to make, but it's best to go with the fist option, not modifying the component as you may forgot what you changed ;)

asammons
07-17-2008, 02:35 AM
Thanks for all your suggestions,

I did the second option you suggested, and still am having trouble. So I if I go directly to the .swf file that is being used in the .html file, it still loads correctly, yet it doesn't load now in the actual .html file.

Direct Link pulled from source code:
http://www.tincanstudios.com/dev/casaAgave/desertShow/image_loader_desert.swf

Actual HTML page:
http://www.tincanstudios.com/dev/casaAgave/borrego.html

What the heck?

Source:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="600" height="410">
<param name="movie" value="desertShow/image_loader_desert.swf" />
<param name="quality" value="high" />
<embed src="desertShow/image_loader_desert.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="410"></embed></object>

ramm19
07-17-2008, 05:28 PM
Asammons, the reason why it works when you call the .swf alone is because you are calling it from within the "desertShow" folder, thus picking up the correct .xml

It's very simple, you have 2 .swf movies that reference to the SAME "images.xml" file, so which ever .swf file that you load under "casaAgave" folder, will load the same XML file.

The easiest solution (not the best, because it's better to understand why things don't work) will be: move "borrego.html" inside the "desertShow" folder. and problem solved.

OR

just re-do the option 2 I previously gave you to:

_xml.load ("/desertShow/images.xml");

that will load the file you want to load the xml you want, you may have to rename the locations of the images inside "/desertShow/images.xml"

asammons
07-17-2008, 09:53 PM
Hrmm...

Well, moving the borrego file into the desertShow folder made it work. I'm very happy about that. Thanks!

It still seems odd to me, as I was calling different file names in the borrego .swf file.

It works, and I'm happy, but not totally sure why it worked.

Thanks a ton for your help ramm19. Case closed.

ramm19
07-17-2008, 10:10 PM
Asammons, I'm glad I was able to help you...

Think of it like this... You were calling the borrego.swf from "casaAgave", that means that borrego.swf will now work from within that same location, meaning that it will keep looking for the same XML file, "images.xml" which is also hosted at "casaAgave" that's why it's picking up the wrong set of xml and images with it.

I hope you can understand my explanation (english is not my mother tongue :))