Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Text File Overview

January 28, 2002

Before we go too far we should give an overview of what the text file will consist of and some options which are used inside of the file:

  • & - says that the next word is a variable name.
  • = - says that the following characters is to be read into the movie until it reaches the next ampersand (&).
  • %0D - is url-form code (a standard format used by server-side scripts) for a carriage return. You can't just use enter to seperate lines unless you want a blank line every second line.
  • &textloaded=OK - is going to tell Flash that the text file is loaded.

    For this example the ‘location.txt’ file contains the following information:
    &Name=Shawn Ryder
    &City=Lower Sackville
    &Province=Nova Scotia
    &Country=Canada
    &textloaded=OK



    Basically, what this does is show the variables of my name, city, province and country that I live. This is quite easy and straight forward, also allowing for easy updating of the content.

    We want to add the following:
    Frame 1

    loadVariablesNum ("location.txt", 0);
    Frame 2

    if (/:textloaded="OK") {
    gotoAndPlay (4);
    }
    Frame 3

    Go to and Play (2)


    As you can see the first frame uses ‘Load Variables’ script to call upon the text file that we created with the information. In the very next keyframe we used the If statement to see if the text file has successful loaded and move ahead once done – by using the goto and play script to move ahead to frame 4 and basically skip over the 3rd frame. If it hasn’t loaded at that point it goes to frame 3 which will simply go back to frame 2 and loop until completely loaded. Remember to insert keyframes in a scene, all that is required is to hit F6 on the keyboard and it gives you the ability to add some actions to that frame.

    Now, once we have the text loaded into the file we obviously need to display this in some way to the users of the site. This is where we need to create some textboxes inside of Flash that can be assigned variables used to display the text. This is quite straight forward, but we will certainly run through the steps to set them up.

    The first thing that we want to do is use the text tool to draw a text box in which the text will be displayed. Since the variable values are simply a line of text, these boxes only need to be one line and perhaps big enough to hold about a hundred characters at the very most! With the box created we now need to make some changes to the ‘text options’ in order to view the variables we have brought into the file. The first thing that we want to do is select the drop down menu and choose ‘Dynamic Text’ from this menu – this simply says that the text is going to be brought in dynamically. In the next drop down we can select either ‘Single Line’ or ‘Multiline’ and for this example we are going to just have one line of text so choose the Single Line option. Then in the variable box we put in the corresponding name for the variable we used in the text file. There are a couple of other options in the box including HTML (more about this in a minute), Border and Selectable. The only one we have selected is the border option so that there is a border seen around the text box field. This can be easily turned off if you don’t want the box to be seen and the selectable can be turn on if you want the user to be able to highlight the text in the box and in turn be able to copy it if they would like. Once you export the movie, you will need to make sure that the text file is in the same directory as the final movie. Look at the web page that is created and you will notice that the text is now brought in dynamically through the text file! Edit the variables inside the text file and refresh the web page to see what happens!

    Cursors, and Text, and HTML.... Oh My!
    Flash 5 Tutorial: Part 1
    Spicing Up the Text


  • Up to => Home / Authoring / Flash / Basic




    Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

    Search:

    Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

    Jupitermedia Corporate Info


    Legal Notices, Licensing, & Permissions, Privacy Policy.

    Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers