Flash
  Home arrow Flash arrow Page 2 - Working with external data in Flash
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  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
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

Working with external data in Flash
By: Adi Reddy Mora
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 25
    2005-05-11

    Table of Contents:
  • Working with external data in Flash
  • getURL(), loadVariables(),loadVariablesNum(), loadMovie(), and loadMovieNum() methods
  • LoadVars Class
  • MovieClipLoader class
  • XML Class
  • XMLSocket Class

  • 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


    Working with external data in Flash - getURL(), loadVariables(),loadVariablesNum(), loadMovie(), and loadMovieNum() methods


    (Page 2 of 6 )

    The methods listed as the title of this section use the HTTP or HTTPS protocol to send information in URL-encoded format.

    getURL(): This method loads a document from a specific URL into a window or passes variables to another application at a defined URL. This method can used when you want to load a different URL onto the existing one. You also have the option of passing the data to a different URL using http POST and GET methods.

    Example:

    //opens
    http://www.devarticles.comin a blank window
    
    getURL("http://www.devarticles.com", "_blank");
    
    //sends the variables from flash to
    http://www.devarticles.com
    using POST method
    getURL("http://www.devarticles.com", "_blank", ”POST”); 
    

    loadVariables() , loadVariablesNum():These methods reads data from any external file, such as a text file or text generated by any server-side scripting technology such as ColdFusion, CGI script, ASP, PHP, Perl, and so on, and set the values for variables in a Flash.

    The main difference between the loadVariables() method and the loadVariablesNum() method is that loadVariables() sets the values for variables in a target movie clip, while loadVariablesNum() sets the values for variables in a level. You can also use this method to update variables in the active SWF file with new values.

    The text in the text files, or the text generated by the server-side script, should be in the standard MIME format application/x-www-form-urlencoded (a standard format used by CGI scripts). Any number of variables can be specified, as in the string shown below.

    name=Jhon&age=22&zip=534235
    
    Example:
    
    // Variables from data.txt will be loaded into target_mc movie clip
    
    loadVariables("data.txt", target_mc);
    
    // Variables from data.txt will be loaded into level 1
    
    loadVariablesNum("data.txt", 1);
    

    You can also use the movie clip’s loadVariables() method to load data directly into the movie clip.

    Ex: target_mc. loadVariables ("data.txt");

     

    loadMovie() , loadMovieNum(): These methods let you load external SWF files and JPEG files into the existing SWF file and are similar to loadVariables() and loadVariablesNum() methods. The difference between loadMovie() and loadMovieNum() is also the same, target and level.

    Example:

    // Loads play.swf file into target_mc movie clip

    loadMovie("play.swf", target_mc);

    // Loads play.jpg image into level 1

    loadMovieNum("play.jpg", 1);

    You can also use the movie clip’s loadMovie() method to load external SWF files or JPEG images into the movie clip directly.

    Ex: target_mc.loadMovie("play.jpg");

    More Flash Articles
    More By Adi Reddy Mora


     

    FLASH ARTICLES

    - Critical Flash Vulnerability Heats Up the Web
    - More on Nonpersistent Client-Side Remote Sha...
    - Nonpersistent Client-Side Remote Shared Obje...
    - Using the Decorator Pattern for a Real Web S...
    - Using Concrete Decorator Classes
    - Delving More Deeply into the Decorator Patte...
    - The Decorator Pattern in Action
    - A Simple Decorator Pattern Example
    - Decorator Pattern
    - 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







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT