DesignAudit.net

Design Blog using Express Engine

My good friend and superb designer Kerry Layton wanted a nice, clean blog where he could dip his toes into the world of blogging. We had this site up and running within a day, and launched on New Years Day with a collection of calendars to start the year. Check it out.
» launch site | » click to close

Hollyberry Baking Shop

Shopping Cart using Magento

Just in time for the holiday rush, we launched a new, easy to navigate and use shopping cart for Hollyberry Baking. I found Magento a nice platform to work with and it has been a solid solution for Holly integrating closely with her shipping workflow. Design by Marcy Hawley.
» launch site | » click to close

Resa Design Shop

Shopping Cart using X-Cart (OSCommerce)

Resa's success overran her capacity to manage a PayPal shop, so we took her business to the next level with a full featured web store and SEO implementation. Unfortunately the store has exponentially increased Resa's business. Ooops, so sorry Resa. ;-)
» launch site | » click to close

Northstar Church

New Site Design, SEO Update, and News Blog

I stepped in and helped Northstar implement a fantastic design while also updating their SEO. The home page has a nice rotating feature leveraging some cool Flash and Ajax action. Wordpress powers their current news feed. The beautiful design is the handiwork of Becky Siegrist.
» launch site | » click to close

[AC] Advent Conspiracy

Site using Expression Engine

Advent Conspiracy wanted an easier and more flexible solution for their high traffic site. With Boxing Clever, we launched this EE website and tied into social networks such as Flickr, YouTube and Facebook to help spread the word about fresh water wells for impoverished people groups.
» launch site | » click to close

@xtyler pay attention and learn something! ;)  11:23 AM 03/10/2010

Flex

Simple Webcam Capture Demo for Flex

I put together a simple demo of how you can capture an image from the webcam in Flex. Nothing super complex going on here once you see it.

Basically we use the Camera, VideoDisplay, and the Bitmap classes. The Camera allows us to do just what you expect prompting the user to connect to their camera. The Camera is then attached to the VideoDisplay component and we can see what the camera sees.

  1.  
  2.  
  3. var camera:Camera = Camera.getCamera();
  4. if (camera)
  5. {
  6. videoDisplay.attachCamera(camera);
  7. }
  8. else
  9. {
  10. Alert.show("Oops, we can't find your camera.");
  11. }
  12.  
  13.  


When we want to capture an image we create a new, empty Bitmap at the same size as the VideoDisplay, and we draw the output of the VideoDisplay to the image. We then write that image back to the stage so we can see it.

  1.  
  2.  
  3. var snap:BitmapData = new BitmapData(320, 240, true);
  4. var snapBmp:Bitmap = new Bitmap(snap);
  5.  
  6. snapBmp.width = 320;
  7. snapBmp.height = 240;
  8.  
  9. if(snapshotHolder.numChildren > 0)
  10. snapshotHolder.removeChildAt(0);
  11.  
  12. snapshotHolder.addChild(snapBmp);
  13. snap.draw(videoDisplay);
  14.  
  15.  


Demo: http://www.davidortinau.com/flash/WebcamCaptureDemo/WebcamCaptureDemo.html

Source: http://www.davidortinau.com/flash/WebcamCaptureDemo/srcview/index.html


Categories: FlashFlexPermalink

How to Resize the Flex Stage and Use the Browser Scrollbar

I have a Flex application that will shrink and grow vertically, but I do NOT want to ever, ever, ever see the Flex scroll bar. Ever! It has its place, but not for the entire app. That’s what the browser has a scroll bar for. And people are intimately familiar with that scroll bar, so I would much rather use that.

My Flex application makes use of the mx:ViewStack and each view will be the same width, but vary in height and even change interactively. At a minimum I want Flash to span the available browser window top to bottom. At a maximum I want the user to scroll with the browser scroll bar.

How I Did It
I disable the Flex scroll bars by modifying the policy value. Depending on how nested your application is (Canvas > VBox > Canvas > HBox > etc) you may have to do this at many levels. If there is a way to disable this by default, please have mercy on a brother and tell me now.

  1.  
  2. <mx:Application
  3. xmlns:mx="http://www.adobe.com/2006/mxml"
  4. layout="absolute"
  5. width="680"
  6. horizontalScrollPolicy="off"
  7. verticalScrollPolicy="off">
  8.  

Next I set the ViewStack to resizeToContent.

  1.  
  2. <mx:ViewStack id="mainStack" resizeToContent="true"
  3. <views:WelcomeView id="welcomeView" />
  4. <views:OrderFormView id="orderFormView" />
  5. </mx:ViewStack>
  6.  

Now I create a listener to handle any resize of the views. In my case this will always come up through the OrderFormView which is itself an mx:ViewStack.

  1.  
  2. import mx.events.ResizeEvent;
  3.  
  4. private function setupResize() : void
  5. {
  6. orderFormView.addEventListener(ResizeEvent.RESIZE, formResize);
  7. }
  8.  

And then on formResize I use the ExternalInterface to issue the appropriate javascript to resize my DIV container to the height of my ViewStack plus a buffer of 30 pixels cuz I want a little play at the bottom.

  1.  
  2. private function formResize(e : ResizeEvent) : void
  3. {
  4. ExternalInterface.call("setFlashHeight", mainStack.height + 30);
  5. }
  6.  

ExternalInterface.objectID is the ID of the DIV made available by Flex. Then in the page I have a javascript function to perform the actual resize.

  1.  
  2. function setFlashHeight(newHeight)
  3. {
  4. var viewportwidth;
  5. var viewportheight;
  6.  
  7. // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
  8.  
  9. if (typeof window.innerWidth != 'undefined')
  10. {
  11. viewportwidth = window.innerWidth,
  12. viewportheight = window.innerHeight
  13. }
  14.  
  15. // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
  16. else if (typeof document.documentElement != 'undefined'
  17. && typeof document.documentElement.clientWidth !=
  18. 'undefined' && document.documentElement.clientWidth != 0)
  19. {
  20. viewportwidth = document.documentElement.clientWidth,
  21. viewportheight = document.documentElement.clientHeight
  22. }
  23.  
  24. // older versions of IE
  25. else
  26. {
  27. viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
  28. viewportheight = document.getElementsByTagName('body')[0].clientHeight
  29. }
  30.  
  31. document.getElementById('consumer').style.height = (viewportheight > newHeight) ? viewportheight + 'px' : newHeight + 'px';
  32. }
  33.  


Something else you’ll likely want to do is scroll back to the top of the page after the resize.

  1.  
  2. ExternalInterface.call(
  3. "function() { scroll(0,0); }"
  4. );
  5.  

That’s it. The next thing to do is implement something like SWFFIT or write a little function that appropriately resizes the DIV upon a browser resize event (if the user resizes or removes a status bar or finder bar, etc.).


Categories: FlashFlexPermalink

A Simple Form Field Comparison Validator for Flex

In addition to a Date Range Validator control for a recent project, I also need to compare to user input fields for confirm email address and confirm password. Since I’d just extended the DateValidator, I figured the same approach would work for comparing two controls.

Class: FieldComparisonValidator.as

Disclosure: this was evidently something Adobe Consulting had in their bag of tricks for Flex 2, but namespaces had changes and the code I found burried in a mailing list didn’t work. I made some quick updates to what I saw there, and this works fine for comparing mx:TextInput.

To see how the entire form validation plays out in my forms, check out the previous post How to Validate a Date Range in Flex.

To validator implemntation is:

  1. <validators:FieldComparisonValidator id="valConfirmEmail" source="{txtEmailAddressConfirm}" property="text" destination="{txtEmailAddress}" destinationProperty="text" required="true" />

I’ll be using this thing aplenty, so if it breaks down I’ll be sure to update it. If you have a better validator for this scenario, or an improvement, please let me know.


Categories: GeneralFlexPermalink

How to Validate a Date Range in Flex

I had the need to validate a date based on a range of allowed dates, and I couldn’t find this validation control anywhere for Flex. The reason is probably because it’s just so easy to write.

The solution is to write a custom validator that extends DateValidator, pass in the start and end dates, and then perform the validation. This way I can benefit from the nice inline validation Flex gives us.

The actual validation code to compare dates is based on the Date.parse() which you can see in the class code.

The class: DateRangeValidator.as

In my form I’ve been using a form validator that checks all the validation controls in the array and when it’s all good enables the form button. The Flex code for my form looks basically like this:

  1. <mx:Form>
  2. ... other fields ...
  3. <mx:FormItem label="Date of Birth" required="true" labelStyleName="fieldLabel">
  4. <mx:DateField disabledRanges="{[ {rangeStart: new Date(1988,0,1), rangeEnd: new Date(2025,11,30)} ]}" id="dateOfBirth" yearNavigationEnabled="true" editable="true" formatString="MM/DD/YYYY" minYear="1900" maxYear="1988" change="this.formValidator.validateForm(event);"/>
  5. </mx:FormItem>
  6. ... other fields ...
  7. <mx:FormItem horizontalAlign="right" width="349">
  8. <mx:Button id="btnSubmit" click="submit()" label="NEXT"
  9. enabled="{this.formValidator.formIsValid}" />
  10. </mx:FormItem>
  11. </mx:Form>

Then I have my array of validators:

  1. <mx:Array id="validators">
  2. ... some validators ...
  3. <validators:DateRangeValidator id="valDateRange" source="{dateOfBirth}" property="text" StartDate="{new Date(1900,0,1)}" EndDate="{new Date(1988,0,1)}" required="true"/>
  4. </mx:Array>

And the custom form validator that checks all fields to make sure it’s all valid before enabling the button. For more info on this, check out this article and code from Joel Hooks.

  1. <validators:FormValidator id="formValidator" validators="{this.validators}"/>

And that’s it. I hope this saves someone a little time. If you have any comments or improvements, please let me know.


Categories: GeneralFlexPermalink

360|Flex Conference Wrapup

My first 360|Flex experience began Monday morning with Mike Labriola (@mlabriola, slides) stalking back and forth in front of a standing room only crowd. Shirt un-tucked, one hand thrust into a pocket he held a goblet of water in the other from which he alternately took sips and gestured to his listeners. Delivering his best Sean Astin, Mike transformed the room into his private cigar study. We were all in audience to savor his cognac and digest the divine merits of unit testing Flex applications.

“Welcome to 360|Flex,” I thought. The session was fantastic and Mike was entertaining all the way through the final “ok, get out of here” as he waved his empty goblet and turned his back.

Bookend that session with my final session Wednesday afternoon on Design Patterns delivered by Yakov Fain (@yfain). I whispered to @dmatchack sitting in front of me, “I hope we finally talk about something over than MVC”. He said, “no kidding” and chuckled.

What we received in the next 1 hr and 20 minutes was a much more than that.

Though likely not the whole story on Yakov, I left with the distinct impression that Yakov HATES Cairngorm and PureMVC (mate didn’t garner a sneer) in favor of implementing good design patterns in a more appropriate manner. Yakov gave away a book to an attendee, “though I’m not really satisfied with that answer”. Halfway through the session we were treated to a gratuitous (though clean) slide of Angelina Jolie. The half filled room erupted in laughter and applause.

I attended as many non-developer related sessions as were of interest to me. This strategy yielded my favorite sessions from the conference:

Joe Johnston (@merhl)
FLEXperience - Putting the Flex in UX
http://www.slideshare.net/merhl/flexperience

Francisco Inchauste (@iamfinch)
RIA Mojo - Making Your Flex Application Stand Out with a Great UX
http://www.davidortinau.com/presos/RIA_Mojo.pdf

Joe Olsen (@joeolsen, @phenomblue)
Creativity is the Fuel, Process is the Engine: Building a Scalable Interactive Production Environment

All said, it was a great 3 days of meeting or at least experiencing great people (@jprevel, @randytroppmann, @lordb8r, @kremdela, @visualrinse, http://coenraets.org/), learning a new tip here and there, and overall being reminded why I do what I do building interactive experiences.

Thanks to @lordbron and @jwilker and everyone else that made this a great conference.


Categories: GeneralFlexPermalink

CASA Lib Now Available for Actionscript 3.0

Perhaps a lesser known framework for building Flash projects, CASA Lib (formerly CASA Framework) is a nice package of helpers and loose structure for constructing your actionscript world. CASA Lib is the ongoing work of Aaron Clinger and Mike Creighton, both previously working together at Odopod.

I've worked on a couple of projects with Mike and seen his use of CASA Lib first hand. Mike does really nice work, and on that merit alone I'm taking a long look at how CASA Lib can help me.

I've used Cairngorm in Flex and goofed around with EasyMVC and PureMVC. For Flex, Mate is another one out there that seems to be getting more and more buzz. There is a LOT of information about frameworks for Flex and Flash out there, but not a ton of consensus or guidance from what I've seen. Finding best practices for developing Flash/Flex is a real chore, not that it's ever easy in any technology given how opionated developers can be.

CASA Lib is really something completely different. I think with my current understanding I would characterize it more as a loose framework built with a bagful of the most frequently used helper methods for things such as loading xml data, destroying instances, event handling and other tasks.

Check it out and let me know what you think.


Categories: FlashFlexPermalink

Add a Comment