Pilot Cat: Game Teaser on Android

Teaser for my next game, this time it’s on my Samsung Galaxy S

Pilot Cat Teaser on Android

Pilot Cat Teaser on Android

It runs pretty well, around 30/30 FPS 🙂

I didn’t install the Adobe AIR 3.2 Release Candidate on my phone since the released version will be out soon. So I made the APK file with Air captive runtime, which means the package includes the AIR runtime inside your app.

I use the latest Away3D 4.0 but I had problem during compilation. I got a strange error message with depthAndStencil. Luckily, someone had the same problem with me and post the solution on Away3D forum.

Stay tune!

Hiding List Item

Note: This article is about programming tip for Adobe Flex 😉

ItemRenderer is a great feature to render List or DataGroup items. All items wil be rendered and if you want to remove an item from list, then you have to delete it. But what if you don’t want to remove the item from the list but you don’t want it to be displayed?

I couldn’t find any direct way to do this. I tried to Google this but found nothing related so I decided to make some experiments. After several times failing, I found out that you can ‘hide’ an item on DataGroup/List from being rendered by using ItemRendererFunction and an empty Item Renderer (renderer with height=0).

Click more if you want to read the details on how I did it. As usual, you can see the demo and download the source code below 😉

Continue reading

Flash/Flex: Keep Calm and Carry On

source: Wikipedia

Keep calm and carry on. That was NOT my reaction when I read Adobe news about Flash Player for mobile. And then came another bad news about Flex SDK on the following day.

It was difficult for me. I was sad and a bit broken hearted. It’s even harder if you are surrounded by Flash-haters. It take times for me to recover. But this makes me realize that how much I (and probably other programmers) really love Flash platform.

I started playing with Flash since it was Flash 5. Then came Flash MX 2004 with ActionScript 2.0, and then AS3.0 which I like most. I’ve tried many things like JavaScript & even VBScript, not to mention other languages such as Pascal, C/C++, C#. After a quite long journey, I find Flash/Flex + AS3.0 fits me for making games.

Technology keeps on changing and getting better. Unfortunately, HTML5 isn’t ready and mature yet for game development. There are many things HTML5 has to catch up with. Don’t get me wrong, I think HTML5 has potential. In fact, I recommend you to start learning things like WebGL or trying Javascript-based frameworks.

But despite what people say, I think Flash will NOT die in the next 2-3 years. In fact, if you’re a game developer, this is the best time to use Flash. Finally Adobe starts focusing more in game development. There will be many exciting features ahead. Stage3D is still new and we haven’t seen the best things out of it yet. Molehill2, Starling/ND2D, concurrency, Flash Player 12, fantastics Flash-based 3D or game engines, and many more!

It’s also too early to say that this is the end of Flex. Spoon foundation haven’t start something big yet but I’d like to be optimist. By giving Flex framework governance to the open source foundation, Flex future and roadmap can be deciced independently from Adobe’s business or political agenda 😉 Isn’t that great?

So don’t panic, don’t rush. We stil have enough time, either to switch to HTML/JS/CSS, finish your Flash-based game engine, or do other stuff. No one knows what the future will be. Take your time for getting angry or sad, but after that, clear your head and keep your chin up. It might take 2 years (or even more) until HTML5 is good enough and able to catch up everything that Flash can do TODAY. Meanwhile, Flash is still here and keeps evolving.

So carry on, let’s code better Flash games or Flex RIA 😉

Setting Up Starling Framework with FlashDevelop

Are you using FlashDevelop and want to get start using Starling Framework? Here’s a quick tip how to setup your first Starling project!

Note: I’m using the latest FlashDevelop4 RC-1

  • Installed the Flex SDK. I install the latest Flex SDK 4.5.1
  • Make sure you have download player playerglobal.swc here and add it to your Flex SDK folder ({flex_sdk_folder}\frameworks\libs\player\11.0)
  • Download the Starling Framework. You can get it from github or download from Starling website
  • Create a new AS3 project.
  • On Project Property, change output Flash Platform to version 11.0
  • On project property, add -swf-version=13 into additional compiler options
  • Add Starling folder ({starling_folder}\starling\src\) as ClassPaths
  • Create a new Class (just named it Screen1 or any name…) and extends it from class Starling’s Sprite (starling.display.Sprite). So far leave it empty:
package
{
	import starling.display.Sprite;

	/**
	 * Dummy Starling Sprite
	 * @author Abiyasa
	 */
	public class Screen1 extends Sprite
	{

		public function Screen1()
		{
			super();
		}

	}

}
  • Modify your Main.as to add Starling object:
package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import starling.core.Starling;

	/**
	 * ...
	 * @author Abiyasa
	 */
	public class Main extends Sprite
	{
		private var _starling:Starling;

		public function Main():void
		{
			super();

			this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
		}

		private function init(e:Event = null):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);

			_starling = new Starling(Screen1, this.stage);
			_starling.start();
		}

	}

}
  • If you compile your project now, you’ll get 2 error messages:

C:\dev\starling\starling\src\starling\events\TouchMarker.as(22): col: 9: Error: unable to resolve ‘media/textures/touch_marker.png’ for transcoding
C:\dev\starling\starling\src\starling\events\TouchMarker.as(22): col: 9: Error: Unable to transcode media/textures/touch_marker.png.

  • The starling framework is trying to get media folder, which is available at {starling_folder}\starling\media\. Unfortunately, you cannot have linked folder on FlashDevelop, so what I did is to copy the folder media to {starling_folder}\starling\src\starling\events\. Note: please let me know if you know better solution 😉
  • Now compile your project! Everything should be OK and an empty blank screen will be displayed.
  • Empty screen is boring, so let’s add something to our screen. Modify our Screen1:
package
{
	import starling.display.Quad;
	import starling.display.Sprite;
	import starling.events.Event;
	import starling.text.TextField;
	import starling.utils.VAlign;
	import starling.utils.HAlign;

	/**
	 * ...
	 * @author Abiyasa
	 */
	public class Screen1 extends Sprite
	{
		protected var _box:Sprite;

		public function Screen1()
		{
			super();
			this.addEventListener(Event.ADDED_TO_STAGE, init);
		}

		protected function init(event:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, init);

			createBox();
		}

		protected function createBox():void
		{
			// create box sprite
			_box = new Sprite();

			// create quad (box shape)
			var q:Quad = new Quad(128, 128, 0x009ee1);
			_box.addChild(q);

			// add text
			var text:TextField = new TextField(100, 100, "Hello World", "Verdana", 16, 0xFFFFFF);
			text.vAlign = VAlign.TOP;
			text.hAlign = HAlign.LEFT;
			text.x = 10;
			text.y = 10;
			_box.addChild(text);

			this.addChild(_box);

			_box.x = 100;
			_box.y = 100;
		}
	}

}
Hello Starling

Hello Starling

Bonus: Starling with animation. source code included