Flash
  Home arrow Flash arrow Page 2 - Building Data-Driven Flash Movies
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
OLM
 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

Building Data-Driven Flash Movies
By: The Disenchanted Developer, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 70
    2002-07-23

    Table of Contents:
  • Building Data-Driven Flash Movies
  • Message In A Bottle
  • No Hands
  • No News Is Good News
  • Alien Invasion
  • What's On The Menu?
  • Splitting Up
  • Linkzone

  • 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

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    Building Data-Driven Flash Movies - Message In A Bottle
    (Page 2 of 8 )

    Before we get started with building a database-driven animation clip, you need to know a little theory.

    The first - and most critical - thing you need to know is that there is never direct communication between Flash and a database. A Flash movie can never talk directly to a database server - there is always a third party involved. This third party takes care of building and transmitting the query from the movie to the database, and retrieving and massaging the results into a format that is usable by the movie clip.

    This third party's role is usually played by a server-side application such as Perl, PHP, ASP, ColdFusion et al.

    In order to better understand this, let's consider a simple example. Pop open Flash, create a new movie and then create a new Graphic symbol. Name it "message".



    Now, in the Symbol Editor, create a text box with the Text tool (hit A on the keyboard). Use the Window -> Panels -> Text Options panel to turn it into a dynamic, multi-line text box.



    While you're there, also set a variable name for the newly-minted dynamic text box - this is the variable that Flash will look for when the time comes to populate the text box. I've used the variable name "msg".



    Back in the Scene Editor, drag and drop a copy of your newly-created symbol onto the Stage.



    In the timeline, select the first frame (this should be a keyframe), right-click it and pop up the Actions dialog box. On the left-hand side of the Actions panel, look in the "Basic Actions" sub-category and select the loadVariables() function. This ActionScript function allows you to load variables into the Flash movie from an external URL - more on how this works later.

    The lower half of the Actions panel should prompt you to enter some parameters for this function - specifically, the URL to get the variables from. For the moment, let's assume that the variables will be loaded from the URL "message.txt" - specify this in the lower half of the panel, as shown below.



    The file specified as the variable source must contain data in the MIME format "application/x-www-urlformencoded" - that is, a series of variable-value pairs separated by ampersands (&). Here's what my copy of "message.txt" looks like:

    msg=Welcome to the wonderful and wacky world of dynamic data sources!
    Obviously, this file should be stored in the same place as the Flash movie (you can store it elsewhere too, just remember to alter the URL supplied to loadVariables() appropriately).

    Now, when the Flash movie plays, the contents of the file "message.txt" will be read, converted to variables and used within the Flash movie. Take a look:



    Wanna change the message? Just alter the contents of "message.txt",

    msg=Look, Ma, no hands!
    and watch in amazement as your Flash movie changes as well!

    More Flash Articles
    More By The Disenchanted Developer, (c) Melonfire


     

       

    FLASH ARTICLES

    - Building Web Forms In Flash
    - Building Data-Driven Flash Movies
    - Flash 101 (part 6): The Final Countdown
    - Flash 101 (part 5): Spiralling Out Of Control
    - Flash 101 (Part 4): Don't Touch Me!
    - Flash 101 (part 3): Bouncing Around

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway