- Home
- Flash Tips and Tricks
- How to create dynamict flash text field with data loading from extranal text file
How to create dynamict flash text field with data loading from extranal text file
- By Jacob Shaw
- Published 01/26/2010
- Flash Tips and Tricks
-
Rating:




Jacob Shaw
Hey, this is Jacob Shaw and I am the editor of this website. If you have any post, articles, tutorials or other web design information you would like to share please contact me directly.
A little bit about me. I am currently located in Germany and work as a project manager in one pretty big design company. I have a great experience in creating flash websites and I am pretty good aware of the technology :-) Thus the majority of my articles will be about creating small cute and useful things using Adobe Flash.
Ok, lets go and first create 2 layers called "layout" and "actions". Hope it's clear that one of them will be used for action script coding and another one for graphics.
Let's select the "layout" layer and create text field. As you can see on the properties tab the text field should be set to "dynamic", you can also play around with the font type and size. Under the "Dynamic" dialog we will assign internal name for this element which is "TextBox". If you are developing huge project I would recommend you to name your flash elements according to their functionality.
Good, now it's time to jump to "actions" layer and add some action script coding. As you see I try to use as many comments as I can, it will make further editing and upgrade of flasj somponent much easier both to you and your customers. Sofist thing we do is declare variables in the 1st line. Then we tell what will be the source txt file for our variables. And finally we load the variable from text file and handle the errors if any. Also the line TextBox.HTML = true aoows to support HTML formatting of the text. Ok, lets consider it done.
Now you should press CTRL-Enter button to compile flash movie into swf format and see if everything work. The last thing we've left to do is add a scroll bar. Of course we can create our own scroll bar, but let's keep things simple at the moment and use standard flash UI component. Simply open "Components Inspector" drag and drop the scroll bar on the dynamic text square. If you did it right you will have the same results as on the image below.
Now lets compile the movie and see the results. Looks good? I know it is :-) Ok, here are the flash source files, enjoy and get back to us later to see how to create flash contact form.
