;

PDA

Click to See Complete Forum and Search --> : load images, load text


celeritycat
04-02-2006, 05:08 AM
Ok, I have a flash file, actually it's the loadimages fun file from http://necromanthus.com/KoolMoves/LoadImages.html
I want to add dynamic text for each picture by loading a text file. I want the first text file to load on load and every other file to load corresponding with the images. I can get the text to load, but it doesn't keep up with the buttons to go foward and backward. There are five pictures and I have five text files. The first has AC like this and this where the first text sholud show up.

scr._alpha = 0;
pic = 1;
input = pic;
_root.onEnterFrame = function() {
if (scr._alpha>10 && fadeOut) {
scr._alpha -= 10;
}
if (scr._alpha<10) {
scr.loadMovie("Images/image"+pic+".jpg", "_self");
fadeOut = false;
fadeIn = true;
}
if (scr._alpha<100 && fadeIn && !fadeOut) {
scr._alpha += 10;
} else {
fadeIn = false;
}
if (input>5) {
input = 5;
}
if (Key.isDown(Key.ENTER)) {
fadeOut = true;
pic = input;
}
};

inputField.onKillFocus = function() {
input = pic;
};
stop();

Now the buttons foward AC
on(press){
if (pic<5 && !fadeIn && !fadeOut) {
fadeOut = true;
pic++;
input = pic;
}
}

and back
on(press){
if (pic>1 && !fadeIn && !fadeOut) {
fadeOut = true;
pic--;
input = pic;
}
}

Can anyone help me get this right!
FYI the images are all image 1,2,3.. and text is txt1, 2, 3..

blanius
04-02-2006, 08:22 AM
Have your text files be in this format
&myText=the text describing your photo here
Assuming your text goes in txt1 object

change the following

if (scr._alpha<10) {
scr.loadMovie("Images/image"+pic+".jpg", "_self");
loadVariables("Images/text"+pic+.txt");
txt1.text=myText
fadeOut = false;
fadeIn = true;

We are not checking that anything is loading but this should work.

indogo
04-02-2006, 09:38 AM
Using '_alpha' is apparently quite processor intensive which can also throw your timing out..........I was doing a similar thing and made a separate 4 keyframe movie clip which contained a shape to mask over the txt/image...
The mask (which matches the background) is transparent (using shape properties/fill) in the first and last frame and solid in the middle two.....the second frame loads the next selected image/txt and the movie clip is played each time a new page is called up...adjust timings to give the desired effect.The second to third keyframe allows time to load from the server before fading in.

The idea was suggested elsewhere on the forum and is a lot simpler :) ....combine with blanius's format for the files.

In summary....
1.static main movie containing image movie clip target and dynamic text box
2.Movie clip to load data/fade mask.(stop at end)
3.Buttons to select page and run loading movie clip.

et voila

mike