Archive for the ‘Tutorials’ Category

How To Export a Transparent Movie from After Effects

Wednesday, November 25th, 2009

This tutorial is based on need.  I needed this info earlier today, and I had to sort through about a half dozen sites to find all of this information.  The scenario is as follows:  I was tasked with creating an animated movie that has a layer of transparency.  My client did not know what color they were going to use as their background for the site, but they wanted an animated movie to transition into showing their logo.  Knowing this was my task I then posed two questions; How do I get a movie to render with an alpha layer in After Effects?  Also, can that transparent movie be put into Flash and published in Flash all the while maintaining the transparency?

Posted in After Effects, Flash, Tutorials | 1 Comment »

Use JSON to connect Flash to a Database

Monday, October 19th, 2009

I’ve worked through a few samples of JSON AS3 code so that I can hopefully create a simple example that readers may take away and expand for their needs. In a nutshell, I’ve used PHP to encode content into JSON which can then be decoded in AS3 to allow you to query a database in AS3 and get your results in Flash. I’ve shown all my PHP code in this post, however for the AS3 code download my zip file and run it in Flash. Note: I created this using CS4. I’m trying not to get out of this easy, but I feel the best way to understand the code is just download it, and look at how it works. Any questions, leave a comment!

Why add a database to Flash

Because you don’t want static content! By adding a database to your Flash files you allow for all sorts a possibilities. You can query a database, allow users to filter their data, add data to the database, and just make your page much more interesting!

Use PHP To Make the Database Connection

I use ADOdb Lite to make sure I have a secure database connection. You can check it out at the ADOdb sourceforge site. I’ll include the ADOdb files with the source code at the end of this post.

Get data from your database to your Flash file

I’ve created a file called query.php which acts as an intermediary between the database and Flash. query.php will receive a $_GET value named “name” which it will use to query the database. The first two are sample cases in the switch statement are just there to test that the query.php file is working. So if you go to query.php?name=car you should some output and likewise for query.php?name=truck.

< ?php
require_once 'config.php';
$name = $_GET['name'];
case "car":
$pp -> vehicle_make = "Ford";
$pp -> vehicle_model = "Mustang";
$pp -> vehicle_year = "2009";
$arr = array($pp);
echo json_encode($arr);
case "truck":
$pp -> vehicle_make = "Ford";
$pp -> vehicle_model = "F-150";
$pp -> vehicle_year = "2000";
$arr = array($pp);
echo json_encode($arr);
case "get all":
$dbResult = $qdb->Execute("SELECT * FROM work");
$results = $dbResult->GetAll();
$strippedResults = array();
foreach($results as &$result)
$strippedResults []= array(
'title' => stripcslashes($result['title']),
'description' => stripcslashes($result['description']),
'image' => stripcslashes($result['image'])
$pp -> results = "no valid information";
$arr = array($pp);
echo json_encode($arr);

Moving onto the AS3 Code

First thing’s first, make sure you have your required files to make sure Flash and AS3 can make sense of the JSON code.

import com.adobe.serialization.json.JSON;

I’ve zipped up a sql dump and all of the files for this project into a folder. Unzip the files, start up MAMP or the server of your choice, add the database, make sure the config.php file is configured correctly and you should be in action! Holler at me if you have any questions. If this post is popular I may go a bit more in depth into how to use this method of accessing a database to add data to a site and create a few examples.

Zipped Files here
final result

Posted in Programming, Tutorials | 1 Comment »

WiiFlash Error Fix!

Monday, August 10th, 2009

fixed image In my last post I mentioned the error I had been getting trying to use WiiFlash, particularly using wiiFlashServerJ which stated “Cannot launch Java application.  Uncaught exception in main method: java.lang.IllegalStateException: Bluetooth failed to initialize.  There is probably a problem with your local Bluetooth stack or API.”

Luckily I found a solution to this in the WiiFlash Forums.

In the Finder, and select Get Info from the File menu.
In the info panel, click the Open in 32 Bit Mode checkbox.

Please let me know if this works for you.

Posted in Tutorials | 4 Comments »