Adobe Flash Platform ActionScript 3.0 Reference

Flash Platform ActionScript 3.0 Reference

This is a short post but a helpful one in case You haven’t noticed it The ActionScript 3.0 reference for the Adobe  Flash Platform it’s out of beta and works great letting You select and filter out your results by APIs, frameworks, platform and more, and its information it’s not only of ActionScript 3.0 but also for Flex, TLF,  AIR, LiveCycle, ColdFusion and more. So if you need help in finding some information and see the inner works of those API’s be sure to check it out, it’s a must have in any Developer library.

ActionScript 3 migration cookbook beta at Adobe Developer Connection

ActionScript

A new section on the Adobe Developer Connection it’s up , ActionScript 3 migration cookbook and it looks really usefull if you’re still using  ActionScript 2 on a regular basis this cookbook  would be a good migration point.

You can already see some entries online or download the pdf version of the ActionScript 3 migration cookbook


An excerpt form the site:
The ActionScript 3 migration cookbook beta provides a quick introduction to migrating to ActionScript 3 from ActionScript 2. It is targeted at designers and developers who have some experience scripting content within Adobe Flash CS4 Professional. It does not require an understanding of object-oriented programming.

New Facebook Adobe Developer Connection

Adobe Developer Connection Facebook

Adobe teams up with Facebook and releases new Adobe Developer Connection (Adobe Flash Platform and Facebook Platform ).
So if You where thinking on how to start developing  Flash Applications for Facebook you will find this site very useful.
It includes various how to start videos , useful information and a brand new ActionScript 3.0 Facebook API:
Get the API

Get started

Deliver rich, social experiences on the web

The Adobe Flash Platform and Facebook Platform provide the ideal solution for building rich, social experiences on the web. Flash is available on more than 98% of Internet-connected PCs, so people can immediately access the applications, content, and video that enable social interactions. The Facebook Platform is used by millions of people everyday to connect and share with the people in their lives. Together, both platforms allow you to:

* Share: Create rich interactions for users to share with friends.
* Have fun: Make games social; let users compete against their friends.
* Connect: Let users connect to your RIAs with Facebook Connect.
* Solve problems: Build RIAs that harness the power of community.
* Reach people: Reach millions of Facebook users through social distribution.

The new ActionScript 3.0 Client Library for Facebook Platform API, fully supported by Facebook and Adobe, makes it easy to build applications that combine the strengths of the Flash Platform and Facebook Platform.

Wonderfl code and compile Actionscript in the Browser

WonderFL

Wonderfl Build Flash Online is a  tool that let’s you write and compile as3 ( actionscript3 ) code right in your browser,  the compiler version it currently uses is  ActionScript Version 3.2.0 build 3794 , and lets you use the following libraries:

The people behind this project are:

KAYAC Inc.‘s lab team: BM11.
Director: sugimasa
Designer: hashimoto
Markup Engineer: sakakibara
Programmer: ohtsuka
**KAYAC Inc.’s Flash Developer team blog: level0

Besides  writing and compiling as3 code in your browser the site has  some  community features that let’s you view and remix other people’s code and you can also embed your code on your blog.

I’ve written and compiled one of my examples there , and have plans to add some more :)

Check it  at Wonderfl

Google Analytics Tracking for Adobe Flash

A new API for using  Google Analytics Tracking in Flash/Flex projects this API is developed in ActionScript 3.0 and can be used as a component or called in your ActionScript code, Google Analytics Tracking for Adobe Flash seems to solve a lot of troubles and the needed workarounds for making consistent user tracking in your Flash projects, keep reading for a more detailed explanation extracted from the implementation overview.

The Google Analytics Tracking for Adobe Flash component makes it easy for you to implement Google Analytics in your Flash-driven content. This component contains all of the functionality of the Google Analytics Javascript code, and is 100% compatible with the latest ga.js tracking code. The Flash Tracking component is a compiled tracking object native to ActionScript 3, making Analytics implementation intuitive in Flash, and Flex development environments.

You can develop Analytics Tracking for Flash in either Adobe Flash or Adobe Flex environments. Each environment requires a different component, which you can download from http://code.google.com/p/gaforflash/. These components are based on ActionScript 3 and can be set up in one of two ways for each environment:

In Adobe Flash

  • Add and configure a simple component in the component inspector and drag it to the stage.
  • Import the Flash Tracking libraries directly into your library and start coding.

In Adobe Flex

  • Include an MXML component that you configure from am MXML file.
  • Import the Flash Tracking libraries into your script tags/AS3 files.

How to use the Component in Adobe Flash

In order to use the Flash tracking component in your environment, you either use the visual tools inside Flash, or you set up the tracking object directly in your code. Regardless of whether you are setting up the component visually or via code, you provide the following elements:

  • the web property ID—This is also known as the UA number of your tracking code and looks like UA-xxxxx-yy, where the x’s and y’s are replaced with the numbers that correspond to your account and profile information for the object you are tracking. See Web Property for more information.
  • the tracking mode—Choose either bridge mode or AS3 mode. This mode determines how your tracking communicates with the Analytics servers and is described in detail below.
  • the debugging mode—No matter which environment or tracking mode you use, you can turn debugging on to validate and test your tracking.

Installation for Flash CS3

Before you begin to use gaforflash to add Analytics tracking within Flash CS3,
you first need to add the gaforflash SWC to Flash CS3.

To do so:
1. If you have Flash CS3 currently open, quit the application.

2. Navigate to the location where you unzipped the Google Analytics zip
and find the swc (e.g. lib/analytics_flash.swc).

3. Create a “Google” directory in one of the following locations
and copy the SWC file there:
– (Windows) C:\Program Files\Adobe\ Adobe Flash CS3\language\Configuration\Components
– (Mac OS X) Macintosh HD/Applications/Adobe Flash CS3/Configuration/Components

Flash CS3 is now set up to support Google Analytics Tracking For Adobe Flash.

Alternatively if you want to use gaforflash in code-only mode
you can do the same as the above and add the lib/analytics.swc,
you will then need to drag the “AnalyticsLibrary” component in your Library.

Installation for Flex Builder 3

Before you can compile your code, you will need to link it to the gaforflash SWC file.

To do so:
1. select Project->Properties.
A Properties dialog box will appear for your project.
Click on Flex Build Path and then select the Library Path tab:

2. Click Add SWC… within the Library Path pane.
An Add SWC dialog box will appear.
Navigate to the location where you unzipped the Google Analytics zip
and select lib/analytics.swc file and click OK.

or

Just drop the analytics.swc file into your Flex project /libs directory

Here’s the link for the Google code project

The gaforflash direct download

More info on the API

Drawing API and Mouse Events

DrawingAPI
Click on the image to see the example and get the code.

A pair of days ago I found the blog of Sorin Haidan in wish he post some very useful tutorials on Flash and Actionscript 3.0 in a very understandable way, I found one that caught my attention called Draw Custom shapes with ActionScript 3.0. In this tutorial he explains how to make a “Ball” appear on screen every time you click and move your mouse on the screen by using the Drawing API and MouseEvents, the change of the color on the ball was achieved doing a loop in a 10 frame movie clip with a ball of different gradient fill on each frame, so occurred to me to wrap that code on a class on a Flex 3 Actionscript Project and get rid of the Flash assets by drawing the ball in a dynamic way and this let me Change the color of the Ball more than the 10 times of Sorin example, so check the example be sure to check Sorin’s blog .
In my example if you right click on the file you get to see the source that it’s also included below this text here’s what I got: Drawing API Ball Example.

Thanks Sorin for letting me mess around with his code keep up with those good tutorials.

?View Code ACTIONSCRIPT3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
/////---- Class by Dave Ga?mez (.swfgeek) 24-February-2008 http://www.swfgeek.net----\\\
///---- Original Example by: Sorin Haidan in his  Draw Custom shapes with ActionScript 3.0. Tutorial ----\
///---- Found on his blog http://biochimistu.blogspot.com/ ---- \
*/
 
package {
 
    import flash.display.GradientType;
    import flash.display.SpreadMethod;
    import flash.display.Sprite;
    import flash.display.StageScaleMode;
    import flash.display.StageAlign;
    import flash.events.MouseEvent;
    import flash.geom.Matrix;
    import com.adobe.viewsource.ViewSource;
 
    [SWF(backgroundColor="0x000000",frameRate="31")]
 
    public class DrawingAPI extends Sprite
    {
        private var sprite:Sprite;
        private var holder:Sprite;
        private var myCircle:Sprite;
        private var fillType:String;
        private var colors:Array;
        private var alphas:Array;
        private var ratios:Array;
        private var matr:Matrix;
        private var spreadMethod:String;
        private var focalPointRatio:Number;
 
        public function DrawingAPI()
        {
            init();
        }
 
        private function init():void
        {
            ViewSource.addMenuItem(this, "srcview/index.html");
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            stage.addEventListener(MouseEvent.MOUSE_DOWN,prepareToDraw);
 
        }
 
        public function prepareToDraw(event:MouseEvent):void
         {
          stage.addEventListener(MouseEvent.MOUSE_MOVE,drawGraphics);
          stage.addEventListener(MouseEvent.MOUSE_UP,stopDrawing);
 
         }
 
        public function drawGraphics(event:MouseEvent):void
        {
         fillType = GradientType.RADIAL;
         colors = [0xFFFFFF, Math.random()*0xFFFFFF];
         alphas = [1, 1];
         ratios = [0x37, 0xFF];
         matr= new Matrix();
         matr.createGradientBox(100, 100, Math.random()*360, -40, 0);
         spreadMethod = SpreadMethod.PAD;
         focalPointRatio = 1;
         holder = new Sprite();
         addChild(holder);
         myCircle = new Sprite();
         myCircle.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr,spreadMethod);
         myCircle.graphics.drawCircle(0,0,40);
         myCircle.graphics.endFill();
         holder.addChild(myCircle);
         holder.x = mouseX;
         holder.y = mouseY;
         holder.scaleX = holder.scaleY = Math.random()*2+0.5;
         holder.rotation = Math.random()*360;
         holder.alpha = Math.random()+0.7;
       }
 
        public function stopDrawing(event:MouseEvent):void
       {
        stage.removeEventListener(MouseEvent.MOUSE_MOVE,drawGraphics)
       }
    }
}

ColorMatrixFilter Fun in Actionscript 3.0

ColorMatrixFilter

Based on the great tutorial of Lee Brimelow, called Advanced Filter Effects I started messing around with the ColorMatrixFilter(); an Actionscript 3.0 Class that lets you apply a 4×5 matrix transformation in the RGB color and alpha values to the pixels of an image, and produce a new RGBA alpha value this can be applied to any display object.
So it’s quite addicting messing around with those values and get different results, this example is not at all finished it’s quite buggy still you can get some nice waving effects anyway check it out here:
ColorMatrixFilterExample and be sure to stop by www.gotoandlearn.com Lee has an unique way of explaining things very good and make difficult things look like is a piece of cake.

Papervision3D 2.0 Pixel Effects

Here’s a little try on the new Papervision3D Branch Effects based on the tutorial/example of Andy Zupko, the new pixel effects added to the branch look great, this was made using Flex 3 Beta 3.

3D Cube Pixel

Check it here.
Download Source here

Flex 3 and AIR Beta 3 Available on Labs

The new Flex 3 and AIR betas are available on labs this is the last public beta releases, the new betas resolve various bugs from beta 2, so if you haven’t already give it a try.

Here’s The info on Adobe Labs:

Flex 3 beta 3

This final beta release focuses on overall quality and performance, providing a final look at Flex Builder 3 prior to launch. Please use this opportunity to further explore the new features, communicate any final feedback, and test your existing Flex applications using the Flex 3 framework.

Adobe Air Beta 3

This download provides the beta 3 version of Adobe AIR. This runtime is required to run any Adobe AIR application. The Adobe AIR beta 3 was released on December 12, 2007 and contains a timeout that will cause it to stop working on November 1, 2008.

Visit Adobe Labs for more info
AIR on Labs
Flex on Labs

Papervision 3D 2.0 GreatWhite Alpha online

Papervision3D 2.0

Yes that’s right I said Papervision 3D 2.0 it’s an alpha codenamed GreatWhite and as Ralph Hauwert says in his blog it’s not fully optimized just yet but it’s alredy on de svn on Papervision3D googlecode project.

Here’s some of it’s new features:

Viewport3D – Auto sizing, clipping and culling, enables you to render to a texture in the scene.
ASCollada
ShadeMaterials – Only shaded surfaces
Shaders – Shading + Texturing
Frustrum Culling + Frustrum Camera
New Rendering architecture
Swappable renderer architecture

This is really exiting and I see the same and more success that it’s first release.
be sure to check the Google code project for download, Ralph Hauwert’s post on this and Papervision 3D blog for more info