all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

Dynamic Text not loading


Dynamic Text not loading sbryner
10/5/2006 10:14:26 PM
flash actionscript: hello,

I have a one frame movie with the attached code in the actions layer.

I have a notepad file named "info.txt" in the same folder as my .swf is
published.

what is wrong. I can't get it to work.

help...

sky

var myInfo:LoadVars = new LoadVars();
myInfo.load("info.txt");

myInfo.onLoad=function (success) {
trace("in if");
if(success){
whyUs=myInfo.whyUs;
}
};
infoText_txt.text=whyUs;
Re: Dynamic Text not loading myIP
10/5/2006 11:56:31 PM
You need to place this line of code;
infoText_txt.text=whyUs;

Re: Dynamic Text not loading sbryner
10/6/2006 3:15:11 PM
thanks,

I figured that out.... I think my other problem is don't you need to have an
button to call it. say in my first post it should be...

theBtn_mc.onRelease() = function{
infoText_txt.text = whyUs;
};

instead of just using

infoText_txt.text = whyUs;

won't work.
Re: Dynamic Text not loading myIP
10/7/2006 1:10:07 AM
Yeah, you can also nest that line of code in a button event handler as you
mentioned. Notice the onLoad and onRelease functions are indeed ?event?
handlers. Events are what trigger things to happen.
Also you are correct that this line directly after the onLoad function will
not work. It?s because Flash will read that line before the event (info.txt
loads). I guess an analogy that comes to my mind is?
Suppose you are ready to open a wrapped gift and someone ask you what is in
it.

So to analyze that;
?Suppose you (pretend ?you? are Flash) are ready to open a wrapped gift (load
info.txt file) and someone (infoText_txt.text) ask you what is in it (the
variable, ?whyUs?).

You will only know what is inside of the gift after, you have opened (in this
example, ?load it?) it.
Re: Dynamic Text not loading sbryner
10/9/2006 6:16:12 PM
thanks for the explanation. I think I understand better now.

again thanks,

AddThis Social Bookmark Button