Flash
  Home arrow Flash arrow Page 6 - Building Data-Driven Flash Movies
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
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

Building Data-Driven Flash Movies
By: The Disenchanted Developer, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 71
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    Building Data-Driven Flash Movies - What's On The Menu?
    ( Page 6 of 8 )

    Another, more advanced example involves constructing a Flash menu dynamically, from the information in a database. This allows you to build menus that can grow and shrink automatically, as the information in the database changes, and it's a guaranteed entry into Flash geekdom.

    The process is fairly complicated, so let me run you through a quick theoretical overview before we get started. Most of the work here happens via an ActionScript function named duplicateMovieClip(), which makes it possible to programmatically clone a Flash movie clip symbol. So, if you had a single movie clip symbol, representing a single menu item, you could combine the duplicateMovieClip() function with a loop to spawn numerous copies of that single menu item, and thereby build an entire menu dynamically.

    This might seem a little far-fetched, but it works pretty well...as you'll see very shortly. First, though, let's get all the pieces together.

    Let's assume that the data to be used for the menu is stored in a MySQL database table named "menu", and that it looks like this:

    +-------------------------------------+--------------+ | link | label | +-------------------------------------+--------------+ | http://www.melonfire.com/services/ | Services | | http://www.melonfire.com/company/ | Company | | http://www.melonfire.com/mcenter/ | Media Center | | http://www.melonfire.com/account/ | Your Account | | http://www.melonfire.com/community/ | Community | +-------------------------------------+--------------+
    Pop open Flash, create a new movie, and create a couple of new symbols. The first one is a graphic symbol containing a single-line dynamic text box - name the symbol "text" and the data variable "label".



    At a later stage, I'll be using ActionScript to set a value for this "label" variable.

    Next, create a button symbol, one which includes keyframes for up, over and down states. Here's what mine looks like:



    Name this button symbol "circle".

    In case you're wondering how I created this, it's fairly simple. In the Symbol Editor, use the Oval tool to create a hollow circle (remember to make the fill colour transparent to achieve the hollowed-out effect) for the Up state.



    Next, insert a new keyframe for the Over state, and place a smaller inner circle within the outer one. Make sure that this one has a fill colour (I've used red).



    Finally, create a movie clip symbol named "item".

    This symbol is what I'll be using to generate the menu items in my dynamic Flash menu. It should contain both a button (which the user can click to go to a specific URL) and a label (which describes the menu item). You've already created both these components; all you need to do is drag and drop them from the Library into the movie clip Symbol Editor.



    Yes, that's right - your movie clip symbol is made up of two other symbols. No, I'm not smoking a controlled substance - all will become clear shortly.

    Now, right-click the "circle" symbol in this movie clip and insert some ActionScript:

    on (release) { getURL (url); }
    At a later stage, I'll be using ActionScript to set a value for this "url" variable.

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

       

    FLASH ARTICLES

    - An Overview of Flash and ActionScript
    - 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





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