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?
To Start we open up After Effects and create a new Composition. To ensure that we have no background layer toggle the Transparency Grid so that you get a “waffle background” which will look the same as when you are working with a transparent background in Photoshop.- Next just go crazy in After Effects and create your movie. For this example I just put two different text elements onto the composition and gave them both a little big of animation. After Effects allows you to import assets, so if you create a very nice background of image in Photoshop that was you want to use, just go to File -> Import -> File… and bring in anything you want to use.
- Once your movie is created you will want to render it so that you can use it in Flash. To render your video go to Composition -> Add to Render Queue
- Now that you are in the Render Queue locate Output Module, and click on the yellow text next to it to bring up the Output Module Settings. Go to Video Output and make sure that under Channels, RGB+Alpha is selected and that you Depth is Millions of Colors+. Those two settings are key to making sure you get a transparent movie.

- Since we are working with Flash after this we want to set our Format to FLV. Now that we’re done with that we want to hit the OK button. Last, make sure you video has a title under Output To on the main Render Queue tab and finally to render the video hit the Render button in the upper right of the Render Queue.
- Now close out of After Effects and open up Flash. You will want to create a new file. Once you get your new file you will want to go to File -> Import -> Import Video… to bring in your video you just created. Browse to your video, then make sure to choose “Embed FLV in SWF and play in timeline”. Now hit OK and your video will be brought into your Flash file.
- Your stage may appear to be blank but this is because you video plays out along the timeline. To view your video scrub across the timeline, or hit CTRL + Enter to view the SWF.

- The final step to this whole process is publishing the Flash file. To make sure we preserve the transparency, go to File -> Publish Settings… Click on HTML to get the HTML Settings. Under Window Mode select Transparent Windowless. Now just hit the Publish button and your SWF and HTML file will be published with movie in it. Now no matter what image you set as your background, or background color you choose, it will show through.

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'];
switch($name)
{
case "car":
$pp -> vehicle_make = "Ford";
$pp -> vehicle_model = "Mustang";
$pp -> vehicle_year = "2009";
$arr = array($pp);
echo json_encode($arr);
break;
case "truck":
$pp -> vehicle_make = "Ford";
$pp -> vehicle_model = "F-150";
$pp -> vehicle_year = "2000";
$arr = array($pp);
echo json_encode($arr);
break;
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'])
);
}
print_r(json_encode($strippedResults));
break;
default:
$pp -> results = "no valid information";
$arr = array($pp);
echo json_encode($arr);
break;
}
?>
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.
Posted in Programming, Tutorials | 1 Comment »
WiiFlash Error Fix!
Monday, August 10th, 2009
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 »

