-
what's the fast way to code it
hey all...this fla works, but not ideal. Take a look at the fla attached...i can't quite wrap my head around how to code this without going the long way. :
slidesXML = new XML();
slidesXML.ignoreWhite = true;
slidesXML.load("frames.xml");
slidesXML.onLoad = function(success) {
if (success) {
var testXML = slidesXML.firstChild.childNodes[2];
trace(testXML);
GetPicts(this);
} else {
trace("not loaded");
}
};
function GetPicts(slidesXML) {
var aThumbs = new Array(5);
aThumbs[0] = thumb0;
aThumbs[1] = thumb1;
aThumbs[2] = thumb2;
aThumbs[3] = thumb3;
aThumbs[4] = thumb4;
aThumbs[5] = thumb5;
for (i=0; i<6; i++) {
aThumbs[i]._alpha = 25;
aThumbs[i].thumbLoader.createEmptyMovieClip("mcThumbNail", 0);
aThumbs[i].onRollOver = function() {
this._alpha = 50;
};
aThumbs[i].onRollOut = function() {
this._alpha = 25;
};
thumb0.onRelease = function() {
mcFrame.loadMovie(currentPict0);
};
thumb1.onRelease = function() {
mcFrame.loadMovie(currentPict1);
}
thumb2.onRelease = function() {
mcFrame.loadMovie(currentPict2);
}
thumb3.onRelease = function() {
mcFrame.loadMovie(currentPict3);
}
}
var aImages = slidesXML.firstChild.childNodes;
for (var i = 0; i<aImages.length; i++) {
var currentPict0 = slidesXML.firstChild.childNodes[0].attributes.picture;
var currentPict1 = slidesXML.firstChild.childNodes[1].attributes.picture;
var currentPict2 = slidesXML.firstChild.childNodes[2].attributes.picture;
var currentPict3 = slidesXML.firstChild.childNodes[3].attributes.picture;
var currentPict4 = slidesXML.firstChild.childNodes[4].attributes.picture;
var currentPict5 = slidesXML.firstChild.childNodes[5].attributes.picture;
var currentThumb0 = aImages[0].attributes.thumb;
var currentThumb1 = aImages[1].attributes.thumb;
var currentThumb2 = aImages[2].attributes.thumb;
var currentThumb3 = aImages[3].attributes.thumb;
var currentThumb4 = aImages[4].attributes.thumb;
var currentThumb5 = aImages[5].attributes.thumb;
var currentCaption0 = aImages[0].attributes.words;
var currentCaption1 = aImages[1].attributes.words;
var currentCaption2 = aImages[2].attributes.words;
var currentCaption3 = aImages[3].attributes.words;
var currentCaption4 = aImages[4].attributes.words;
var currentCaption5 = aImages[5].attributes.words;
}
}
i think i need to use for(var i=... command. Nor do i understand why the image loader on the stage will not scale the photos.
if you need the xml and images, i can upload them.
thanks
Last edited by mlecho; 08-30-2007 at 11:48 AM.
-
Senior Member
The best way to get the attributes is to loop through the xml nodes, either with multiple for loops, or a recursive function call.
Each time you come across a node see if it is off a particular type, and if it is the correct one add it to your array.
My RSS reader does this. Here is a tutorial on how it works:
http://tupps.com/flash/latestnewsv2.html
Thanks
Luke
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|