To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 04-16-2007, 10:18 AM   #1
rozenn
Junior Member
 
Join Date: Sep 2006
Posts: 22
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);
rozenn is offline   Reply With Quote
Old 04-16-2007, 10:52 AM   #2
a_modified_dog
FK'n_dog
 
a_modified_dog's Avatar
 
Join Date: Apr 2003
Location: "aaarf"
Posts: 9,176
what does a trace reveal -

trace(this.photo); // undefined ??
trace("images/travel/"+this.photo+""); // undefined ??

mcLargePhoto.loadMovie("images/travel/"+this.photo+"");
a_modified_dog is offline   Reply With Quote
Old 04-16-2007, 11:08 AM   #3
rozenn
Junior Member
 
Join Date: Sep 2006
Posts: 22
hello nice Avatar !
yes it indeed the output is undefined for both traces.
rozenn is offline   Reply With Quote
Old 04-16-2007, 11:26 AM   #4
a_modified_dog
FK'n_dog
 
a_modified_dog's Avatar
 
Join Date: Apr 2003
Location: "aaarf"
Posts: 9,176
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
a_modified_dog is offline   Reply With Quote
Old 04-16-2007, 12:02 PM   #5
rozenn
Junior Member
 
Join Date: Sep 2006
Posts: 22
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...
rozenn is offline   Reply With Quote
Old 04-16-2007, 12:06 PM   #6
gparis
Super Moderator
 
Join Date: Aug 2000
Location: Montréal
Posts: 13,430
tthumb with 2 't's, typo?

gparis
__________________


AS 2.0 Forum Guidelines || Use P H P tags for code samples || Flash LiveDocs || AS 2.0 Language reference (CS4)
gparis is offline   Reply With Quote
Old 04-16-2007, 12:12 PM   #7
rozenn
Junior Member
 
Join Date: Sep 2006
Posts: 22
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...
rozenn is offline   Reply With Quote
Old 04-16-2007, 04:54 PM   #8
a_modified_dog
FK'n_dog
 
a_modified_dog's Avatar
 
Join Date: Apr 2003
Location: "aaarf"
Posts: 9,176
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);
a_modified_dog is offline   Reply With Quote
Old 04-16-2007, 05:18 PM   #9
rozenn
Junior Member
 
Join Date: Sep 2006
Posts: 22
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...)
rozenn is offline   Reply With Quote
Old 04-16-2007, 05:56 PM   #10
a_modified_dog
FK'n_dog
 
a_modified_dog's Avatar
 
Join Date: Apr 2003
Location: "aaarf"
Posts: 9,176
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
a_modified_dog is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:45 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.