loading an external teat file

hi
i want to load an external text file every time the user press on a thumbnail. i`m building a gallery.
i created a dynamic text box and gave it an instance name. i made it a multiline and render as html.
then i created a loadvars variable in the actions layer of the main timeline.
then i wrote a text file which starts with: info= and then comes the text itself.
now, on the "on release" of the thumbnail movie i wrote:
myLV.load("my documents/loadedText.txt", loadedInfo);

myLV=the name of the variable i created.
loadedInfo= the name of the dynamic text box.

but it does not work.

what to do?


best regards

ron
LVL 1
derridaAsked:
Who is Participating?
 
Dushan De SilvaTechnology ArchitectCommented:
1.)Put following action script on button.
on(Click){
myLoadVars = new LoadVars();
     myLoadVars.onData = function(_data)
     {
     if (_data != undefined)
     {
          myText.text = _data;
     } else
     {
          trace("loading fails...");
     }
    };
    myLoadVars.load("mydata.txt");
}
2.) Put following action script on begining of first frame.

System.useCodepage = true;


BR Dushan
0
 
MontoyaProcess Improvement MgrCommented:
you're going to load the text file contents into a variable myLV,

then, you're going to assign the text property of loadedInfo to equal myLV. Therefore:

loadedInfo.text = myLV;

0
 
Dushan De SilvaTechnology ArchitectCommented:
I think, I can give you a solution to solve your problem partially.
Using following technic, you can load values in external text file(mydata.txt file in the same folder) to the text field(myText) in the flash movie.
 

________________________________________________________
     myLoadVars = new LoadVars();
     myLoadVars.onData = function(_data)
     {
     if (_data != undefined)
     {
          myText.text = _data;
     } else
     {
          trace("loading fails...");
     }
    };
    myLoadVars.load("mydata.txt");
________________________________________________________

Following solutions used same technic.
http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21810117.html
http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21812648.html
http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21815511.html

________________________________________________________

I hope this will help for you partially.


BR Dushan
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
derridaAuthor Commented:
hi
i managed to load the external text file but i face two problems:

1- i need it to load when a movie clip is clicked. so where exactly should i write the code? should i split the code? the variable in the main timeline and the load itself on the onRealese event?

2- the text is in hebrew and its loads as small boxes. when i write a text in english it load fine.



best regrads

ron
0
 
derridaAuthor Commented:
hi
i made the text load on click on the movie but the hebrew issue is still a problem. can you help?


ron
0
 
Dushan De SilvaTechnology ArchitectCommented:
What do you mean by hebrew issue ?

BR Dushan
0
 
derridaAuthor Commented:
hi
well i managed to deal with the hebrew also. i hope i can continue to ask about this question:
now i can load the external thext and in hebrew on click on the movie. but i have several movies and each needs a different text file to load. i have tried to write an array and then add a different text file name on the onRelease command, but it does not work.


please help:)


ron
0
 
Dushan De SilvaTechnology ArchitectCommented:
You can put above code to each button, by changing the external file name without using array.

BR Dushan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.