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

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

Add a Comment