Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading images from XML into a Scrollpane

Status
Not open for further replies.

natg504

MIS
Dec 5, 2005
13
US
I'm trying to load a group of images into a scrollpane component with XML. So far, I can get them all to load in a movieclip outside the scrollpane, but how do I put that movieclip inside the scrollpane??
------------------------------------------------

galleryXML = new XML();
galleryXML.onLoad = init;
galleryXML.load("stencils.xml");
galleryXML.ignoreWhite = true;

var xPos:Number = 0;
var yPos:Number = 0;
var my_mcl:MovieClipLoader = new MovieClipLoader();

function init(success) {
if (success == true) {
imgDesc = "";
rootNode = galleryXML.firstChild;
nbrImages = rootNode.childNodes.length;
image = rootNode.firstChild;
for (i=0; i<nbrImages; i++) {
mcName = "mc_"+i;
loadImage(image.attributes.swfURL, mcName, image.firstChild.nodeValue, i+1);
image = image.nextSibling;
}
}
}

function loadImage(imgSrc, clipName, desc, ctr) {
//Creates a parent movie clip to hold the container
this.createEmptyMovieClip("parent", this.getNextHighestDepth());
newClip = parent.createEmptyMovieClip(clipName, this.getNextHighestDepth());
//this is the movie clip the image will replace
newClip.createEmptyMovieClip("container_mc", this.getNextHighestDepth());
//use moviecliploader to load the image
my_mcl.loadClip(imgSrc, newClip.container_mc);
newClip._y = yPos;
newClip._x = xPos;

if (ctr%10 == 0) {
xPos = 0;
yPos += 30;
} else {
xPos += 30;
}

newClip.onRollOver = function () { imgDesc = desc;};

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top