Page 1 of 1

Issue with XML file when loading a SWF into another

Posted: 20 Mar 2010, 08:09
by fabichfabich
Hi,

I need a little help about swf integration using the filemod feature.

I created a global.swf file which loads using loadmovie() another swf file called site_intro_v2.swf.

The site_intro_v2.swf file contains a simple slideshow which uses a XML file (slideshow.xml) to load pictures from the /images folder.

Here's my issue : once uploaded on my local testing server, the site_intro_v2.swf works well, loads the pictures and show them. But actually, when I run global.swf from my browser, it works and loads the site_intro_v2.swf at the right place, but the images don't load.

Here are my Safari Activity Log copies :

When loading site_intro_v2.swf :
Code
http://localhost/images/image1.jpg
http://localhost/images/image2.jpg
http://localhost/images/image3.jpg
http://localhost/images/image4.jpg
http://localhost/images/image5.jpg
http://localhost/images/image6.jpg
http://localhost/site_intro_v2.swf
http://localhost/slideshow.xml
When loading global.swf :
Code
http://localhost/global.swf
http://localhost/site_intro_v2.swf
http://localhost/slideshow.xml
but doesn't load the images...

Please help...

Thank you !

Edit : PS : this is not yet used as a filemod because I want to make it work alone first.

Posted: 22 Mar 2010, 03:08
by mjau-mjau
This is a bit hard to diagnose without seeing the code, as this is not directly related to Imagevue(yet at least).

What is your code in global.swf to load the site_intro_v2.swf? Are you using absolute path or relative path? When using localhost, there may be some security issues in relation to loading external files into a file that has already been loaded with loadMovie. Also, are you certain the two flash files are using the same version of actionscript?

Posted: 22 Mar 2010, 10:14
by fabichfabich
Hi Karl,
Thank you for your answer.

Yes this is not directly related to Imagevue because I want to make it work before buying a license of Imagevue. Actually a friend told me he would let me try it on his Imagevue installation some day.

This is not an issue with the localhost because I've uploaded the files on a web server to test them and the result is exactly the same. I tried with both relative and absolute path, the issue remains the same. Moreover, I'm certain that both of these files use AS 2.0 and are published for Flash Player 8.


This is the code of my slideshow used in the site_intro_v2.swf file :
Code
import mx.transitions.Tween;
import mx.transitions.easing.*;

var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load("slideshow.xml");

myShowXML.onLoad = function() {
	_root.myWidth = myShowXML.firstChild.attributes.width;
	_root.myHeight = myShowXML.firstChild.attributes.height;
	_root.mySpeed = myShowXML.firstChild.attributes.speed;

	_root.myImages = myShowXML.firstChild.childNodes;
	_root.myImagesNo = myImages.length;

	createContainer();
	callImages();

};


function createContainer() {
	_root.createEmptyMovieClip("myContainer_mc",1);
	
	myContainer_mc.lineStyle(0,0x000000,100);
	myContainer_mc.lineTo(_root.myWidth,0);
	myContainer_mc.lineTo(_root.myWidth,_root.myHeight);
	myContainer_mc.lineTo(0,_root.myHeight);
	myContainer_mc.lineTo(0,0);

	myContainer_mc._x = (Stage.width-myContainer_mc._width)/2;
	myContainer_mc._y = 0;


}

function callImages() {

	_root.myMCL = new MovieClipLoader();
	_root.myPreloader = new Object();
	_root.myMCL.addListener(_root.myPreloader);

	_root.myClips_array = [];

	_root.myPreloader.onLoadStart = function(target) {

		_root.createTextField("myText_txt",_root.getNextHighestDepth(),0,0,100,20);
		_root.myText_txt._x = (Stage.width-_root.myText_txt._width)/2;
		_root.myText_txt._y = (Stage.height-_root.myText_txt._height)/2;
		_root.myText_txt.autoSize = "center";

		_root.myText_txt.text = "test";

	};

	_root.myPreloader.onLoadProgress = function(target) {

		_root.myText_txt.text = "Loading.. "+_root.myClips_array.length+"/"+_root.myImagesNo+" Completed";

	};


	_root.myPreloader.onLoadComplete = function(target) {

		_root.myClips_array.push(target);
		target._alpha = 0;

		if (_root.myClips_array.length == _root.myImagesNo) {

			_root.myText_txt._y = myContainer_mc._y + myContainer_mc._height;
			_root.target_mc = -1;
			moveSlide();
			myShowInt = setInterval(moveSlide, (_root.mySpeed*1000)+1000);


		}

	};

	for (i=0; i<_root.myImagesNo; i++) {

		temp_url = _root.myImages[i].attributes.url;
		temp_mc = myContainer_mc.createEmptyMovieClip(i, myContainer_mc.getNextHighestDepth());

		_root.myMCL.loadClip(temp_url,temp_mc);
	}

}


function moveSlide() {

	current_mc = _root.myClips_array[_root.target_mc];
	new Tween(current_mc, "_alpha", Strong.easeOut, 100, 0, 1, true);

	_root.target_mc++;

	if (_root.target_mc>=_root.myImagesNo) {
		_root.target_mc = 0;
	}
	
	_root.myText_txt.text = _root.myImages[target_mc].attributes.title;
	next_mc = _root.myClips_array[_root.target_mc];
	new Tween(next_mc, "_alpha", Strong.easeOut, 0, 100, 1, true);

}

This is my slideshow.xml file :
Code
<slideshow width="760" height="323" speed="2">
<image url="images/image1.jpg" title="" />
<image url="images/image2.jpg" title="" />
<image url="images/image3.jpg" title="" />
<image url="images/image4.jpg" title="" />
<image url="images/image5.jpg" title="" />
<image url="images/image6.jpg" title="" />
</slideshow>
And finally, this is the code used in my global.swf file to call the other swf file :
Code
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc.onRelease = function():Void {
    trace(this.image_mc._url); 
}
var image_mc:MovieClip = mc.createEmptyMovieClip("image_mc", mc.getNextHighestDepth());
image_mc.loadMovie("site_intro_v2.swf");

mc._x = 260;
mc._y = 350;
stop();
I've spent hours this week end trying to resolve this issue so I would be very grateful if you could help me with this.

Thank you so much !

Posted: 25 Mar 2010, 05:02
by fabichfabich
Hi,

I really need help with that. Perhaps I can give you more information about these files in order to find a solution ?

I would appreciate if you could give me an answer.

Thanks !

Posted: 29 Mar 2010, 05:40
by mjau-mjau
I think if anything, you need to send me the files ... Hard to say, but must be something with differences between the two SWF files, or something in your URL paths that is not working correctly. Did you try to trace the load calls, and the success strings?