A few days ago, Google released the official YouTube Chromeless Player AS3 API that gives us an exciting perspective of building flash applications integrating seamless Youtube videos.
Check out their announcement and the YouTube ActionScript 3.0 Player API Reference
Now let’s see a simple example that integrates a YouTube video into an ActionScript 3 Flash application with this API.
1. Create a new flash file (actionscript 3) and save it as youtube.fla. Set the stage size to 640×360 pixels.
Rename “layer 1 ” to “actions” and open the actions panel.
2. Following the YouTube ActionScript 3.0 Player API Reference, copy and paste the following code:
import flash.system.Security;
Security.allowInsecureDomain("*");
Security.allowDomain("*");
// This will hold the API player instance once it is initialized.
var player:Object;
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
function onLoaderInit(event:Event):void {
addChild(loader);
loader.content.addEventListener("onReady", onPlayerReady);
loader.content.addEventListener("onError", onPlayerError);
loader.content.addEventListener("onStateChange", onPlayerStateChange);
loader.content.addEventListener("onPlaybackQualityChange", onVideoPlaybackQualityChange);
}
function onPlayerReady(event:Event):void {
// Event.data contains the…
1255 readersDuring this tut we’ll take a look at using the YouTube API to build a custom YouTube player with ActionScript 3.0. Final Result Preview Let’s take a look at the final result we will be working towards: Step 1: File Setup Here’s how this is going to work: We’ll create a YouTube player wrapper that will receive the
1451 readers
561 readersIn this tutorial I will show you how to create a nice tooltip preloader with easing using Flash and ActionScript 3. We’ll be loading an external SWF file. Note: In order to complete this tutorial you need to download TweenMax library. Do it by clicking here. Unzip the downloaded file in the same directory as the
1937 readersYesterday I posted a blog post about the fact that FXG code can increases your SWF container size and tax your CPU, so you should take that into account when deciding if it’s better to load images on runtime, embed assets or use FXG code. Adding optimized FXG or MXML Graphics (MXMLG) is the
1107 readers
912 readers
2025 readers
933 readers
500 readers
823 readersThere has been some talk on Twitter recently about the best way to write an event handler. This is all in good fun of course as there is no right way to do any kind of code. Flashers come from all walks of life. Some are from the design world and some from serious development
8,004
Subscribe to RSS headline updates from:
GurusUnleashed
Powered by FeedBurner
Curious what others are searching for? Below are the most popular search terms over the last 30 days.

