the variable “Gallery” is a dybamic text field variable. The code loads diffrent text from txt file based on key presses. For some reason (maybe I’m being stupid) the code loads the text then instantly disappears?
I didnt understand what exactly you are tring to do.
Are you loading an external txt file? Which event changes the textfield content? Which vars are on the external txt?
:-\
I have not tested this and dont know what you are trying to acomplish, but try this:[AS]max = 4;
gallerycount = 1;
loadText = new loadVars();
loadText.load(“data2.txt”);
loadText.onLoad = function(OK) {
if (OK) {
mytext.text = this[“gallery”+count];
} else {
trace(“Error”);
}
};
b1.onPress = function() {
if (gallerycount != 1) {
gallerycount–;
gallerycount = loadText[“gallery”+gallerycount];
}
};
b2.onPress = function() {
if (gallerycount != max) {
gallerycount++;
gallerycount = loadText[“gallery”+count];
}
};[/AS]
I am trying to achieve exactly what you have done, but in a Flash 5 way.
I understand ‘loadVars’ is a Flash MX feature. I understand your code, and know it should work (apart from 1 thing), what I want to do is mimic this line (I have amended the line):
gallery = loadText[“gallery”+gallerycount];
…
in my code: gallery is my textfield variable. In the line above we set the variable gallery to “gallery”+count so if count = 2 gallery will = gallery2 right?
gallery2 is loaded from textfile and will now display gallery2’s text.
In my code I want to do this (lets say gallerycounter is 1):
press button
increment gallerycounter
now gallerycounter is 2
set gallery to the contents of the following:
gallery1
gallery2
gallery3 etc…
to set gallery i’m doing this:
gallery = “gallery”+gallerycount
…it doesn’t work cause gallery now prints “gallery2” in words as apose to the CONTENTS of the variable gallery2.
so my question is, how do I pass the value instead of the words “gallery2”?