04
Jun
09

Tilt Shift Air App

I’ve just spent the last 15 minutes mucking around with a cool AIR app called TiltShift. It basically lets you create images using a technique called Tilt Shift Photography. The app does a rather nifty job I must say, here’s what I knocked up in around 15 minutes from the back catalogue of images on my computer.

I reckon image 4 is the best one, though I’ll continue to plough through the image banks at this end looking for suitable candidates to miniaturise. Anything where the subject matter is below the camera seems to work well. Obviously the Tower of London doesn’t fit into this category, so I’ll have to take a happy snap from the Eye and have another crack at that ;-)

For those wanting to do it the old school way, check out this Photoshop tutorial that shows how.

01
Jun
09

Flash Catalyst or Catastrophe?

I’ve been watching the large number of blog links regarding the news from Adobe labs that Flash Catalyst is now in public Beta; naturally I had to download and have a go myself.

My first impressions are not good.

It seems like they’ve decided to invent their own usability best practices for the tool shortcuts. Where the hell is the pan tool? Why doesn’t holding the space bar and then using the mouse to scroll perform a pan? Keyboard shortcuts for delete don’t seem to work in the layers panel. Where is the align panel? Do I really have to right click an asset and select an align option from a dropdown? It’s a real mouseathon in the program at the moment. These aren’t really things I see as Beta related, they should just be in the app - which they are in any other CS4 product, so I’m mystified how these issues got through QA to this stage.

Probably the biggest issue is the speed (or lack thereof) of the program. Trying to edit a button’s state is painfully slow. I’m not sure whether this is to do with my system (dual core 2.4Ghz with 4Gb RAM on Vista) but I’d like to know if I’m the only one who thinks the program runs painfully slowly.

Aside from the usability and productivity issues I’m still at a loss as to why the CS4 core wasn’t used for this (or was it?) and even why we need a further dilution of the Flash product base. Surely Flash CS could be re badged as Flash Designer and the Catalyst toolset integrated (I realise I made that sound easier than it would be, but as it stands the introduction of this third tool looks like more of a money grab than anything else). This would go nicely alongside the newly re badged Flash Builder (which incidentally looks very good, so kudos to the Flex team).

I haven’t upgraded to CS4 as yet, and it’s for some of the reasons above that I haven’t. I just don’t know where the Flash products are headed, and quite frankly if this is where they’re going I may jump ship completely onto HMS Flex and let the “designers” out there handle getting the assets I’m after into a state in which I can use them. Though the right side of my brain may have something to say about that statement…

25
Mar
09

2009: the year of the alternative energy oxymoron

Ok, so it’s actually the international year of astronomy - but I’d like to decree in a fairly dictatorial manner that it should be the year of alternative energy (and that’s not to say that I’ve got anything against astronomy ;-)

In fact, I put it to you that not only should this year be the year of alternative energy, but the year after that, and for the next decade to come. Let me come to my point, which is we don’t have an alternative place in the universe to live, so why are we still referring to alternative energies in all their forms as such?

Alternative energy is an oxymoron; there is no alternative. Unless you enjoy 55 degree days, raging weather and a very wet day at the beach (which is now about 3 km’s further inland than where it used to be).

Perhaps a massive rebranding of the term is required. It seems that people are happy to continue to use the current form of “main stream” energy (or whatever you’d like to term energy that isn’t “alternative”) as it’s too hard to change their ways. Again, I put it to you - what is the alternative to living on this planet?

This post doesn’t offer any solutions. But I do hope it will help raise the awareness of those reading it that things really do need to change, and fast.

13
Feb
09

Breaking news: Good triumphs over evil

Well on this website it does anyway

;-)

Had to take a bit of a break from the project I’m currently working on… think I’m being driven slowly insane by Flex.

15
Jan
09

as3 casting issue

Either I’m going slightly mad or casting using the “as” keyword works differently to the old way of casting.

Here’s some code to illustrate:

showFormItem = (((e.target as CheckBox).selected as String) == _local.displayTriggerValue[i]) ? true : false
Now this gives a different result to:
showFormItem = (String((e.target as CheckBox).selected) == _local.displayTriggerValue[i]) ? true : false

WTF?!

I’m pretty sure I’ve got my brackets in the correct spot.

Yhelp!

09
Jan
09

Passing parameters to a Flex eventListener - use a Dictionary!

Firstly, Happy New Year! Hope your ‘09 is off to a flyer!

Secondly, sorry about the rather mundane heading - couldn’t really think of what to call this post. I’ve been typing all sorts of things into Google trying to find a solution to what I’ll describe below.

I’m continuing the project I started in early December and having some very interesting battles with AS3 and the Flex framework. I’d like to document one of those battles today.

What I wanted to do was send parameters along with an event so that the event listener had access to them. Now I’m fully aware of how to do that when I’m in charge of dispatching the event, but was (and still am) at a loss as to how to add them in the following instance:

myComboBox.addEventListener(Event.CHANGE, eventListener);

This call to addEventListener occurs where the variables I want to pass get defined.

Here’s the code that I attempted to use (without luck) to get the parameters passed along with the event:

myComboBox.addEventListener(PodEvent.CHANGE, eventListener);
var myEvent:PodEvent = new PodEvent(PodEvent.CHANGE);
myEvent.displayTriggerValue = displayTriggerValue;
myEvent.formItem = triggerDisplay;
myComboBox.dispatchEvent(myEvent);

I could get the displayTriggerListener to run when the combobox changed, but the variables that I added to myEvent wouldn’t make it in there (further to that I was having type coercion difficulties, but that’s another story I think). The initial dispatchEvent was also allowing the eventListener to get the parameters, but obviously the idea is to have them passed along with every PodEvent.CHANGE event.

Now initially I got around this using closures (a new term to me). I understand the issues of using anonymous functions (ie. garbage collection issues) so searched some more for answers. I found nada.

So after a nights rest and a few more hours wrestling with it today, I’ve come up with the following solution that I’m rather chuffed about. I use a Dictionary to store a reference to the component and in turn create an object associated with that Dictionary element to store the parameters I want to pass into the eventListener function. Perhaps some code will illustrate what the hell I just typed (for me and you both ;-)

myParamDictionary[myComboBox] = {param1: value1, param2: value2};

The myParamDictionary is a private var in the class so is accessible within the eventListener

private function eventListener(e:Event):void {
	var _local:* = myParamDictionary[e.target]
	// rest of the implementation here. You can access the previously set parameters by _local.param1, _local.param2...
}

And to my utter delight (and surprise) it works!

The only downside is there’s no type checking on the parameters, which is what I originally wanted to use a custom event for.

If you’ve got a suggestion for my initial problem or a critique for my end solution please don’t be shy and post them!

15
Dec
08

Flex and my state/binding epiphany!

I’ve been trouble shooting an issue that I was experiencing in Flex for close to 20 hours now. Yup I know, what could possibly take 20 hours to work out!!?

What I’ve been trying to do is set up binding between a textfield in a state of my view, and a private variable set in that same view. I’ll post some code to better illustrate in a minute. The reason I was trying to setup this binding is because of the runtime errors I was receiving when trying to change the textfields text property from within a function of the same component. I was getting plenty of TypeError: Error #1009’s and was aware that trying to set the textfield’s text propery before the state was initialised and the textfield was actually created was what was causing the issues. I just didn’t know how to get around them.

I just now had a look at the properties you can set on a tag within the tag and lo and behold there it was! creationPolicy!!! I’m sure I thought of this at some stage during the process but was tied up trying to get bindings to work the way I thought they should to actually try it (more on this in sec). Setting the creationPolicy to be “All” does the trick for the textfields I know I need to reference.

Here’s the example showing how I fixed my problem. Right click for view source

Now I’ve still got a bone to pick with states and bindings. It seems like binding variables within a components script tags to components (ie. textfields) within state tags is nigh on impossible. That or I don’t understand how to do it.

Here’s a few links that touch on what I’m trying to do:

http://www.mail-archive.com/flexcoders@yahoogroups.com/msg59439.html
http://bugs.adobe.com/jira/browse/SDK-16131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

http://www.mail-archive.com/flexcoders@yahoogroups.com/msg26126.html

It seems like the bindings fire once, but then go dead and nothing entered into the textfields ends up in the getter/setter variables that I’m binding them to. I’ve tried using custome events (ie [Bindable(event="myEventChanged")]) with no luck, the mx:Bindings tag, change events in the textfields themselves (but then that defeates the purpose of using bindings right?). You name it I think I’ve used it, so I guess I just don’t understand how to bind to things properly in state based components.

Does anyone have any good information and or an example of how to get this working?

(I think I may have just stumbled across the reason why my initial efforts weren’t working. Pretty sure it’s to do with the Mate framework and the way it’s scoping method calls in my view. Will post some more info when I have it)

UPDATE: Ok I’ve looked at the Mate stuff and I ended up doing things in a slightly different way. Not sure if it was user error or I’ve got a legitimate qualm, no doubt the boffins at mate.asfusion.com will put me on the straight and narrow.

15
Dec
08

Flex Builder trace() issues

I’m having a few issues with Flex Builder and Sephiroth’s FlashTracer Firefox extension at the moment. The first issue is that the Design view in Flex actually traces things like:

-> Begin call to AS: getGlobalPoint(Canvas1,-1,-1)
<- End call to AS: getGlobalPoint, Result = 494,409
-> Begin call to AS: showConstraints(false)
<- End call to AS: showConstraints, Result = null
-> Begin call to AS: getGlobalPoint(Canvas1,-1,-1)

Which can clutter up the FlashTracer console. Not only that, it also causes the FlashTracer to choke on the number of lines it is displaying which in turn causes Firefox to crash. Not an ideal way to debug an application.

I set out to remedy my problem this morning. And I managed to stumble across a Java version offering the same functionality as FlashTracer. Flash Tracer (imaginatively named ;-) can be found at it’s Google Code home. As I’m running the Firefox extension in it’s own window, this fits well with my work flow at the moment. So the fact that it’s not integrated into Firefox doesn’t matter for me so much.

Does anyone have any tips for getting Flex Builder to stop its incessant chitter chatter of trace outputs?

Still related to the flashlog.txt file, I’m completely baffled as to why running an Air application locks the log file and stops any other process from writing to it. So when debugging, be sure to close down all your Air apps. Very handy, certainly aids with my workflow when I’m trying to create things in Flash. Thanks Adobe. And I’ve logged a wishlist request and asked a few questions using the usual channels so will hopefully receive a good reason for the file being locked (I’m assuming it’s not just for kicks).

I just realised that the latest version of the Firefox plugin is only 2.2.0 yet on Sephiroth’s page there’s a 2.3.1 version. I’ll install that and see if it resolves the crashing issues).

UPDATE: I just came across SOS Max via Wezside’s blog Ahhh, you’ve gotta love Google! The SOS Max debugger looks very good and I think it probably trumps both FlashTracer and Flash Tracer.

13
Dec
08

Google Maps geo-location by IP Flex example

Following on from my earlier post regarding Google Maps and Flex, I’ve put together a new example which I reckon’s pretty nifty.

Somehow my idea was spawned by Andrew Shorten’s post which discussed using Google Maps and the new Adobe Cocomo service to create a collaborative mapping application. And I say somehow, as I’m not really sure how I went off on the tangent of geo-locating IP addresses when the original post was about two users drawing stuff on a shared map! Maybe they can see where each other is on the map and start drawing a line until they meet somewhere in the middle…

Anyway, (il)logic aside here’s the example I whipped up:

View source is enabled in the following example.

The “Geo-locate IP address” text field should auto populate with your current IP address. The initial map will load and center on London.

When coding up the infowindow that displays, I found this reference on the Google site very useful - http://code.google.com/apis/maps/documentation/flash/reference.html

The actual information is coming from a whopping great big file that I’ve uploaded to my server which was supplied by Maxmind. There’s a few other databases that they supply, so I might add some more features to this example down the track. And they have pay for use and free versions of all their data, which is great!

08
Dec
08

M-V-SEE

MVC is on my mind at the moment. I’ve read more about this and other design patterns and frameworks in the last few weeks than I care to recount (though I do hope it’s starting to sink in).

This is all in preparation for the biggest project I’ve ever tackled.

Now unlike other projects, I’ve stopped myself from just delving in and getting amongst the code.

I’m not sure I like this new approach though. It’s making me feel very stressed after not really having made a “proper” (read: there’s not much code sitting in classes) start on something I thought was going to be a lot easier than it’s turning out to be.

However, during my research (and after a few hands in head moments) I came across a great article that talks about MVC - Removing The Model-View-Controller Straitjacket In particular it discusses the difficulty in defining something which can mean many things to many people in many situations. Malcolm Tredinnick suggests to, “stop saying ‘thing X is (or is not) MVC’. You’re almost certainly fudging at the edges and certainly not making things any clearer.”

He also links to an original document from 1979 that sets out what MVC is. It’s pretty cool to think that the geeks back then were solving the same thing the geeks of today are.

In his summary he also offers some sage advice - “Solve problems and understand solutions in context. Don’t pigeon-hole.” I find that the problem with that advice is until you’ve tried to fit the pidgeons into their holes a few times (which seasoned OOP advocates have), it’s kinda nice to think (possibly foolishly) that they might just fit.

This is pretty much where I’m at at the moment - trying to squeeze whopping great big birds into comparably small holes. Fortunately I’ve got a big rubber MVC-Mallet to bang them in with! And some reassuring words that you shouldn’t feel too worried if things can’t be categorised exactly.

I’ll post more about what I’m doing in the coming weeks, but wanted to mention that I’m using the Mate framework (pronounced Mah-teh). It seems to offer some pretty cool features and some great help and examples on the website. There’s a few caveats with using it though. One of which (and this seems to be a bit of a recurring theme with these types of frameworks) is that certain parts of the application aren’t eligible for compile time type checking. I stumbled upon this today, and was quick to realise where the problem lay - but I’m only a few 100 lines of code in at the moment. I’ll post back when I’ve hit 10,000 lines of code and let you know if I’m still mate’s with Mate.

(I also just found this great article on similar subject matter over at as3dp.com - No Time for OOP and Design Patterns. Check it out, it’s a ripper!)





Categories

Recent Comments

Posts this month

July 2009
M T W T F S S
« Jun    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Archives