Log in

View Full Version : Flash/XML - PNG files won't work.



rd42
10-24-2008, 02:39 PM
I used this Flash XML tutorial:
http://www.gotoandlearn.com/play?id=22

Works great on jpegs but not on gifs or pngs.

Any ideas?

Here is the actionscript:


var x:XML = new XML();
x.ignoreWhite = true;

var urls:Array = new Array();
var captions:Array = new Array();
var whoIsOn:Number;

x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
holder.loadMovie(urls[0]);
caption.text = captions[0];
whoIsOn = 0;
}

x.load("productsmd.xml");

previous.onRelease = function() {
if(whoIsOn > 0) {
whoIsOn--;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}

next.onRelease = function() {
if(whoIsOn < urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}

Medyman
10-24-2008, 06:06 PM
What version of Flash are you using?

rd42
10-25-2008, 12:34 PM
Cs3 9.0

Medyman
10-25-2008, 02:30 PM
Hmm...it should work then.
Zip up your files and I'll have a look. There is no reason that should be happening.

rd42
10-25-2008, 09:08 PM
Medyman thanks for the help, as I zipped them up, I noticed a typo in the xml :)

Now I just have to figure out how to have flash scale the images down to fit within th flash stage....

Thanks again,

robert