Question

Text File in Flash

Asked by: ISKPatel

i 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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-05-06 at 06:54:13ID21415129
Tags

flash

Topic

Adobe Flash

Participating Experts
1
Points
200
Comments
34

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Flash movieclips
    I'm trying to make a movieclip play when rolled over and loop while the mouse is over, then stop when rolled off. I also want to do the same using a seperate button elsewhere on the page to control the movieclip. Do I have to place the movieclip on the page where i would l...
  2. Flash MX movieclip targeting problem
    Hello, I'm fairly new to Flash and Actionscripting (and expertsXexchange!), and Im sure this is a basic question but its driving me mad! I have a scene called 'layout' which has two empty movie clip instances called 'header' and 'text'. These blank instances have Ac...
  3. On mouse Move in Flash
    Hi , Iam totally new to Flash, I would likt to creat a web page in Flash which looks very smiliar to the following web site http://www.ysl.com/ I would like to create some thing like the one shown there... i.e... on moving the mouse near the text(YVESSaintLaurent) i w...
  4. Flash question movieclip actions
    Flash Question I am trying to make movieclip buttons that when you click on them everything else on the page fades out, the button moves to a different position and new content enters the stage. My questions are: 1. Should I put the actions on the movieclip itself or...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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

 

by: BillystyxPosted on 2005-05-06 at 09:31:17ID: 13945923

...or if it has line break characters at the end of each line...
Billystyx

 

by: ISKPatelPosted on 2005-05-06 at 23:30:49ID: 13949727

but how can i load a .txt file in Flash

 

by: BillystyxPosted on 2005-05-07 at 00:40:31ID: 13949971

create the text file, with name value pairs, like
myVar=billystyx
and in flash, add a dynamic textfield with the variable name myVar, and add this code to the root
loadVariables("mytext.txt","","POST");


Billystyx

 

by: BillystyxPosted on 2005-05-07 at 00:41:04ID: 13949972

make sure the txt fiel is in the same folder as the swf (or html if ytou are viewing through html)

 

by: ISKPatelPosted on 2005-05-09 at 00:17:23ID: 13957522

i done this but this whole text show in the text field , but i need to show line by line after text field animation...
(Down to Upword)

 

by: BillystyxPosted on 2005-05-09 at 00:30:39ID: 13957573

You can load the text to a variable, and then show a number or characters at a time from line to line, but you need to know how many characters per line for this, or have some defining character at the end of each line.

That why I asked... do you know either of these things?

Billystyx

 

by: ISKPatelPosted on 2005-05-09 at 23:17:27ID: 13965801

ya i know each line end with "," and "."

 

by: BillystyxPosted on 2005-05-09 at 23:36:27ID: 13965865

with a comma and a full stop, code would look like this
frame1:
loadVariables("txtfile.txt","","POST");
frame2:
if(myText.length>0){//myText is the variable name in the txt file
      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.indexOf(",.",num);
_root["vara"+i]=substring(myText,num,_root["var"+i]);
trace(_root["vara"+i]);
num=_root["var"+i]+3;

}
stop();

Billystyx

 

by: ISKPatelPosted on 2005-05-10 at 23:58:14ID: 13975465

Thanks Dear
but now how can i show text in Dynamic Text Field and i want this text field in Motion (Down to Upwards)
how....?

 

by: BillystyxPosted on 2005-05-11 at 00:15:55ID: 13975552

scrolling? Or 'typing'?

Billystyx

 

by: ISKPatelPosted on 2005-05-12 at 00:14:56ID: 13984107

typing

 

by: BillystyxPosted on 2005-05-12 at 05:22:23ID: 13985312

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<myText.length){
myText_txt=myText_txt+substring(myText,n,1);
n++;
}
frame5:
gotoAndPlay(4);


If this doesn't work, let me know - I have a working example at home I can upload

Billystyx

 

by: BillystyxPosted on 2005-05-12 at 14:31:33ID: 13991238

try this:
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);

billystyx

 

by: ISKPatelPosted on 2005-05-13 at 00:30:48ID: 13993783

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","","POST")
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.indexOf(".",num);
_root["vara"+i]=substring(myText,num,_root["var"+i]);
trace(_root["vara"+i]);
gotoAndPlay(4);
num=_root["var"+i]+3;
}
stop();
frame4:// with text filed tween upto 14 frame..
if(myText_txt.length<myText.length){
myText_txt=myText_txt+substring(myText,n,1);
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....

------------------------------------------

 

by: BillystyxPosted on 2005-05-13 at 00:47:06ID: 13993842

try my post solution above - the first was flawed.
(this one no good)

if(myText_txt.length<myText.length){
myText_txt=myText_txt+substring(myText,n,1);
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

 

by: ISKPatelPosted on 2005-05-13 at 22:50:59ID: 14001349

dear
i need to show whole line
in your code they show charcter by charcter
tel is any way we put this text file line in array[]
i think we call from Array essaly
thanks...

 

by: BillystyxPosted on 2005-05-14 at 00:19:40ID: 14001485

frame1:
loadVariables("txtfile.txt","","POST");
frame2:
if(myText.length>0){//myText is the variable name in the txt file
     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

 

by: BillystyxPosted on 2005-05-16 at 06:09:28ID: 14009865

did that work? It looks good from my end - I think I might use it for something!:)

billystyx

 

by: ISKPatelPosted on 2005-05-17 at 23:30:12ID: 14024786

thanks dear its working like typewriter
but how can i put some delay after each next line
and can i scroll line by line ?
thanks again

 

by: BillystyxPosted on 2005-05-18 at 00:44:35ID: 14025035

loadVariables("txtfile.txt","","POST");
frame2:
if(myText.length>0){//myText is the variable name in the txt file
     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();<--these lines added
         
     }
if(newline1+2000<getTimer()){<--and here
i++;
          j=1;
}<-- to here
};
stop();


That sorts out the interval - how do you mean 'scroll line by line'?

billystyx

 

by: ISKPatelPosted on 2005-05-18 at 00:51:59ID: 14025066

Dear billystyx..
its mean i wanna to move my text filed Down or upward(motion tween) ...
when i complete my all work then i send u my code wiht my changes....!
can i asked ur name or lucation...?

thanks.

regards
ISKPatel

 

by: BillystyxPosted on 2005-05-18 at 01:43:24ID: 14025293

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

 

by: ISKPatelPosted on 2005-05-18 at 05:20:36ID: 14026295

nice profile...
and u r the expert in Macromedia Flash .....
no dear i not need a scroll bar buttons
i want to move my text box one place to other love Dwon to up ward (just we set motion tween & time line by pressing F6 button)
rest all thing working fine ... i try to set slow typing speed..
thanks

 

 

by: BillystyxPosted on 2005-05-18 at 05:44:30ID: 14026475

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=function(){
this._y -=2;
}

and you will see the text box move up the screen..
if you want to stop it somewhere then:

myText1.onEnterFrame=function(){//where myText1 is the instance name you gave it
if(this._y>50){
this._y -=2;
}

billystyx

 

by: ISKPatelPosted on 2005-05-18 at 22:42:28ID: 14033736

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){gotoAndPlay(1);}
//}
}
stop();
------------------------------------------------------

 

by: BillystyxPosted on 2005-05-18 at 23:17:38ID: 14033869

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.intervalID);

}
stop();

billystyx

 

by: ISKPatelPosted on 2005-05-18 at 23:32:02ID: 14033921

Done Thanks...

 

by: BillystyxPosted on 2005-05-18 at 23:53:41ID: 14033983

good luck with it:)

 

by: ISKPatelPosted on 2005-05-19 at 00:06:08ID: 14034033

now see my almose final code
Frame1:
num = 0;
loadVariables("txtfile.txt","","POST");
Frame2:
if(myText.length>0){//myText is the variable name in the txt file
     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.intervalID);
 if (myArr[i].length==0){gotoAndPlay(1);}
}
stop();
-------------------------------------------------------------
Thanks again to help me ...

 

by: BillystyxPosted on 2005-05-19 at 00:38:29ID: 14034137

no worries - is there anything else with this code you need help with? Or is that it?

billystyx

 

by: BillystyxPosted on 2005-05-20 at 02:33:46ID: 14043986

Hello, are you finished here in terms of the original question, or is there something else?

Billystyx

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...