Tuesday, February 13, 2007

Flex Builder cut me

Wait, didn't I say I liked Flex Builder? Yes I did, but they could make things a hell of a lot better. I talked about some of the things I wish Flex builder had in an earlier post, but I recently come across a couple other things. When debugging dynamic expressions cannot be evaluated in watches. This was very frustrating when doing some xml parsing as the attributes of an xml snip are accessed via dynamic methods on the xml object. It goes something like this:

var xml:XML = < r>< e1 >< a1 >< /a1 >< /e1>< /r>
xml.e1


Now, if I put a watch on something like 'xml.element1' Flex Builder says that it can't evaluate the expression because of an exception. This was very frustrating as I thought there actually was a problem with my xml or syntax. The real problem was with Flex builder not being able to evaluate the dynamic expression when in debug mode. To get around this all I did was assign the value of 'xml.element1' to a variable, then put a watch on that variable.

Videos don't have to tell you how long they are

There is really no surefire way to tell how long an flv is. If you search the web or post something on flexcoders someone will quickly point out that if you hook into the onMetaData handler of the stream you can get the duration of the video. How nice of them. Then you try it out and find that it doesn't work at all for you, those liars! Well, they weren't fibbing, they were just making assumptions about what you were doing. The fact is that onMetaData only works if the flv has metadata associated with it. Yes, that makes, but why wouldn't they have it set? Simple answer is no idea, I think earlier versions of flash didn't requiare it, or maybe something was used to convert the file to flash, either way it doesn't work. Fortunately there are some tools out there that will inject the metadata into the flv so that you can use that convenient onMetaData handler everyone pointed out. FLVTool2 is pretty good at this, and comes in command line and UI covered flavors. There is also a library written in Ruby that slips my mind at the moment, though I've heard it's quite good.

You cannot set the playhead time

Well, you can, but you better hope it is on or just after a keyframe or else you have no idea where the video will start playing from. I thought it would be cool to add a frame stepper to my player, then could do some neat jitter effects or something, but no. Apparently when you do a seek or set the playhead time of a video it will only navigate to the closest keyframe of the video. This sucks if you're trying to work with flvs that you do not have control over, as the keyframes could be set anywhere. The one video I was testing didn't even have them at regular intervals (keyframes were between 0.01 and 7 seconds apart). This is what ended up killing my frame stepping idea.

Monday, January 22, 2007

To Infinity and Beyond: The Future of Canadian Software Development

I recently attended the seventh annual CUSEC (Canadian University Software Engineering Conference) this past weekend. Every year, this event brings more and more of Canada’s youngest and brightest future developers to Montreal for a chance to interact with some of the worlds biggest names in the development community. As you can probably tell, I’m a huge supporter of what this conference and its founder, John Kopanas, are trying to accomplish. After each year, I can't help but think what a great time it is to be involved in this industry, and I can't wait to see what is to come.

Amongst the presenters this year were some influential names; Dave Thomas (author of The Pragmatic Programmer), Dr. Venkat Subramanian (coauthor of Practices of an Agile Developer) and Pete McBreen (author of Software Craftsmanship). However, my favorite presentation came from a man named Greg Brill of Infusion Development. In an hour on stage that was half stand-up comedy, half inspirational monologue, Brill went on to deliver a session that made me feel the PASSION about software development that I hope we can all experience in our lifetimes. He suggested to all those who were moving into the development workforce that experience, while valuable, is worthless without aptitude and attitude. I swore at that point that Brill could read my mind. In a field that is changing and shifting so rapidly, I have always admired developers who could continuously adapt to their environment and learn emerging technologies as if were as natural as breathing.


The conference was also flooded with representatives from organization looking to recruit the next wave of development talent. Google, IBM, Business Objects, RIM, and Telus were all eager to give away their latest in corporate swag. I couldnt help but say to myself “Oh wow! Just what I needed! Another foam stress reliever PDA and matching slinky carrying case!”


If you’re not within reasonable distance to Montreal, but would still like to experience some of what CUSEC has to offer, don’t fret. Recent and past CUSEC Podcasts and presentation notes are available soon through the archives page on Cusec.net. Enjoy.

Friday, January 5, 2007

Videos don't have frames!

Huh? Ya, that is unexpected, let me explain a little. Even with flv files (compiled flash video) there is no easy way to figure out what frame of the video you are in. I found this very strange since Flash is known to be all about the frame based animation. There are ways to work around this, I was doing some math to figure out what frame was being shown by using the framerate and current playhead time of the video but it really wasn't that accurate. This eventually caused me to give up on trying to do anything based on frames, actually there was one other reason which I will get into later.

Saturday, December 30, 2006

onFrameEnter, onFrameEnter, onFrameEnter, onFrameEnter...

If a component is visible (possibly even when it isn't visible?) and you are hooked into the onFrameEnter event it will fire continuously at a regular interval, even though nothing is happening. I found this very frustrating when trying to put together a little Flex flash player (which is the cause of most of the problems I ran into). I had wanted to display the current frame being played and thought using theonFrameEnter event would work. This was a very unexpected behaviour, though I'm sure there are reasons for it. This ties into a couple other problems I had, which will be coming up shortly.

Flex 2 Annoyances

I've been using Flex 2 for a couple of weeks now and it is really a powerful and fairly easy to use framework. The language (Actionscript 3) used for scripting is very easy to pickup (I'm coming from mainly a Java background) and the Flex Builder IDE helps get a UI together in a snap. There are a few things that I have found very annoying with this new technology though so I thought I'd do a couple posts on the problems I've had so far and any solutions I've come up with. More to come.