Dyanmic text

this is the best example i could find

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

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

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

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

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]

*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:

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

thanks i can edit it from here

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

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

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(-:

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

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:

here is a download to make it more clear

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

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

thanks alot:)

coooool and good night Chris