iPhone developer program

June 18th, 2008 Randy Posted in Runningmap | No Comments »

After a month of back and forth communication with Apple, I have been accepted into the iphone developer program. Looks like the acceptance rate for this program is something like 16% but I think this will change after July 11. This will allow me to test my application on hardware and distribute it through the iTunes App store. I have an application in mind that is related to geo-spacial content. Check back soon for updates.

 

OSX 10.5.3 breaks Flex debugging

June 4th, 2008 Randy Posted in Flash development, Flex development, OS X | No Comments »

I dealt with this with the 10.5.2 update. Apparently the OSX update installs a fresh version of the Flash Player which is not the debugging version. This will disable the ability for Flex Builder to test an application in debug mode. It is a simple fix (I like simple). Simply download the Flash Player with debugger and install it.

 

Setting antiAliasType for Flash CS3 Components

April 10th, 2008 Randy Posted in Flash development | No Comments »

In a previous post on custom cellrenders in Flash CS3 I discussed my trials with replacing the cell contents of a List control with my own creation.

Recently I came up against a problem with using a stock List control. The problem is that the default setting for the textfield antiAliasType is NORMAL which means the type renders in a pre-Flash 8 manner. I want the antiAliasType to be set to ADVANCED to take advantage of the Saffron Type System.

There is a method to style the renderer in a list control:

Actionscript:
  1. list.setRendererStyle("embedFonts", true);
  2. list.setRendererStyle("textFormat", myTextFormat);

The word is that they didn't have time to add "antiAliasType" to this API. The answer to my problem was to use another method that allows a crafty developer to extend CellRenderer and then tell the List to use this class with this line (note: be sure to import your CustomCellRenderer class):

Actionscript:
  1. list.setStyle("cellRenderer", CustomCellRenderer);

Then in your custom class you need to manually set the anitAliasType of the property "textField"

Actionscript:
  1. package ca.nait.d3.controls.video {
  2.     import fl.controls.listClasses.CellRenderer;
  3.     import flash.text.AntiAliasType;
  4.    
  5.     public class CustomCellRenderer extends CellRenderer{      
  6.         public function CustomCellRenderer(){
  7.             textField.antiAliasType = AntiAliasType.ADVANCED;
  8.         }
  9.     }
  10. }

 

RunningMap.com: major update

March 3rd, 2008 Randy Posted in Flash development, Flex development, Runningmap | No Comments »

Dave and I worked hard last fall-early winter to put together this new version of RunningMap.com which was release to our production website last night. It has been in testing over the last couple months and it feels great to finally get it out there.

The brilliant new design was the creation of designer/runner Sarah Ramsden. I decided I was too close to the project to be objective and the design needed a different eye, so Sarah was enlisted. I couldn't be happier with the design.

This version still features the AS2 Yahoo! Maps component. Very recently Yahoo! announced a new AS3 based maps component. Needless to say I am hard at work rewriting the application in Flex and so far I am seeing improvements in performance that are astounding. The AS2 version of runningmaps was pushing the Flash Player to its limits. Now with AS3 it's a new ball game and it will be exciting to see how far we can push it.

A special shout out goes out to Zach Graves for the excellent work on the new maps API.

 

Daylife widget

February 19th, 2008 Randy Posted in Uncategorized | 2 Comments »

 

External Interface with javascript confirm “bug”

February 4th, 2008 Randy Posted in Flash development | 2 Comments »

I am working with External Interface in Flash and I encountered a problem which I am recreating here. Below you should see a Flash based (AS3) button that says "Show Alert". If you click it a javascript confirm dialog will appear. You will also notice that the button stays in it's down state. If you wait more that 15 seconds to confirm, the Flash Player complains that a script has been running too long. This is unexpected since I would assume that clicking a button in Flash and Javascript responding after a confirm dialog should be an asynchronous event. I tried this using the "MouseEvent.MOUSE_UP" event and got the same result. See below for the error response, javascript and actionscript code.

 

(note: you should see "from javascript" when you agree to the confirmation dialog box if the call succeeds. If the call fails and you have the debug Flash Player version installed you should see an alert window with the error below. If you do not have the debug player and the call fails you will see nothing.)

Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
at ()
at flash.external::ExternalInterface$/_evalJS()
at flash.external::ExternalInterface$/call()
at showAlert_fla::MainTimeline/handleClick()

Funny though. Flex has no problem:

JavaScript:
  1. function fromFlash(){
  2.     if(confirm("Talk to Flash?")) toFlash();
  3. }
  4.  
  5. function toFlash(){
  6.     thisMovie("showAlert").toFlash("from javascript");
  7. }
  8.  
  9. function thisMovie(movieName) {
  10.     if (navigator.appName.indexOf("Microsoft") != -1) {
  11.         return window[movieName]
  12.     }
  13.     else {
  14.         return document[movieName]
  15.     }
  16. }

Actionscript:
  1. alertButton.addEventListener(MouseEvent.CLICK, handleClick);
  2.  
  3. ExternalInterface.addCallback("toFlash", responseFromJavascript);
  4.  
  5. function handleClick(p_evt:MouseEvent):void{
  6.     responseTF.text = "";
  7.     ExternalInterface.call("fromFlash");   
  8. }
  9.  
  10. function responseFromJavascript(p_response:String):void{
  11.     responseTF.text = p_response;   
  12. }

 

Creating Flash content with Sprout

February 3rd, 2008 Randy Posted in Flash development, Flex development | No Comments »

I have been playing around with Sprout and I am blown away. As a flex developer and a visual communication designer I know how hard it is to build a really awesome UI. It takes hard work. Iteration. Tweeking and more tweeking. Sweating over pixels! The Sprout guys have done an AMAZING job with this Flex app. And the kudos don't end there. It is a great idea and a slick implementation. Here is my first sprout. At this time it does not seem to be able to load the news feed ... not sure what is up with that.

UPDATE: I tinkered with the RSS URL and got it to work. Yay!


 

ePrint web-based print order form

January 29th, 2008 Randy Posted in Flash development | No Comments »

This is a web application that I built for NAIT's in-house printing department.

The initial idea was simple: create a webpage that lets customers place printing orders on-line. I had previously implemented an online solution for the photo department and they wanted something similar. (The photo solution, called epix, is actually a customization of the Web Publisher Pro application which is an add-on to Canto's Cumulus digital asset management package.)

Of course it was not so simple to build. Firstly there were many iterations of the form itself as I worked with the client to fine tune the job specification details. The HTML solution was to show only those choices relevant to the selected job type. This was done with a combination of javascript and css so that items were shown and hidden based on a combo box selection.

The other requirement was the ability to upload files. I found a JSP (JavaServer pages) based library (Apache Tomcat was being used as the application server) that worked for us. When the user clicks submit, a bunch of javascript-based validation is invoked. When validation passes an email is formatted and sent to an ASP mail service.

This web application was deployed and saw a LOT of use. Too much, says the client :) But there were some usability problems. The JSP upload library turned the page into an old-school post-back page: the customer uploaded a file and then the page reloaded itself and repopulated itself based on the session variables etc. This made the page very complicated to build, debug and enhance. Also there was confusion with the standard html-based upload mechanism where the user selects the file AND THEN clicks upload. Not intuitive.

So I developed version 2 which replaces the upload functionality with a Flash-based widget that talks to my custom written java servlet to handle the upload. It provides mush better user feedback and does not require a page refresh (I was inspired by Flickr's new upload page). The submit button is also Flash based so that a page refresh is not required to give feedback about the success or failure of the submission.

The result is a webpage with a simpler architecture: HTML, CSS, Javascript and Flash that is very AJAX in the way it works. On the server side are two custom written Java servlets that handle upload and email. Simple, but not simple.

ePrint web order form

 

Atlanta 360|Flex conference

January 26th, 2008 Randy Posted in Flash development, Flex development | No Comments »

I attended the San Jose 360|Flex conference in 2007 and it was investment that continues to pay dividends for me. I met many people from the Flex/Flash world (in no particular order): Tom Ortega, John Wilker, Phillip Kerman, Christian Cantrell, Dan Polygeek Florio, Zach Graves, Aaron King, Scott Morgan, Marke Anders, Mike Chambers, Mike Downey, Josh Tynjala, Ted Patrick, Victor Rubba, Peter Mckiernan, Ely Greenfield, Ben Lucyk and Clint Modien. Zach and Aaron were kind enough to let me hang out with them since I was a stranger from another country. I went to fantastic presentations and gained a new respect for Adobe and their people. I learned a ton. I think the conference is just the right size to foster the kind of atmosphere that makes is worthwhile to attend.

Consider going to Atlanta on Feb. 25 2008. You won't regret it.

 

iteration order of an associative array

November 10th, 2007 Randy Posted in Flash development | No Comments »

An associative array is an array of values indexed by a key (string) instead of an integer. In fact it is really just a generic object and using the array constructor does not give you any more functionality than an object because most of the Array API will not work (i.e. sort). But it still helps me to think of an object as an associative array, so the concept remains an important one to me.

When iterating through an object using a for... in loop, the order of the array cannot be guaranteed. I wonder, however, if the same associative array can be relied upon to iterate the same order each time. I thought so. But I was wrong. Recently I was debugging why my video controller was behaving differently on a PC vs a Mac and I discovered that the two platforms differed in how Flash was iterating through the video metadata object. Nice to know.