Actionscript 3 Refernce

Posted by | Posted in AIR, Actionscript 3.0, Flash, Flex | Posted on 21-04-2010

I just ran across this on Senocular's blog.  It's a comprehensive Actionscript 3.0 reference, I'm surprised I never ran across this before, the beauty of it is that it allows to browse by platform and provides other filtering options as well.  If you are a FP (Flash Platform) developer, check it out --> AS3 Ref.  Also, check this out too, for your documentation needs --> DOC?

QATool + Banner workflow

Posted by | Posted in Flash, Random, Resources, Technology | Posted on 24-02-2010

I have recently had some banner work for a client and had to present multiple banners.  I coincidentally came across this. Here is an example of the tool in action. Pretty close to the perfect solution for banner presentation for your clients.  Installation is super easy. For mac all you do is run these commands in terminal

  1. sudo gem update --system
  2. gem sources --add http://gems.codeendeavor.com
  3. sudo gem install builder
  4. gem install roo
  5. gem install spreadsheet
  6. gem install nokogiri
  7. gem install rubyzip
  8. gem install google-spreadsheet-ruby
  9. gem install qatool

If you have any problems just use sudo in front of the command.  After you create your banners you can use this little tool, which will open a terminal window that corresponds to where you are in finder.  After that just type qatool and you're done! Super easy.

iPhone Applications from Flash!

Posted by | Posted in Flash, iPhone | Posted on 05-10-2009

I came across some tweets today that brought me back to THIS which explains how CS5 will allow Flash Developers to publish applications to the iPhone.  Read the rest of this entry »

FLAR + Papervision3D example

Posted by | Posted in Flash | Posted on 21-06-2009

This is a demo of the FLAR toolkit and Papervision3D. It's a quick equalizer to the tune of Kid Koala.

To view the demo print this

The piece of paper contains a symbol which will be used for on-screen detection.  Hold the symbol in front of your webcam to view the demo.  If you remove the symbol from the screen the demo will stop. When you place the symbol back in view of the webcam the demo will start again.
*note: wait a minute to let the movie load some of the assets required. Also, if nothing is showing up right click over the flash movie and pick 'settings'. There you will find webcam settings. Try a couple of those to make sure you selected the right webcam.
Enjoy!

CLICK HERE

De MonsterDebugger

Posted by | Posted in AIR, Actionscript 3.0, Flash, Flex | Posted on 09-04-2009

I just came across this and I love it.  When it comes to coding I'm a sucker for "survivalist" code practices.  That is, self contained projects.  This debugger works like many others but has the option to export the needed class from the menu.  This is great as all you need is the application and all of the classes and examples are self-contained.  The thing I love most about this debugger is it's simplcity.  Basically here is what you need in your code:

import nl.demonsters.debugger.MonsterDebugger;
private var debugger:MonsterDebugger;
debugger = new MonsterDebugger(this);
MonsterDebugger.trace(this, "Hello World!");

Instead of "Hello World!" you can put objects or anything else as the second argument and have it trace out.  Pretty sweet.

CHECK IT OUT

Motion Blurs for Tweening engines

Posted by | Posted in Actionscript 3.0, Flash, Flex, Resources | Posted on 17-03-2009

I've been using TweenMax for a while but I always want to add motion blurs to everything.  I've seen a few approaches where you would detect if the movie is moving and just apply a generic blur, but I didn't like those.  Here is a little utility class that comes in handy.  It will apply horizontal and vertical blurs perfectly but since there are no real directional blurs in Flash, I've cancelled the diagonal blurring since it will only blur out the ball completely.  To add that just surround the statements on lines 23-24 with a Math.abs. This class makes it really easy to add motion blurs to tween with code that looks like

TweenMax.to(mc, 0.4, {x: 1000, onUpdate: BlurHelper.blur, onUpdateParams: [mc]});

With the BlurHelper class below

package
{
	import flash.filters.BlurFilter;
 
	public class BlurHelper {
 
		private static var _items:Array = new Array();
		private static var modx:Number = 0.5;
		private static var mody:Number = 0.5;
 
		public static function blur(aItem:*):void
		{
 
			var bl:BlurFilter = new BlurFilter();
 
			if(_items[aItem.name] == null)
			{
				_items[aItem.name] = new Object();
				_items[aItem.name].ox 	= 0;
				_items[aItem.name].oy 	= 0;
			}
 
			bl.blurX = (aItem.x - _items[aItem.name].ox)/modx;
			bl.blurY = (aItem.y - _items[aItem.name].oy)/mody;
 
			_items[aItem.name].ox = aItem.x;
			_items[aItem.name].oy = aItem.y;
 
			aItem.filters = [bl];
 
		}
 
		public static function killBlur(aItem:*):void
		{
			aItem.filters = new Array();
		}
	}
}

Flex/Flash Where Did I Go Wrong? What’s the Difference?

Posted by | Posted in Actionscript 3.0, Flash, Flex | Posted on 29-01-2009

One of the biggest points of confusion for me (not really confusion, just curiosity really) regarding the difference between Flex and Flash is why can't I intermix the two more easily.  Well, one of the main things is that in Flex I have to use UIComponent whereas in Flash I can use whatever.   I researched a bit and came across this article, which basically explains that the Flex class hierarchy looks like this: Object -> EventDispatcher -> DisplayObject -> InteractiveObject -> DisplayObjectContainer ->FlexSprite -> UIComponent

All other components extend UIComponent.  I looked up the source for FlexSprite and it looks like this:

////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
//  All Rights Reserved. The following is Source Code and is subject to all
//  restrictions on such code as contained in the End User License Agreement
//  accompanying this product.
//
////////////////////////////////////////////////////////////////////////////////

package mx.core
{

import flash.display.Sprite;
import mx.utils.NameUtil;

/**
*  FlexSprite is a subclass of the Player's Sprite class
*  and the superclass of UIComponent.
*  It overrides the <code>toString()</code> method
*  to return a string indicating the location of the object
*  within the hierarchy of DisplayObjects in the application.
*/
public class FlexSprite extends Sprite
{
include "../core/Version.as";

//--------------------------------------------------------------------------
//
//  Constructor
//
//--------------------------------------------------------------------------

/**
*  Constructor.
*
*  <p>Sets the <code>name</code> property to a string
*  returned by the <code>createUniqueName()</code>
*  method of the mx.utils.NameUtils class.</p>
*
*  <p>This string is the name of the object's class concatenated
*  with an integer that is unique within the application,
*  such as <code>"Button17"</code>.</p>
*
*  @see flash.display.DisplayObject#name
*  @see mx.utils.NameUtil#createUniqueName()
*/
public function FlexSprite()
{
super();

try
{
name = NameUtil.createUniqueName(this);
}
catch(e:Error)
{
// The name assignment above can cause the RTE
//   Error #2078: The name property of a Timeline-placed
//   object cannot be modified.
// if this class has been associated with an asset
// that was created in the Flash authoring tool.
// The only known case where this is a problem is when
// an asset has another asset PlaceObject'd onto it and
// both are embedded separately into a Flex application.
// In this case, we ignore the error and toString() will
// use the name assigned in the Flash authoring tool.
}
}

//--------------------------------------------------------------------------
//
//  Overridden methods
//
//--------------------------------------------------------------------------

/**
*  Returns a string indicating the location of this object
*  within the hierarchy of DisplayObjects in the Application.
*  This string, such as <code>"MyApp0.HBox5.Button17"</code>,
*  is built by the <code>displayObjectToString()</code> method
*  of the mx.utils.NameUtils class from the <code>name</code>
*  property of the object and its ancestors.
*
*  @return A String indicating the location of this object
*  within the DisplayObject hierarchy.
*
*  @see flash.display.DisplayObject#name
*  @see mx.utils.NameUtil#displayObjectToString()
*/
override public function toString():String
{
return NameUtil.displayObjectToString(this);
}
}

}

Basically there's nothing there.  This looks like "just in case" abstraction code, but now UIComponent is much more complicated and is really the departure point for Flex Components.  More to come...

Flash Player 10 Passes 55% 2 Months after being released

Posted by | Posted in Flash | Posted on 29-01-2009

CHECK IT OUT ... Pretty impressive no?  On a tangential note... what's up with iPhone NOT supporting Flash?  What's up big bad iPhone are you afraid Flash will take over?

Strange bug with flash

Posted by | Posted in Actionscript 3.0, Flash | Posted on 18-07-2008

If you enjoy things like locking up and crashing flash, here is a quick recipe.  Grab TweenMax from greensock (a great tweening engine btw) and do something like this TweenMax.to(mc, 0.3, {x: 100, easing: None.easeOut(});  it's really about leaving the parentheses for the ease function open and for some reason this looks like it executes thousands of compiler errors before locking up.

Creating custom events

Posted by | Posted in Actionscript 3.0, Flash, Flex | Posted on 30-03-2008

I've come across the need to create custom events a few times. One nice thing you can do, which will greatly simplify your development efforts is create a basic, custom event that contains a data object, where you can store whatever data you might want to pass around in your event. The basic way to extend flash events involves

1. extending flash.events.Event

2. overriding the clone method

Optional but highly recommended is creating static constants for your event, along the lines of:
public static const MOUSE_DOWN:String = "mouseDown;

So, with the custom data field your class might look something like this:

 
package
{
     import flash.events.Event;
 
     public class MyEvent extends Event
     {
          public var data:Object;
 
          function MyEvent(type:String, bubbles:Boolean = false,
                         cancelable:Boolean = false)
          {
               super(type, bubbles, cancelable);
               data = new Object();
          }
 
          override public function clone():Event {
               var re:MyEvent= new MyEvent(type, bubbles, cancelable);
          }
     }
}
 

You can also add meta tags and override the toString function, but I found that these are unnecessary and maybe even a bit too much, but in case you're curious or want to implement these, you would do this

 
[Event(name="mouseDown", type="MyEvent"]
 

The benefit of this is that you can bind with this in Flex, but I like much better to write classes that I can use in both flash and flex, so this doesn't really help me much, but there it is.