...or if it has line break characters at the end of each line...
Billystyx
Main Topics
Browse All Topicsi have a .txt file , they have with 200 lines
i want to call this file line by line in Flash Movieclip (Moves Down to upward)
each line show after the Animaction.
how can i do this ..
thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
with a comma and a full stop, code would look like this
frame1:
loadVariables("txtfile.txt
frame2:
if(myText.length>0){//myTe
gotoAndStop(4);
}
frame3:
gotoAndPlay(3);
frame4:
num=0;
val=2;//number of lines in txtfile
for(i=0;i<val;i++){
_root["var"+i]=myText.inde
_root["vara"+i]=substring(
trace(_root["vara"+i]);
num=_root["var"+i]+3;
}
stop();
Billystyx
try this:
on frame 1 add this variable:
n=0;
make a textfield on frame4, dynamic, call it 'myText_txt'
and put this code:
if(myText_txt.length<myTex
myText_txt=myText_txt+subs
n++;
}
frame5:
gotoAndPlay(4);
If this doesn't work, let me know - I have a working example at home I can upload
Billystyx
Thanks Buddy
but still my task no done
ok i give u me script those i done on it
frame1:
n=0;
loadVariables("txtfile.txt
frame2:
if(myText.length>0)
{
gotoAndStop(3);
}
frame3:
num=0;
val=2;//number of lines in txtfile
for(i=0;i<val;i++){
_root["var"+i]=myText.inde
_root["vara"+i]=substring(
trace(_root["vara"+i]);
gotoAndPlay(4);
num=_root["var"+i]+3;
}
stop();
frame4:// with text filed tween upto 14 frame..
if(myText_txt.length<myTex
myText_txt=myText_txt+subs
trace(myText_txt);
n++;
}
Frame15:
gotoAndPlay(4);
i put txt filed in Frame 4 wiht motion tween and put frame instance name is"myText_txt"
So. no out put display....
--------------------------
try my post solution above - the first was flawed.
(this one no good)
if(myText_txt.length<myTex
myText_txt=myText_txt+subs
n++;
}
(this one good)
frame1:
j=1;
frame4:
if(j < myText.length){
message = myText.substring(0, j);//message is the variable name of your textfield
j++;
}
frame5:
gotoAndPlay(4);
... and try it without the line break code from first to begin with (make a new flash doc if you need to)
The first bit can be easily incorporated into the typing method - but not directly ( I don't think anyway)
billystyx
if you need an example, just say and I will upload tonight
frame1:
loadVariables("txtfile.txt
frame2:
if(myText.length>0){//myTe
gotoAndStop(4);
}
frame3:
gotoAndPlay(3);
frame4:
//with the textfield with variable name 'message'
num = 0;
myArr = [];
val = 4;
//number of lines in txtfile
for (i=0; i<val; i++) {
_root["var"+i] = myText.indexOf("\r\n", num);
_root["vara"+i] = substring(myText, num, _root["var"+i]);
myArr.push(_root["vara"+i]
num2 = myText.length;
myText = substring(myText, _root["var"+i]+3, num2);
}
j = 1;
i = 0;
onEnterFrame = function () {
if (j<myArr[i].length) {
if (message.length<=0) {
message = myArr[i].substring(0, j);
} else {
message = myArr[i].substring(0, j);
}
// message is the variable name of your textfield
j++;
} else {
i++;
j=1;
}
};
stop();
textfile doesn't need a full stop at the end of each line - just needs a carriagle return.
This types the text from each line and then refreshes it - typing again from a clear textfield.
Hope it is what you are looking for. If you need more help - or the fla then just ask
billystyx
loadVariables("txtfile.txt
frame2:
if(myText.length>0){//myTe
gotoAndStop(4);
}
frame3:
gotoAndPlay(3);
frame4:
//with the textfield with variable name 'message'
num = 0;
myArr = [];
val = 4;
//number of lines in txtfile
for (i=0; i<val; i++) {
_root["var"+i] = myText.indexOf("\r\n", num);
_root["vara"+i] = substring(myText, num, _root["var"+i]);
myArr.push(_root["vara"+i]
num2 = myText.length;
myText = substring(myText, _root["var"+i]+3, num2);
}
j = 1;
i = 0;
onEnterFrame = function () {
if (j<myArr[i].length) {
if (message.length<=0) {
message = myArr[i].substring(0, j);
} else {
message = myArr[i].substring(0, j);
}
// message is the variable name of your textfield
j++;
} else {
newline1=getTimer();<--the
}
if(newline1+2000<getTimer(
i++;
j=1;
}<-- to here
};
stop();
That sorts out the interval - how do you mean 'scroll line by line'?
billystyx
my email is in my profile, but to scroll the text you mean you don't want to replace each line with the next - but that you want it to go to a new line, after a space of time?
So, in essence, it would be typing itself out, one character at a time, and when it reaches the end of each line it stop and waits for a bit, and then continues. Is this correct?
Or is the original question now answered but you need to know how to scroll text in a text field?
If so, mytext.scroll +=1; on an up button
and
mytext.scroll -=1;
on a down button will scroll text.
billystyx
To move the texbox using motion tween you need to give the textfield an instance name, and click on character in the properties box of the textfield, click on the 2nd radio button (specify ranges), and use multiselect to choose uppercase, lowercase, numbers and punctuation.
Then, in the main timelineline, first frame again, add code like this:
myText1.onEnterFrame=funct
this._y -=2;
}
and you will see the text box move up the screen..
if you want to stop it somewhere then:
myText1.onEnterFrame=funct
if(this._y>50){
this._y -=2;
}
billystyx
Delay not working
see my code
frame4:
num = 0;
myArr = [];
val = 100;//number of lines in txtfile
for (i=0; i<val; i++) {
_root["var"+i] = myText.indexOf("\r\n", num);
_root["vara"+i] = substring(myText, num, _root["var"+i]);
myArr.push(_root["vara"+i]
trace(myArr);
num2 = myText.length;
trace(num2);
if (num2==0) {break;}
myText = substring(myText, _root["var"+i]+3, num2);
}
j = 1;
i = 0;
onEnterFrame = function () {
if (j<myArr[i].length) {
if (message.length<=0) {
message = myArr[i].substring(0, j);
} else {
message = myArr[i].substring(0, j);
}
// message is the variable name of your textfield
j++;
} else {
//delay timer..
newline1=getTimer();
trace(newline1);
}
if (newline1+25000<getTimer()
i++;
j=1;
}
//trace(i&j);
//Repeat again after last line ...
if (myArr[i].length==0){gotoA
//}
}
stop();
--------------------------
try this:
num = 0;
myArr = [];
val = 4;
//number of lines in txtfile
for (i=0; i<val; i++) {
_root["var"+i] = myText.indexOf("\r\n", num);
_root["vara"+i] = substring(myText, num, _root["var"+i]);
myArr.push(_root["vara"+i]
num2 = myText.length;
myText = substring(myText, _root["var"+i]+3, num2);
}
j = 1;
i = 0;
onEnterFrame = function () {
if (j<myArr[i].length) {
if (message.length<=0) {
message = myArr[i].substring(0, j);
} else {
message = myArr[i].substring(0, j);
}
// message is the variable name of your textfield
j++;
} else {
if(timing!=true){
timing=true;
timer();
}
}
};
function timer(){
var intervalID;
_root.intervalID = setInterval( time, 3000 );
}
function time(){
timing=false;
i++;
j=1;
clearInterval(_root.interv
}
stop();
billystyx
now see my almose final code
Frame1:
num = 0;
loadVariables("txtfile.txt
Frame2:
if(myText.length>0){//myTe
gotoAndStop(4);
}
Frame3:
gotoAndPlay(3);
Frame4:
num = 0;
myArr = [];
val = 100;//number of lines in txtfile
for (i=0; i<val; i++) {
_root["var"+i] = myText.indexOf("\r\n", num);
_root["vara"+i] = substring(myText, num, _root["var"+i]);
myArr.push(_root["vara"+i]
trace(myArr);
num2 = myText.length;
trace(num2);
if (num2==0) {break;}
myText = substring(myText, _root["var"+i]+3, num2);
}
j = 1;
i = 0;
onEnterFrame = function () {
if (j<myArr[i].length) {
if (message.length<=0) {
message = myArr[i].substring(0, j);
} else {
message = myArr[i].substring(0, j);
}
// message is the variable name of your textfield
j++;
} else {
//time delay after each line
if(timing!=true){
timing=true;
timer();
}
}
};
function timer(){
var intervalID;
_root.intervalID = setInterval(time, 2000 );
}
function time(){
timing=false;
i++;
j=1;
clearInterval(_root.interv
if (myArr[i].length==0){gotoA
}
stop();
--------------------------
Thanks again to help me ...
Business Accounts
Answer for Membership
by: BillystyxPosted on 2005-05-06 at 09:30:46ID: 13945910
If you want the text line by line, unless you know the specific number of character per line, I would recommend loading the text from a db.
Billystyx