|
-
need help to find good path to images
Here is another question :
I constantly have the following output :
Error opening URL "file:///C|/Documents%20and%20Settings/user/Desktop/SITEFINAL/images/travel/undefined".
I don't understand why because It does find the path to my images when applicated to other objects ( here initThumb). If you take the time to read the code, you'll see that I use the same path for both .
What do I do wrong ????I am lost.
Here is the critical part of my code :
xmlPhotos.ignoreWhite = true;
xmlPhotos.load("travel.xml");
var premierPic = 0;
var allPics = 78;
var xmlPhotos:XML = new XML();
var initThumb:Object = new Object();
xmlPhotos.onLoad = function() {
for (var i:Number = 0; i<xmlPhotos.firstChild.childNodes.length; i++) {
initThumb.photo = (xmlPhotos.firstChild.childNodes[i].attributes.photo);
initThumb.titre = (xmlPhotos.firstChild.childNodes[i].childNodes[0].firstChild);
initThumb.count = (xmlPhotos.firstChild.childNodes[i].childNodes[1].firstChild);
}
};
initThumb.onRelease = function() {
mcLargePhoto.loadMovie("images/travel/"+this.photo+"");
txtCount.text = this.count;
txtDesc.text = this.titre;
mcScroller._alpha = 0;
};
Previous_btn.onRelease=function(){
previousPic();
}
function makeAThumb(num) {
thumbname = "mcThumb"+num;
mcScroller.attachMovie("thumb", thumbname, num, initThumb);
mcScroller[thumbname].mcPhoto.loadMovie("images/tthumb/"+mcScroller[thumbname].photo+"");
}
function previousPic(){
if ((premierPic+1)>=allPics) {
premierPic = 0;
} else {
premierPic++;
}
mcLargePhoto.loadMovie("images/travel/"+this.photo+"");
txtCount.text = this.count;
txtDesc.text = this.titre;
}
this.createEmptyMovieClip("mcScroller", this.getNextHighestDepth());
Previous_btn.addEventListener("click", previousPic);
-
FK'n_dog
what does a trace reveal -
trace(this.photo); // undefined ??
trace("images/travel/"+this.photo+""); // undefined ??
mcLargePhoto.loadMovie("images/travel/"+this.photo+"");
-
hello nice Avatar !
yes it indeed the output is undefined for both traces.
-
FK'n_dog
try pushing your xml nodes into an associative array -
Code:
arr = new Array();
xmlPhotos.onLoad = function() {
for (var i:Number = 0; i<xmlPhotos.firstChild.childNodes.length; i++) {
var initThumb:Object = new Object();
initThumb.photo = (xmlPhotos.firstChild.childNodes[i].attributes.photo);
initThumb.titre = (xmlPhotos.firstChild.childNodes[i].childNodes[0].firstChild);
initThumb.count = (xmlPhotos.firstChild.childNodes[i].childNodes[1].firstChild);
arr.push(initThumb);
}
use List Variables to show how the array is compiled
use your counter to loop through the array -
Code:
var premierPic:Number = 0;
initThumb.onRelease = function() {
trace(arr[premierPic].photo);
mcLargePhoto.loadMovie("images/travel/"+arr[premierPic].photo);
txtCount.text = this.count;
txtDesc.text = this.titre;
mcScroller._alpha = 0;
};
untested, but the logic is sound 
EDIT - object moved to inside of loop
-
well it gives me now a strange output...
Error opening URL "file:///C|/Documents%20and%20Settings/user/Desktop/SITEFINAL/images/tthumb/undefined"
strange because this is the path of the makeAThumb function...
-
tthumb with 2 't's, typo?
gparis
-
yes 2 ts, it is the folder to the thumbs and it was working ok until I decided to modify the code to create the previous and next function...
-
FK'n_dog
if using the array method as i posted above -
trace(arr[premierPic].photo); // what is the output ?
mcScroller[thumbname].mcPhoto.loadMovie("images/tthumb/"+arr[premierPic].photo);
-
hi there again
I just posted another thread...I am still stucked.
Well I try right now for the output and let u know.
But just a fast question : it seems that your solution is related to the initThumb Object...that's may'be why I have the first output mentionned in my previous thread ( images/tthumb etc...)
-
FK'n_dog
sorry, you have lost me with this one,
best to stick with one thread otherwise we all end up confused
can only suggest that you plaster traces all over your file to
find the flaws in your logic.
good luck
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
|