Archive for April, 2008

Visibility and parent clips

Sunday, April 27th, 2008

“visible” works a little differently in as3. Seems that it disables button actions and turns the alpha to 0, but keeps the item as part of the display list. This means that my old tricks of turning things visible = false then getting the parent size do not work correctly anymore. At first this was frustrating until I realized that removing an object from the display list is much more clear and effective.

It’s a slightly different way of thinking:

package{
	
	import flash.display.*;
	
	public class SomeObject extends Sprite{
		
		public function SomeObject(){
			super();
		}
		
		/**
		 * Will add and remove the child object from the sprite if needed.
		 * @param	targetChild	The child to add or remove.
		 * @param	isVisible	Add or remove it.  Default is true.
		 */
		public function setChildVisibility(targetChild:DisplayObject, isVisible:Boolean = true):void{
			if(isVisible){
				if( !contains(targetChild) ){
					addChild(targetChild);
				}
			}else{
				if( contains(targetChild) ){
					removeChild(targetChild);
				}
			}
		}
	}
}

As usual a tad bit more code, but a lot clearer about what results we want. The hardest part is the transition in a production environment where all the old shortcuts just don’t work anymore.

scale9 with bitmaps

Saturday, April 26th, 2008

Looks like the flash 9 editor does not allow for the trick of using a bitmap pattern fill for scale9 slicing. Still seems strange to me that they would not encourage working with bitmaps for scale9. I’m happy I did a search, because I was about to write my own class before I came across this post. It does exactly what I wanted it to do: apply scale9 properties to a bitmap. This is something that is really nice about as3, lots more people are building compartmentalized little tools that can just be grabbed and plugged into your project.

TRON paper light cycles

Saturday, April 19th, 2008

This thing is incredible:

It really really makes me jealous about how much time whomever did it has. From what I remember this thing is pretty much shot for shot.

Twisted Metal

Friday, April 11th, 2008
Grab the flash player

We got the Twisted Metal mini game up and running. Hopefully some folks get a kick out of it. The main url for it is: http://pwnedbysweettooth.com

If you want to show it in your blog you can by using a simple embed tag: