Sample Flash AS3 Code to Help Designers and Developers Handle Data and Communication

by

Key to the Sheridan Interactive Multimedia program curriculum is teaching learners to build environments in which end users can communicate with each other. To do this, we need interfaces for input and display and we have to get data to and from the server. Think facebook, flickr, YouTube, etc.

Adobe Flash provides many communication classes and methods such as:

  • User Interface Components:
    • Button
    • CheckBox and RadioButton (Check Box & Radio Button)
    • ComboBox and List (Combo Box)
    • TextArea, TextInput and Label (Text Area & Input)
    • NumbericStepper and ScrollPane (Numeric Stepper & Scroll Pane)
    • Slider and TileList (Tile List)
    • DataGrid (Data Grid)
  • navigateToURL to load a Web Page from Flash
  • SharedObject to save a Flash “cookie”
  • FlashVars & SWF Query String to pass variables into Flash
  • ExternalInterface to call a function in Flash from JavaScript
  • Loading a SWF with Loader and URLRequest
  • FileReference to upload a local file to be used by flash
  • URLLoader and URLVariables to retrieve text or server output
  • XML to send and receive XML
  • Web Services to connect to scripts on other servers
  • Remoting to avoid serializing and deserializing data

Here are links to content examples from our curriculum for all of the above except Web Services and Remoting. The Sheridan lessons include more than the content – there are supporting lesson plans, definition documents, steps for building, supplementary links, reflection forms, and in class explanation, lab work, assignments, exams and final projects. If you are looking into schooling in multimedia, please visit the Sheridan Interactive Multimedia site for more information on our one year post grad program.

User Interface Components

Click here for code example

Flash AS3 Components

Communication 1 – navigateToURL, SharedObject, FlashVars, ExternalInterface, Loader, URLRequest and FileReference

Click here for code example

Flash AS3 Communication

Communication 2 – URLLoader and URLVariables to get text or server script data (PHP, MySQL)

Click here for code example

Although we recommend the Falcon Data Class for this type of connection

Flash AS3 Communication

XML in Flash

Click here for code example

Although we recommend the Falcon Data Class for this type of connection

XML in Flash CS3

Advertisements

Tags: , , , , , , , , , , , ,

11 Responses to “Sample Flash AS3 Code to Help Designers and Developers Handle Data and Communication”

  1. Dan Zen Says:

    Just did an update on the communication.zip file to put in the code that fixes the ExternalInterface for IE. The code was right in the sample html but an older version in the zip file. Sorry about that! It was quite the bug too – a double bug – a timing issue and you can’t name the functions in flash and javascript the same thing.

  2. Dan Zen Says:

    Thanks to Martin who let us know the code in the zip was not updated.

  3. Steffy Says:

    I can’t find the Communication2 file you refer to at http://imm.sheridanc.on.ca/code/communication2.html

    Is there any chance this will be fixed? I can really use those files ^^

    Thanx anyway for the great script 😀

    Steffy

  4. Dan Zen Says:

    Oops – sorry Steffy… just noticed your comment. The link was pointing to communication.zip instead of communication2.zip – and is fixed now on http://imm.sheridanc.on.ca/code/communication2.html.

  5. Manejo y presentación de datos con AS3 - Bases de Datos, XML, Server side scripts, URLLoader, URLVariables « Shift F12 Says:

    […] (imagen tomada del post original) […]

  6. Dan Zen Says:

    Nice review at Flash Enabled – thanks guys…

    http://flashenabledblog.com/2008/06/11/article-source-sample-flash-as3-code-to-help-designers-and-developers-handle-data-and-communication/

  7. david Says:

    how do we put a CheckBox in the DataGrid while loading its data from external XML?

    cud u plz suggest!

    thank you in advance!

  8. Dan Zen Says:

    You can use FalconProvider at http://falconflash.wordpress.com to get a DataProvider object from XML with a few lines of code.

    Once you have a DataProvider, you can use the various methods of the DataProvider like addItem() or addItemAt() to add items or replaceItem() etc. You might want to do so in a loop that either loops through your XML or the DataProvider’s array.

    I have never had to put checkboxes in datagrids. It is done with a custom CellRenerer class. I took a scan of the Web but after half an hour have not found an easy working model. http://www.adobe.com/devnet/flash/quickstart/datagrid_pt3/ is a good start. http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=665&threadid=1317199&enterthread=y has one but is a couple hundred lines of code 😉

  9. xerox 8560 driver Says:

    My coder is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the expenses.
    But he’s tryiong none the less. I’ve been using Movable-type on numerous websites for about a year and am concerned
    about switching to another platform. I have heard good
    things about blogengine.net. Is there a way I can transfer all my wordpress content into it?
    Any help would be really appreciated!

  10. ecommerce design Says:

    Hey! I understand this is somewhat off-topic however I needed to ask.

    Does running a well-established website such as yours require a massive
    amount work? I am brand new to operating a blog but I do
    write in my journal everyday. I’d like to start a blog so I can easily share my experience and feelings online. Please let me know if you have any kind of recommendations or tips for new aspiring blog owners. Appreciate it!

  11. Heating functions Says:

    Goodd information. Lucky me I ran across your site by
    accident (stumbleupon). I have saved as a favorite for later!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: