[size=1]Objective: Load variables from a text file named [color=red]picData.txt[/color] into a movie clip on the root timelines with an instance name of [color=blue]mainHolder[/color]. Then I want to load an image that is defined as a variable in the [color=red]picData.txt[/color] file I load.
Problem: After loading the variables from the [color=red]picData.txt[/color] text file into a movie on the root timeline with an instance of [color=blue]mainHolder[/color] the variables could not be accessed. I tried [color=gray]trace();[/color] and everything.
Note: The [color=red]picData.txt[/color] is located in the same directory as the Flash file.[/size]
I’ve become more accustomed to using LoadVars() to load in variables, but lemme give this a shot…
You load the variables into the mainHolder clip, so shouldn’t it be something like [AS]mainHolder.picHolder1.loadMovie(_parent.picURL1);[/AS] Also, loadVariables doesn’t work instantly, you have to wait a while for the variables to get loaded. That is what is good about LoadVars(), it has the ability to use the onLoad event handler so you can check when the variables are loaded and do what you want from there.
I would go more into it, but I have to go now. I will be on tonight so if this doesn’t get solved by then I will see what I can do.
lv = new LoadVars ();
lv.onLoad = function (success)
{
if(success)
{
var picArray = this.picURLS.split(","); // store each url into an array element
for ( var i=0 ; i<picArray.length ; i++ )
{
// mainHolder.createEmptyMovieClip( "picHolder"+i, i ).loadMovie(picArray*+".jpg");
mainHolder["picHolder"+i].loadMovie(picArray*+".jpg");
}
delete picArray, i
}
else trace("Cannot load file");
}
lv.load("picData.txt");
ah alright, textfiles should be fine… i was thinking if you’re trying to load too many, xml could be a bit easier to work with =) you don’t need it though
I am still having problems, the images won’t show. This is a project for my work so that you can preview other selected auctions from within an auction, the interface is not done, but I want to know it can work first.
The purpose of being able to change the URL’s and the Item Descriptions is so that who ever takes over my job when I am not there can just edit a .txt file instead of having to use flash.
Hmm, someone post the final version of this? I’ve kinda been following and am interested to see a completed XML alized. I’ve just started learning some PHP and have a smimilar type thing going on (not in flash though) over at my site… http://www.dujodu.com/IMAGESCRIPT/ basically it’s just a function imgTable(thumbDir,largeDir); and pulls the thumbs out, links to the large, and has a unique description for each.
On that page, i just have the function called twice, once with the thumb directory as the source for the table, and the other as the large directory with the source for the table… just to show how it works. It’s not complete yet, obviously.