Flash Cafe

Flash Builder – Custom Event code hinting.

July 28th, 2010 nebutch

Here’s a little trick to bring up expected events in code hinting in the Flash/Flex Builder IDE:

Let’s say you have a custom event:

package com.application.view.events
{
	import flash.events.Event;
 
	public class CustomEvent extends Event
	{
		public static const SOME_EVENT:String = "someEvent";
 
		public function CustomEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
		}
	}
}

When you create a class that dispatches this event, add an Event metatag before the class definition. You also must have an ASDoc comment formatted correctly using @eventType [fully qualified class path/name]

Example:

package com.defjam.application.view
{
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
 
 
	public class CustomClass extends EventDispatcher
	{
		/**
		 * @eventType com.defjam.application.view.events.CustomDataGridEvent.ROW_SELECTED 
		 */		
		[Event(name="someEvent", type="com.application.view.events.CustomEvent")]
		public function CustomClass(target:IEventDispatcher=null)
		{
			super(target);
		}
	}
}

Now, when you write an event listener for your class in the Flex Builder IDE, you’ll get autocomplete options that include your event/event types that your dispatcher class has defined.

-

Flash 10.1 Updates

March 31st, 2010 nebutch

I’ve compiled a list of all the new classes in the Flash 10.1 API. Some look to be very useful, while others seem to be internal classes that aren’t going to be any use for developers.

Read the rest of this entry »

Pictures as Music

February 22nd, 2010 nebutch

http://music.almerblank.com

R Blank has just revealed Synthia, a real-time image to music creator created in Flash. You can upload an image, then listen to it!

http://music.almerblank.com/

Hype/Papervision3D Demo

November 5th, 2009 nebutch

So after getting my hands on the new Hype framework, I wanted to put together a simple demo together that utilizes a combination of the SoundAnalyzer class and some 3D eye candy (via Papervision3D).

First off, I can say that I really like being able to play around with the sound spectrum using only a couple lines of code. I also used the Rythm class to run an enter frame method, which is very convenient in that I didn’t need to manually set up an event and listener.

Lastly, I wanted to also utilize a tweening engine to smooth out the particle movement, but doing so cut the framerate by about 80% (a little better with TweenMax/TweenLite, but still not good enough). I also briefly played around with the Flint particle emitter, but I’m not familiar enough with Papervision/Flint to get it working how I wanted.

UPDATE – I decided to give a tween engine one more shot, and was able to use TweenMax while keeping the framerate at an acceptable level.

UPDATE 11/06/2009 – Updated code sample to reflect demo swf.

UPDATE 3/29/2010 – It’s come to my attention that WordPress tends to be a bit moody when it comes to code formatting in posts, especially in the case of vectors (which use the greater than/less than characters). That said, I’ve posted a couple pastebin examples:

Document class
ApplicationView class

Read the rest of this entry »

Hyped about Hype

October 30th, 2009 nebutch

I just came across one of the coolest AS3 toolkits I’ve seen in a long time – Hype. Basically, the point of Hype is to make UI design as easy and fast as possible. It includes commonly used algorithms used in visual and audio design such as grids, shapes, random placement, chaos patterns, and audio spectrum calculations. It’s also capable of calculations such as custom timing (run a callback every 2nd frame, etc) with minimal coding requirements, and a callback system that is much more efficient than AS3′s native Event system.

Another great feature is the use of Object pooling and unordered lists. The concept of this is to minimize Object creation (thereby keeping memory requirements as small as possible) by recycling Objects rather than recreating them on the fly. This is obviously a standard best practice when designing code projects, but Hype will do the dirty work for you and let you focus on the fun stuff.

From the looks of the intro video, the toolkit looks to be well-written using a combination of a core framework and an extension package (which is highly flexible and easily built upon). It looks like a minimal set is included for now, but I’m sure additional extension kits will be added along the way (plus allow developers to add/share there own).

The framework is slated for release on Saturday, October 31st.

Check out the video HERE, and the examples HERE.

Happy coding ;)

Snow Leopard doesn’t like Flex Builder…

October 13th, 2009 nebutch

..or vice-versa.

After starting my new gig with Almer/Blank today, I changed my workflow a bit to incorporate my Macbook along with an external 21″ display. The primary development environment in our projects is Flex Builder.

nom nom nom

Well, the first thing I noticed when going in to edit a file was that the line numbers weren’t tracking correctly with the page scrolling. I figured that this was a fluke, so I tried restarting Flex Builder. Nothing. Tried again. No go. With some tight deadlines, I kind of put that aside and pushed through without using line numbers (which really sucks, if you get used to relying on them like me). After things slowed down a little, I came across this bug ticket: Read the rest of this entry »

Are you a dick?

April 10th, 2009 nebutch

I came across the following image on Fark.com, and something about it tickled my geek bone.

PI

From FlashDevelop to xCode : Duplicate Line

April 6th, 2009 nebutch

So over the past month or so, I’ve decided to delve into the wonderful world of Objective-C and Cocoa. I’ve been using xCode as my primary IDE, and so far I love it. However, one nagging issue about xCode is that there is no “Duplicate Line” or “Delete Line” hotkey as there is in FlashDevelop, which I’ve been using for years for most of my AS development. While I *could* try to get used to the old “Option” + drag method or copy/paste, I found myself spoiled by the quick hotkey action that FD offers (which by default is Ctrl+D for duplicating and Ctrl+Shift+D for deleting. There’s also a handy “transpose” hotkey, which I won’t go into).

So doing some research, I came across a couple of options. One option requires that you create a User Script in xCode and assign whatever hotkey to that. You can find more information HERE. I decided not to use that solution because there was no “Delete line” code source, and I frankly wasn’t in the mood to learn Ruby in order to customize my own script (yet).

The second option is to create a Dictionary file and customize your script very easily using the Mac OSX Key Binding documentation as a reference. Here’s what you do:

- Create a new .dict file in the following directory : home/Library/KeyBindings/PBKeyBinding.dict
Note : If the KeyBindings directory does not exist, you’ll need to create it.

- Add the following code:

{
"^$K" = (
"selectLine:",
"cut:"
);
 
"^$D" = (
"selectLine:",
"copy:",
"moveToEndOfLine:",
"insertNewline:",
"paste:",
"deleteBackward:"
);
}

- Save the file, restart xCode if it was already open.

So with the above code, placing the cursor within any line then hitting the key combo ‘Control + Shift + K’ will delete that entire line, and hitting ‘Control + Shift + D’ will duplicate it.

Thanks to TypeOneError for posting the initial info on this. One thing that I did change from the original code is that I added a “deleteBackward” command at the end of the Duplicate Line section. This will place the cursor back at the end of the line just created, rather than at the beginning of a new line (which is more like what FD’s behavior is). The obvious beauty of this is that you can recursively hit the hotkey combo and duplicate lines without having to place your cursor back up into the previous one. You can further customize or add other bindings by referencing the Mac OSX Key Bindings documentation.

I may delve into this a bit more and see about a ‘Transpose’ hotkey, which switches placement of the last two selected lines of code, but I’m in no hurry.

Merry Christmas!

December 24th, 2008 nebutch

To celebrate both the holiday and my new gig with Animax Entertainment, here’s a little Christmas diddy. Canadian style, eh. :)


Mr. President

November 5th, 2008 nebutch

Congratulations, Barack Obama!

small_obama_image.jpg

I’m definitely proud as an American that we as a Nation came together and voted for change. Now that we chose, let’s all make sure that we stand behind our new President and do our parts to steer the USA into better waters – Democrats and Republicans alike.

  • View Nolan Butcher's profile on LinkedIn
  • Meta