PDA

View Full Version : Pictures in External txt file



benslayton
08-30-2006, 02:37 AM
I am using this in my flash movie:

loadVariables("file.txt",_root);

but in my text file how do I put in images?
I have tried: Home_logo=bulldog.jpg&

BLiZZaRD
08-30-2006, 07:30 AM
Try using tis in your fla:



var currentSlide = 0;

var myLV = new LoadVars();

myLV.load("data.txt");

myLV.onLoad = function(success) {

if (success) {

img_arr = this.arrayVar.split("||");

_root.attachMovie("slideshow", "show", 1, {_x:0, _y:0, _visible:false, fps:18, nFrames:24, alphaIncr:10, slides_arr:img_arr, slideDepth:1, repeat:true, slideTracker:"currentSlide"});

show.addListener(_root);

_root.onAllSlidesLoaded = function() {

show._visible = true;

show.beginTransitions();

};

} else {

// the vars couldn't be loaded.

}

};


and this in your .txt:



&arrayVar=1.jpg||2.jpg||3.jpg||4.jpg&


Should pull everything out just nice like :D

benslayton
08-30-2006, 01:08 PM
Doesn't work.

BLiZZaRD
08-30-2006, 05:38 PM
You put the "&" sign on both sides of the array?

benslayton
08-30-2006, 06:06 PM
Like this

&arrayVar=1.jpg||2.jpg||3.jpg||4.jpg&

or this:

&arrayVar&=1.jpg||2.jpg||3.jpg||4.jpg&

BLiZZaRD
08-31-2006, 07:11 AM
It is like the first one, at the very beginning of the array line and at the very end.

Have you thought about using XML instead of plain text?