# Dyanmic text

**URL:** https://forum.kirupa.com/t/dyanmic-text/21584
**Category:** Uncategorized
**Created:** [May 23, 2003, 1:26pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584 "2003-05-23T13:26:26Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![chris9902](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@chris9902](https://forum.kirupa.com/u/chris9902)
#### Post date: [May 23, 2003, 1:26pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/1 "2003-05-23T13:26:26Z")

</div>

this is the best example i could find

[http://www.limpbizkit.com/news/default.asp?id=1059](http://www.limpbizkit.com/news/default.asp?id=1059)

see when you click a title of news it loads the text into a text box next to it.

how do i create an effect like this is flash

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 1:44pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/2 "2003-05-23T13:44:07Z")

</div>

Hi Chris,  
There are many different ways to do this, however, if you want to update your text easily, you need to put you text into a flat txt file ( notepad or something like that), then place a text box on stage, give it an **instance** and on your button put this code

[AS] on(release){  
loadText = new loadVars();  
loadText.load(“name of text.txt”);  
loadText.onLoad = function (success){  
if (success){  
var inside txtfile.html = true  
var inside txtfile.htmlText = this.//instance name of txtbox;  
}  
};[/AS]

Hope that helps

SteveD

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 1:54pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/3 "2003-05-23T13:54:11Z")

</div>

so make the text title buttons and give everyone that code but use different text files to load the different content:-\

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 2:01pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/4 "2003-05-23T14:01:29Z")

</div>

Hi  
Yep, exactly, however, by crafty naming of the text files and buttons you can minimize your code considerably - if your not in a hurry I will try and put togehter an example for you a bit later OK

SteveD

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 2:04pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/5 "2003-05-23T14:04:05Z")

</div>

hey man i got loads of errors

[AS]Clipboard Actions: Line 6: ‘;’ expected  
var inside txtfile.html = true

Clipboard Actions: Line 7: ‘;’ expected  
var inside txtfile.htmlText = this.//instance name of txtbox;

Clipboard Actions: Line 8: Expected a field name after ‘.’ operator.  
}

Clipboard Actions: Line 1: Statement block must be terminated by ‘}’  
on(release){

Clipboard Actions: Line 10: Syntax error.  
[/AS]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 2:07pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/6 "2003-05-23T14:07:46Z")

</div>

> \*Originally posted by SteveD \*  
> \*\*Hi  
> Yep, exactly, however, by crafty naming of the text files and buttons you can minimize your code considerably - if your not in a hurry I will try and put togehter an example for you a bit later OK

SteveD \*\*

that would be cool

i seem to be doing something wrong:crazy:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 2:38pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/7 "2003-05-23T14:38:04Z")

</div>

Hi Chris,  
The reason for all those errors is that you should have replaced things like **var inside txtfile** with the actual name of the var and so on.  
In this file you will notice that the titles are one word, if you address instance names of more than one word with spaces in between Flash will thow up errors like this.  
You will find all the actions you need inside mc.button on frame1, some people prefer to put all of the code on the \_root, but this will mean writing the same code for each button that you have.  
It is very quick & dirty, any Q’s post here

Cheers

SteveD

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 2:52pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/8 "2003-05-23T14:52:48Z")

</div>

thanks i can edit it from here

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 3:16pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/9 "2003-05-23T15:16:14Z")

</div>

ok help me out here

i have made a total \*\*\*\*ing \*\*\*\* up of this, i thought i just had to add what you posted to a button but when i looked at yours there was loads of stuff i had to do.

here is one i made but does not work, no errors just does not load the .txt file.

i added what you had in the action part of your button.

i am going to bang my head against a wall in a minute

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 3:40pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/10 "2003-05-23T15:40:04Z")

</div>

Hi Chris,  
cannot access your file, every time I click to download, I get an error message and my browser crashes !!!  
Are you using a Flash button, or an mc - if you look in the library in my file you will see mc.button, that is an ordinary mc and **NOT** a button.  
If you are using a button the code should look like this :  
[AS]on(release){  
loadText = new loadVars();  
loadText.load(\_name + “.txt”);  
loadText.onLoad = function (success){  
if (success){  
trace(success);  
newsBox.html = true  
newsBox.htmlText = this.myNews;  
}  
}  
};[/AS]  
If you are using an ordianry button change  
[AS]loadText.load(\_name + “.txt”)  
//to  
loadText.load(“todays.txt”)[/AS]

you need to put the code on each button and adjust to the text file name.  
If that doesn’t work, post your button code here

SteveD

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 5:47pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/11 "2003-05-23T17:47:39Z")

</div>

ok i am using a normal button

created using F8

but am getting this error

[AS]Clipboard Actions: Line 13: Statement must appear within on handler[/AS]

i am trying to work out what the ordianry button change thing is you posted:-\

i tried

[AS]on(release){

loadText.load(\_name + “.txt”)  
//to  
loadText.load(“todays.txt”)

```
    loadText.onLoad = function (success){
            if (success){
                    trace(success);
                    newsBox.html = true
                    newsBox.htmlText = this.myNews;
            }
    }

```

};[/AS]

what am i doing(-:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 6:05pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/12 "2003-05-23T18:05:36Z")

</div>

Hi,  
You missed a line of code and there are a couple of typos which are my fault copy and paste this, but remove the comments after //(make sure you remove the // as well:

[AS] on(release){  
loadText = new loadVars();//you missed this line   
loadText.load(“Todays.txt”)//Todays with a capital T  
loadText.onLoad = function (success){  
if (success){  
trace(success);  
newsBox.html = true  
newsBox.htmlText = this.myNews;  
}  
}  
}//no semi colon after the curly bracket  
[/AS]

That will do it

Cheers

StteveD

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 6:45pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/13 "2003-05-23T18:45:46Z")

</div>

o my good i am so \*\*\*\*ing thick

all i am getting is TRUE pop-up

ok here is what i do

===================

make a DYANMIC text box called “myNews”

make a button called “button” :sure:

then add your code you just posted on to the button  
(i click on the button, bring up the props and add it there. NO errors)

then i move the .swf into a folder with a text file called Todays.txt in it.

and preview the .swf but nothing happens:angry:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 6:50pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/14 "2003-05-23T18:50:41Z")

</div>

here is a download to make it more clear

> **[Yahoo Small Business - Cheap Domains, Web Hosting, Website Builder, Ecommerce...](https://smallbusiness.yahoo.com/)**
>
> Yahoo Small Business Offers Cheap Domain Names, Web Hosting, Easy Website Builder, Business Email, Local Listings, and Ecommerce Solutions for Your Small Business.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 7:39pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/15 "2003-05-23T19:39:06Z")

</div>

Hi Chris,  
What is going on ? I cannot acces your file which is more to do with my aol browser thatn your link, so here is the file in its entirety. Are you giving the text box (newsBox) an instance name or a variable name ? look at the code on the buttons, it is identical exwcept for the text file names, do not give your buttons an instance name - try it and see - let me know I will not be on line much longer as it late Friday night and certain other thing beckon and have more hold over me thanMX ( especially on a Friday night).

SteveD

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 7:58pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/16 "2003-05-23T19:58:57Z")

</div>

ok i got it, i see what i was doing wrong now

thanks alot:)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 8:10pm UTC](https://forum.kirupa.com/t/dyanmic-text/21584/17 "2003-05-23T20:10:02Z")

</div>

coooool and good night Chris
