Solved

Need help on LoadVars from a .txt file

Posted on 2006-06-22
2
182 Views
Last Modified: 2010-04-03
I have this actionscript code:

main_txtbox.html=true;      

test="MyVars"

if (test == "MyVars" ) {
myData = new LoadVars();
myData.onLoad = function() {

//request variables from vars.txt
main_txtbox.htmlText = this.test + "_Text";

};
myData.load("vars.txt");
}


======================
in my vars.txt i have:

MyVars_Text= <b>blah</b> blah blah blah blah




Why isnt it working? why isnt it loading the text from vars.txt into the flash textbox?

But if i change this:

//request variables from vars.txt
main_txtbox.htmlText = this.test + "_Text";

to this:

//request variables from vars.txt
main_txtbox.htmlText = this.MyVars_Text;

it works!!!!????




0
Comment
Question by:Sam Cohen
2 Comments
 
LVL 7

Accepted Solution

by:
furmiga earned 75 total points
Comment Utility
hi there, try this:

main_txtbox.html=true;    
test="MyVars"
if (test == "MyVars" )
{
    myData = new LoadVars();
    myData.onLoad = function()
    {
       place = "this."+test+"_Text"
       main_txtbox.htmlText = eval(place)
    }
    myData.load("vars.txt");
}

Pay attention to Case Sensitive in Flash (It can drives you crazy lol)

Working here :)

Anything gimme a call
0
 
LVL 8

Author Comment

by:Sam Cohen
Comment Utility
Thank U so Much can u answer another question of mine here:

http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21896612.html
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now