Join for FREE | Take the Tour Lost Password?
Shop deviantART for the
holidays and save BIG!
Click here! :holly:
[x]

deviantART

:flirty:
 

the new and improved xml grid gallery

[x]  
Shop deviantART for the holidays Click here! :holly:
:iconmwythrandir:
k... lied a little, my coding is sound but there must be a logic error or 2

could someone check it out???

everything works up until the imageLoaded function and the ouput also displayes this:

Error opening URL 'file:///G|/UNIVERSITY/Professional%5FPortfolio/Portfolio/images/image1.jpg'
how do i fix this, so it grabs the images

i've placed traces to make sure various parts of coding flow through.
in imageLoaded my traces show outputs of undefined basically

to test this you will need to create a movieclip "thumb1" with a square in it and export for actionscript

the layout will look like this:
[0] [1] [2] [3] [4] [5]
[6] [7] [8] [9] [10][12]
[13][14][15][16]

/////////////////Actionscript Code////////////////////////

if (thumbnails == undefined) {
thumbnails = [];
} else {
for (var i:Number = 0; i<thumbnails.length; i++) {
thumbnails[i]._alpha = 100;
}
}

var lolXML:XML = new XML();
lolXML.ignoreWhite = true;
lolXML.load("lol.xml");
lolXML.onLoad = function(success) {
if (success) {
var images = lolXML.firstChild.childNodes;

var maxThumbsPerRow = 6;
var thumbWidth = Stage.width/(maxThumbsPerRow + 0);//change 0 value to alter spacing
var thumbheight = Stage.height/(maxThumbsPerRow + 0);
var maxResults:Number = 18;
var thumbx:Number = 0;
var thumby:Number = 350;

for (i=0; i<images.length; i++) {
var imageNum = i+1;
var imageName = images[i].attributes.name;
var imageURL = images[i].firstChild.nodeValue;

trace("image number: "+imageNum+" is titled: "+imageName+" and the URL is "+imageURL);

}
for (var photoIndex:Number = 0; photoIndex<images.length && photoIndex<maxResults; photoIndex++) {
var photoNode:XMLNode = images[photoIndex];

var thumbnail:MovieClip = attachMovie("thumb1", "thumb1"+photoIndex, getNextHighestDepth());

thumbnail._y = thumby;
thumbnail._x = thumbx+(thumbWidth/2);
thumbnail.title = [link];
thumbnails.push(thumbnail);



thumbx += thumbWidth;

if ((photoIndex+1)%maxThumbsPerRow == 0) {
thumbx = 0;
thumby += thumbWidth;
}
// Week 7 code:

var imageXML = new XML();
imageXML.ignoreWhite = true;
imageXML.onLoad = imageLoaded;

trace (photoNode.firstChild.nodeValue);

var pics = photoNode.firstChild.nodeValue;

imageXML.thumbnail = thumbnail;
imageXML.load(pics);
}
} else {
trace("the STUPID images aren't loading");
}
};
function imageLoaded(success:Boolean) {

var thumbnailSize:XMLNode = this.firstChild.childNodes[1];
var thumbnailURL:String = thumbnailSize.attributes.nodeValue;

trace("hello " + this.firstChild.firstChild)// output = hello undefined
trace(this.thumbnail.image)// output = undefined

trace(thumbnailURL);

this.thumbnail.createEmptyMovieClip("image",this.thumbnail.getNextHighestDepth());

var loader:MovieClipLoader = new MovieClipLoader();
var loadListener = new Object();

loadListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number) {
target_mc._x -= target_mc._width/2;
target_mc._y -= target_mc._height/2;
};

loader.addListener(loadListener);
loader.loadClip(thumbnailURL,this.thumbnail.image);

}

hope u enjoy it, cause its been rattling my brain

Devious Comments

love 0 0 joy 0 0 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0
:iconmwythrandir:
k... lied a little, my coding is sound but there must be a logic error or 2

could someone check it out???

everything works up until the imageLoaded function and the ouput also displayes this:

Error opening URL 'file:///G|/UNIVERSITY/Professional%5FPortfolio/Portfolio/images/image1.jpg'
how do i fix this, so it grabs the images

i've placed traces to make sure various parts of coding flow through.
in imageLoaded my traces show outputs of undefined basically

to test this you will need to create a movieclip "thumb1" with a square in it and export for actionscript

the layout will look like this:
[0] [1] [2] [3] [4] [5]
[6] [7] [8] [9] [10][12]
[13][14][15][16]

/////////////////Actionscript Code////////////////////////

if (thumbnails == undefined) {
thumbnails = [];
} else {
for (var i:Number = 0; i<thumbnails.length; i++) {
thumbnails[i]._alpha = 100;
}
}

var lolXML:XML = new XML();
lolXML.ignoreWhite = true;
lolXML.load("lol.xml");
lolXML.onLoad = function(success) {
if (success) {
var images = lolXML.firstChild.childNodes;

var maxThumbsPerRow = 6;
var thumbWidth = Stage.width/(maxThumbsPerRow + 0);//change 0 value to alter spacing
var thumbheight = Stage.height/(maxThumbsPerRow + 0);
var maxResults:Number = 18;
var thumbx:Number = 0;
var thumby:Number = 350;

for (i=0; i<images.length; i++) {
var imageNum = i+1;
var imageName = images[i].attributes.name;
var imageURL = images[i].firstChild.nodeValue;

trace("image number: "+imageNum+" is titled: "+imageName+" and the URL is "+imageURL);

}
for (var photoIndex:Number = 0; photoIndex<images.length && photoIndex<maxResults; photoIndex++) {
var photoNode:XMLNode = images[photoIndex];

var thumbnail:MovieClip = attachMovie("thumb1", "thumb1"+photoIndex, getNextHighestDepth());

thumbnail._y = thumby;
thumbnail._x = thumbx+(thumbWidth/2);
thumbnail.title = [link];
thumbnails.push(thumbnail);



thumbx += thumbWidth;

if ((photoIndex+1)%maxThumbsPerRow == 0) {
thumbx = 0;
thumby += thumbWidth;
}
// Week 7 code:

var imageXML = new XML();
imageXML.ignoreWhite = true;
imageXML.onLoad = imageLoaded;

trace (photoNode.firstChild.nodeValue);

var pics = photoNode.firstChild.nodeValue;

imageXML.thumbnail = thumbnail;
imageXML.load(pics);
}
} else {
trace("the STUPID images aren't loading");
}
};
function imageLoaded(success:Boolean) {

var thumbnailSize:XMLNode = this.firstChild.childNodes[1];
var thumbnailURL:String = thumbnailSize.attributes.nodeValue;

trace("hello " + this.firstChild.firstChild)// output = hello undefined
trace(this.thumbnail.image)// output = undefined

trace(thumbnailURL);

this.thumbnail.createEmptyMovieClip("image",this.thumbnail.getNextHighestDepth());

var loader:MovieClipLoader = new MovieClipLoader();
var loadListener = new Object();

loadListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number) {
target_mc._x -= target_mc._width/2;
target_mc._y -= target_mc._height/2;
};

loader.addListener(loadListener);
loader.loadClip(thumbnailURL,this.thumbnail.image);

}

hope u enjoy it, cause its been rattling my brain
:iconmwythrandir:
my XML code:

<gallery>
<image name="this is image 1">images/image1.jpg</image>
<image name="this is image 2">images/image2.jpg</image>
<image name="this is image 3">images/image3.jpg</image>
<image name="this is image 4">images/image4.jpg</image>
<image name="this is image 5">images/image5.jpg</image>
<image name="this is image 6">images/image6.jpg</image>
<image name="this is image 7">images/image7.jpg</image>
<image name="this is image 8">images/image8.jpg</image>
<image name="this is image 9">images/image9.jpg</image>
<image name="this is image 10">images/image10.jpg</image>
<image name="this is image 11">images/image11.jpg</image>
<image name="this is image 12">images/image12.jpg</image>
<image name="this is image 13">images/image13.jpg</image>
<image name="this is image 14">images/image14.jpg</image>
<image name="this is image 15">images/image15.jpg</image>
<image name="this is image 16">images/image16.jpg</image>
</gallery>

Site Map