Flash
  Home arrow Flash arrow Page 4 - Building the Back End of a Content Managem...
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

Building the Back End of a Content Management System for Flash
By: Jennifer Sullivan Cassidy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 18
    2006-08-02

    Table of Contents:
  • Building the Back End of a Content Management System for Flash
  • The Back End Elements
  • 2. The PHP Code
  • Gluing it All Together

  • 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


    Building the Back End of a Content Management System for Flash - Gluing it All Together


    (Page 4 of 4 )

    In a short summary of what we are hoping to accomplish, we enter the content we wish to display into our HTML form, and on submission, our PHP form processing script then takes that content and stores it in our text file database, where it keeps each variable name set to its content (content1_txt=content here). Then we have our ActionScript look for the database we told it to, and load the contents of that database into our dynamic text area in the Flash website.

    Let's look at some of our ActionScript again in light of the information we just covered:

    myData.load("data.txt");

    It is this line of ActionScript that ties it all together. This ActionScript code tells Flash where to get the information to get its data from. Once the entire movie loads, it also loads the external data from the data.txt file into the variable content1_txt and displays it in the movie.

    Simplifying it a Bit

    For simplicity, I want to combine my HTML form with my PHP script, since I know that I can embed HTML within a PHP script.  So I place my HTML form in my backend.php script, and instead of pointing the form action to an outside PHP script, I can change it to refer back to itself, like this:

    <form action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post" name="input" id="input">

    Now, I have three steps. 

    The CMS in Action

    In a quick review, you are entering text into a form, which is then processed via PHP, written to a data file, and then loaded into Flash through a dynamic variable.  So far we have four different steps to our content management system.  Let's see if we can reduce the number of steps we have.

    Let's test it.  Export your flash movie and upload it and your PHP script to your web server.  It is not necessary to upload your data.txt file, as it will be created if it's not there; but since we want to see something other than a blank page let's upload it anyway. You can delete it later; just make sure you give it writeable permissions (777 will do fine).  Point your browser to your flash_cms.swf file, and you should see what we entered into our text file earlier.

    Now, I want to change the existing content from "This is the text that I want to display" to "This is NEW content!!!"  So in a new browser window, I open my backend.php script, and enter my new content in the input text box, and submit it.  If it is working correctly, you should see:

    Your content has been saved.
    This is what you submitted: content1_txt=This is NEW content!!!

    Now, let's refresh our Flash movie, and VOILA! The new content is indeed there. 

    Now view the data.txt file stored on the server; this is what you will see:

    In closing, this is not a glamorous software script by any means. However, it is an effective way to load external content into Flash without having to mess with the Flash or the data files themselves. Obviously, it would be just as easy for someone with the kind of knowledge to handle dynamic variables in Flash to adjust the text files, as we saw in the first article, and thus skip the most difficult step entirely. But for someone who doesn't wish to deal with FTP or database files, but would rather enter text into a form and have it just appear in Flash, this tutorial can help one accomplish just that. 

    Perhaps a part three to this tutorial would be in order, depending upon the sheer demand, dealing with multiple dynamic variables and forms, and implementing some formatting tricks. I will certainly be open to doing one as long as it would be something you as readers could use.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Did you find this article helpful or useful? I certainly hope that you are able to...
       · This article was exactly what I was looking for! However, I think that a third...
       · This was a great tutorial for the basics, however it did not work for me. I got a...
       · This was exactly what i needed for a site i was working on!!!
       · First of all, thank for this tutorial, it's just hwat i needed! Stil dealing with 2...
       · how can I implement this using an XML file. the thing is i have this dynamic news...
     

    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 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek