Archive for the 'MXNA' Category

AS4 Wish: Shorthand Eventing with Flows

One thing I love and hate about ActionScript 3 is the eventing model. I love the departure from AS2 type callbacks. And I love the way it allows me to have loosely coupled classes. Anyway, to rephrase and refrain from stating the obvious, I think eventing is awesome.

But after the AS3 honeymoon … … I resent the number of times a day I find myself typing out object.addEventListener(…,…) and then object.removeEventListener(…,…). I resent it even more when I know that the event shall only happen once, normally for some kind of COMPLETE event; thus making the first line of my handler always be IEventDispatcher(e.target).removeEventListener(e.type,…). It’s just too verbose, especially when it’s such a core feature of ActionScript.

Now, I’m not trying to crawl onto the recent AS3 is harder and takes longer bandwagon here. I’m ecstatic that AS2 is not longer a daily thing for me; I wouldn’t even go back to it for a pay-rise. But, I feel something could be added to AS3 to make eventing less verbose and less prone to things such as memory leaks.

What makes eventing so verbose? Well, for every event we want to subscribe to, we do:

1) Add Listener
object.addEventListener(”eventtype”, eventHandler);

2) Create a function to handle that event
private function eventHandler(e:Event):void {
trace(”hello world”)
}

3) Remove Listener
object.removeEventListener(”eventtype”, eventHandler);

The creation of a handler function per event group is something that especially rubs me the wrong way, but when working in an asynchronous language, what else can you do? I propose a new concept called a “Flow”. A Flow mimics the blocking nature of synchronous languages while keeping inline with the asynchronous environment of ActionScript.

To outline my proposal, I’m only going to give a commented example, but I hope from it you’ll be able to take away the key concepts. And I stress concepts! As this probably won’t be the best syntactic solution.

class FlickrPhotoGizmo extends EventDispatcher {

	// Note that this is a "flow" and not a function.
	// Flows seem to be able to "block" until a matching event type is dispatched
	// Flows work with existing AS3 code .. ie. imageLoader.addEventListener(Event.COMPLETE, ...)

	// A flow will always dispatch a "FlowEvent" of constant type on return.
	// Flows are a one time deal; no need to keep listeners around once completed.
	// Null returns shall be detailed in the "FlowEvent" for later inspection.
	// The "->" notation is our "syntax sugar" 

	public flow loadAndFilterImage(searchTerm:String):BitmapData {

		var imageLoader:FlickrLoader = new FlickrLoader();
		var imageFilter:ImageFilter = new ImageFilter()
		var resultBitmap:BitmapData;

		imageLoader.getMostPopular(searchTerm) -> {
			Event.COMPLETE  -> resultBitmap = imageLoader.bitmapData;
			Event.NO_MATCH  -> return null;
		}

		imageFilter.filter(resultBitmap) -> {
			Event.COMPLETE -> {
				resultBitmap = imageFilter.filteredBitmapData;
				imageFilter.fooClean()
			}
			Event.ERROR -> return null;
		}

		imageFilter.filter2(resultBitmap)
			-> Event.COMPLETE
				-> resultBitmap = imageFilter.filteredBitmapData;

		return resultBitmap;
	}

}

// wrapper app

funtion init():void {

	var gizmo:FlickrPhotoGizmo = new FlickrPhotoGizmo();

	// let's load an image with happy people, then filter it...
	// ... then give the result to the "imageReady" function
	// remember: this is a one time "FlowEvent" event that results from a "flow"

	gizmo.loadAndFilterImage("happy people") -> imageReady;

	addPermEventHandlers();

}

function imageReady(e:FlowEvent):void {

	// no need to call removeEventListener as this is a one time event

	var image:BitmapData = e.yield;

	if (image) {
		addChild(new Bitmap(image))
	} else {
		var errorEvent:Event =  e.nullEvent
		switch (errorEvent.type) {
			case Event.NO_MATCH: trace("no happy people found :(")
		}
	}

	removePermEventHandlers();

}

// maybe we want this new syntax for permanent listeners too .. note: "o"
// (i know "o" might be a bad pick .. but just go with it)

function addPermEventHandlers {
	o-> MouseEvent.UP -> mouseUpHandler
	stage o-> KeyboardEvent.UP -> keyPressHandler
}

// and because we have permeant listeners, we need to be able to remove them .. note: "<"

function removePermEventHandlers {
	o<- MouseEvent.UP -> mouseUpHandler
	stage o<- KeyboardEvent.UP -> keyPressHandler
}

function mouseUpHandler(e:MouseEvent):void {
	trace("we're still loading that image for you, just wait .. blame Flickr")
	if (false && "anotherExample") {
		// this is short hand for .. this o<- MouseEvent.UP -> mouseUpHandler
		// we're able to do it because we're aware of the context
		o<-e
	}
}

function keyPressHandler(e:KeyboardEvent):void {

}

Pixlr: An online PhotoShop

I just came across an excellent express alternative to PhotoShop that runs in the Flash Player, Pixlr!

I’m surprised to see how many of Photoshops features they have been able to implement in this fast loading clone. Great things such as filters and adjustments, magic wand selection, layers with blend modes, smudge, clone, pinch and bloat tools. The app even has a fullscreen mode :).

With the release of Flash 10 and Pixel Bender, I’m sure this app has a very bright future. Just please lose the Vista theme!

Check it out: pixlr.com/app

Thermo Fireworks

Recently, I’ve started thinking a little more about “Thermo”, especially with MAX approaching. As much as I love the concept of “Thermo”, I can’t help but be disappointed by its sole union with the Flex Framework. Now, I’ve never really been a hater of the framework, I just dislike the idea of having to conform to it.

As RIA platform’s become increasingly generic, I’m wondering why can’t “Thermo” be a tool that target’s many of them from a single project file. For example, say you have a JavaScript version of the “Flex Framework” that maybe unitizes SVG and HTML5 features, would you like to be able to take your vanilla “Thermo” project and target that platform? I’d like to think so.

Adobe Fireworks seems to have many features that “Thermo” would benefit from and vice-versa. Fireworks is already a “Thermo” for HTML as far as I can tell with it’s CSS/HTML output, all that’s missing is a rich JS framework.

I would love to see a union between Fireworks and “Thermo” where people can design a RIA, then simply pick a target framework/platform of their wishing. For me, this seems like a no brainer. I would even like to see a plug-in feature for “Thermo/Fireworks” so that people could export to a proprietary platform/framework if they so choose.

Congrats on shipping FP10 ‘dobe

Flash Player 10 has now been officially released, well done Adobe!

*cracks open the champagne*

Check out this cool intro video link.

Flash 9 Player on PLAYSTATION3

So it now sounds like the cat is out of the bag. link

Yes, Flash 9 shall be shipping with PS3 Firmware 2.50.

Extra Notes:

  • No JIT support :(
  • Video playback is accelerated
  • Filters cause big slowdowns
  • Network access also dramatically effects performance
  • Guimark Result: Average fps is 4.5fps

    http://www.craftymind.com/factory/guimark/GUIMark_Flex3.html
  • BubbleMark Result: 20fps as default setting(16 balls)

    http://bubblemark.com/flex.htm

My Adobe MAX 2008 Schedule

I’ve just gotten around to deciding my session schedule for this years Adobe MAX conference. If I’m missing any must-see sessions from this list, please inform me! :)

My Adobe MAX 2008 Schedule

Flash on the Cloud: Lightning

With clients becoming thinner by the day and the desire to cut costs of CE devices, I’m wondering if OTOY type technology really is the future of experience viewing. For the uninitiated, OTOY enables extremely thin clients to explore rich 3D worlds via server side rendering. Below is a YouTube video of an OTOY demonstration. You could almost imagine the death of video game consoles via this type of technology in the years to come.

With this amazing proof of concept in the bag, I’m wondering if the same thing could be done to the Flash Platform.

Now, I’m not talking about the Flash Player simply just steaming OTOY content, I’m talking about actual SWF’s being rendered server-side and the result being streamed to a super thin Flash Player on the client end. Obviously this opens a huge amount of questions about cost, infrastructure, delivery, etc. But with the arrival of OTOY I know this can be done.

A “Lightning” system would allow for instant application upgrades, not just on the application level, but on the runtime level also. Custom installs of the system could allow operators to build in custom Player API’s to take advantage of hardware/needs on the cloud without worrying about the clients runtime compatibility. You would pick up some other free features such as simple P2P setup, etc.

With the Flash Player becoming heavier and more feature rich by the day. And the ever increasing demand for killer thin client solutions, it seems that a “Lightning” strike could be inevitable.

OTOY Demonstration:

Current TV Flash Contest ($2500)

We [San Flashcisco] wanted to let all of you know who missed the last meet and to remind those of you that were there that the deadline for Current TV’s contest is Monday September 1st. Here are the details if you missed our meeting

VCAM (Viewer Created Ad Message) is a program where viewers can earn money making TV commercials (and for the first time, Flash ads!) for Current sponsors.

For the Flash component of our L’Oreal VCAM, we are looking for people to submit either 300×250 online display ads and/or a 300×50 Flash Video Overlay Ad to encourage viewers to use L’Oreal’s service “Can I Help You?”.

(L’Oreal has a team of experts who have poured their knowledge into a database called “Can I Help You?” which allows you to input information about yourself (i.e. Dry skin, brown hair, blue eyes) and “Can I Help You?” will recommend which products will work best for you.)

Each ad L’Oreal selects will run on Current.com and earn its creator $2500.

You can find all the assignment details, Flash assets and terms at http://current.com/canihelpyou

FlashForward Retrospective

This was the first year that I have been able to attend Flash Forward and so, I didn’t have any preconceptions of this event going into it. But after coming out the other end, I’m a little worried.

Being the manager of a Flash user group, you start to build a picture of what Flashers really want by there emotional responses. And thus, for around seventy-five percent of the conference I felt this vibe from everyone that could be simply compressed down into … “WTF?”.

Now for moments I thought it was just me, after all it’s my first FF experience, right. Then at the film festival after party I spoke to numerous people about how they felt so far about this years event. The main two themes that resulted from my conversations were .. “I came to see code, where’s the code?” .. and .. “I don’t think i’ll come next year”.

Now if I’m honest, I enjoyed the the abstract inspiration side of the conference that seemed to take up most of the schedule. Being someone who can recite the Player API in his sleep, I was glad to gain new perspective from others and not just the same old tutorials. But I felt like I was in the minority.

It seemed to me that the majority of people in attendance were from the creative world (brands/ads/experiance) which seems correct. And by the line-up in the schedule it did seem like those people were the target demographic but I think the new FlashForward team misinterpreted this demographics needs.

It seemed like the line-up was a mirror image of the people in attendance. But to put it another way, the content seemed redundant to the audience. People wanted to be schooled and tested, not just wrapped up in fluffy feathers. These people paid just over one thousand dollars (and maybe a plane ticket) just to get in the door and it seems to me that most people felt that they just didn’t get value for money.

As for Beau Ambur’s hosting skills of the event, I’m indifferent. It might of been nicer to have seen more rotation of the hosting position as the blocks of presentations occurred, though he did improve as the week went on. He started the first day with “i” in almost every sentence while doing couch Q&A and he did answer a lot of his own questions resulting in the guest only being able to respond by saying “yes”. But by the end of the third day, he seemed far more relaxed.

The single track setup of the conference was kind of cool. It indeed gave everyone the same talking points at the end of the day. But with Flash being so multifaceted, I think it failed in reality because of different Flash demographics needed different things. This is something I see extremely often when running a user group. You never have a full member attendees because people pick and choose what they need.

The venue was in a fantastic location for out of towers; trolleys whizzing by, top of a hill, fog dissolving above our heads. The wether was good. The lunch boxes were alright. The seats at the venue we’re awfully cramped for tall people. The gallery was a little spares and didn’t feature anything interactive. Lots of fantastic people in attendance. Matt Maxwell …. LMAO!!

Thank you to everyone who made this conference happen and hopefully all the bugs will be worked out by next year.

I’ll end with a small bit of advice. If you get the chance to speak to one of your Flash heros for the first time .. don’t be hammered drunk. *sigh*

64 bit Linux / FreeBSD Flash Player exists

I just watched Tinic from the Flash Player team demo two 64bit versions of Flash Player 10 here at FlashForward. One on Unbunu Linux and the other running on FreeBSD. Tinic also showed a 32bit version of the FreeBSD player. At this point however, there if no solid plan for release.

Posted from my iPod

Next Page »