Flash
  Home arrow Flash arrow Page 4 - The Power of LoadVars Object
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
FLASH

The Power of LoadVars Object
By: Adi Reddy Mora
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 28
    2005-02-09

    Table of Contents:
  • The Power of LoadVars Object
  • Advantages of the LoadVars class
  • Receiving the variables in server-side script
  • Using LoadVars Object for loading data from text files
  • LoadVars.decode

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Power of LoadVars Object - Using LoadVars Object for loading data from text files


    (Page 4 of 5 )

    LoadVars Object can also be used to load data from text files.

    The following are the four basic steps involved in using LoadVars Object for loading text from .txt files into flash:

    1. Instantiate a LoadVars object.

    2. Use load method to load the text file data into LoadVars object.

    3. Use onLoad event handler method to assign a function which fires when the variables are received from the text file.

    4. Create a function with the name specified in step 3 to handle the received variables

    Let us see an example now to demonstrate the above steps in ActionScript 2.0

    Step 1

    var load_lv = new LoadVars();

    Step 2

    load_lv.load("textfile.txt");

    Step 3

    load_lv.onLoad = loadTextVariables;

    Step 4

    function loadTextVariables(success){

    if(success){
                       trace(this.name);

    }
    }

     

    The text file should contain the data in the following format:

    &name=John&id=342&ecode=e123

     

    The following tables list all methods, properties and events of the LoadVars Object.

    Methods:

    Method

    Description

    LoadVars.load

    Downloads variables from a specified URL.

    LoadVars.getBytesTotal

    Returns the number of bytes loaded from a load or sendAndLoad method.

    LoadVars.getBytesTotal

    Returns the total number of bytes that will be downloaded by a load or sendAndLoad method.

    LoadVars.send

    Posts variables from a LoadVars object to a URL.

    LoadVars.sendAndLoad

    Posts variables from a LoadVars object to a URL and downloads the server's response to a target object.

    LoadVars.toString

    Returns a URL encoded string that contains all the enumerable variables in the LoadVars object.

     
    Properties:

    Property

    Description

    LoadVars.contentType

    Indicates the MIME type of the data.

    LoadVars.load

    A Boolean value that indicates whether a load or sendAndLoad operation has completed.


    Event:

    Event

    Description

    LoadVars.onLoad

    Invoked when a load or sendAndLoad operation has completed.

     

    There is a hidden method available in LoadVars class which was not documented in flash documentation.

    More Flash Articles
    More By Adi Reddy Mora


       · I am Adi Reddy Mora, the author of this article from India. This is my 1st article...
       · Hi, I am a newbie in Flash. I am interested on your topic here. I have a problem on...
       · Flash does not deal with the proxy settings. If you are able to connect through...
     

    FLASH ARTICLES

    - Organizing Frames and Layers for Flash Anima...
    - Organizing Frames and Layers
    - Using XML and ActionScript with Flex Applica...
    - Interfaces and Events with ActionScript and ...
    - Manipulating Data with ActionScript in Flex ...
    - ActionScript Syntax for Flex Applications
    - ActionScript in Flex Applications
    - A Closer Look at Apollo`s File System API
    - Using the File System API
    - ActionScript 101
    - Flash Buttons
    - Advanced Flash Animation
    - Creating Your First Animated Movie with Flas...
    - Flash: Building Blocks
    - Building Preloaders






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT