I need some help from you guys. I don't have much knowledge of Actionscript yet so my question might be simple to
solve.
I have a fla with a dynamic textbox instanced as box_txt and a movieclip instanced as movie_mc. Then I have an
external txt file named text.txt with only one var: &stat. This var can be either Visible or Unvisible.
What I want it's just two things. First to load the var into the the textbox and second to make the movieclip
visible or unvisible.
Load the var from the text file to the textbox it's easy but simultaneously make the movieclip visible/unvisible
it's being much more dificult to me.
I supose there is lots of (easy) ways to do this but I don't know how. Based on the code that some of you gave me on
a previous post, I tried the following (single block code on frame 1):
myData = new LoadVars();
myData.onLoad = function(success) {
if (success) {
box_txt.htmlText = this.stat;
switch (this.stat) {
case "Visible" :
_root.movie_mc.visible = true
break;
case "Unvisible" :
_root.movie_mc.visible = false
break;
}
}
else {
box1_txt.htmlText = "error";
}
};
myData.load("text.txt");
stop();
++++++++++++++++++++ I Also tried this one:
myData = new LoadVars();
myData.onLoad = function(success) {
if (success) {
box_txt.htmlText = this.stat;
moveClip();
}
else {
box_txt.htmlText = "error";
}
};
function moveClip(){
if (box_txt.htmlText == "Visible") {
movie_mc._visible = true;
}
else if (box_txt.htmlText == "Unvisible") {
movie_mc._visible = false;
}
}
myData.load("text.txt");
stop();
There's no error message on the code but nothing happens to the movieclip. Can u help me?
Thx in advance
solve.
I have a fla with a dynamic textbox instanced as box_txt and a movieclip instanced as movie_mc. Then I have an
external txt file named text.txt with only one var: &stat. This var can be either Visible or Unvisible.
What I want it's just two things. First to load the var into the the textbox and second to make the movieclip
visible or unvisible.
Load the var from the text file to the textbox it's easy but simultaneously make the movieclip visible/unvisible
it's being much more dificult to me.
I supose there is lots of (easy) ways to do this but I don't know how. Based on the code that some of you gave me on
a previous post, I tried the following (single block code on frame 1):
myData = new LoadVars();
myData.onLoad = function(success) {
if (success) {
box_txt.htmlText = this.stat;
switch (this.stat) {
case "Visible" :
_root.movie_mc.visible = true
break;
case "Unvisible" :
_root.movie_mc.visible = false
break;
}
}
else {
box1_txt.htmlText = "error";
}
};
myData.load("text.txt");
stop();
++++++++++++++++++++ I Also tried this one:
myData = new LoadVars();
myData.onLoad = function(success) {
if (success) {
box_txt.htmlText = this.stat;
moveClip();
}
else {
box_txt.htmlText = "error";
}
};
function moveClip(){
if (box_txt.htmlText == "Visible") {
movie_mc._visible = true;
}
else if (box_txt.htmlText == "Unvisible") {
movie_mc._visible = false;
}
}
myData.load("text.txt");
stop();
There's no error message on the code but nothing happens to the movieclip. Can u help me?
Thx in advance