How to get Scrollbar for Constraint based Containers

A quickie out here…In a recent project I am working on (Tryptich ebook reader in flex)..For the Demo part we had a requirement where in I had to insert this long image in a Vbox with width 100% and height 100%..The image got loaded but no scroll was there…Since it was all 100% …as expected the image squashed itself to fit in that 100%…I googled and found a cool solution (thanks to the guy who figured it out) Well, you just mention minHeight in the container which hosts the image and there you get the scrollbar by magic…

No time for details but do check the code below for reference…

<mx:VBox width=”100%” height=”100%” paddingLeft=”7″ paddingRight=”7″
    paddingBottom=”7″ paddingTop=”3″ horizontalScrollPolicy=”off”>
  
  <mx:VBox horizontalScrollPolicy=”off” verticalScrollPolicy=”on”
    styleName=”mainVBoxWhite” width=”100%” height=”100%” minHeight=”0″ minWidth=”0″>
          <mx:Image id=”ttContent” source=”assets/pages/ch1_1.gif” complete=”loadComplete(event);” />
      </mx:VBox>   
  </mx:VBox>

Advertisements

Use WebServices in Flex4

Taking cue from a very good tutorial  from insideria.com, I made a small app in Flex4. My fisrt official app in Flex4 using Flash Builder. I’ve used a public webservice to fetch quotes based on topics. There’s a combo box populated with some topics. When you click a certain topic, the webservice uses another method to fetch the “quotes” on that topic. Pretty simple…Now, what’s different here…..anybody can do it in Flex2 or 3…Well, I used the new “Connect to Web Service” feature where in I added the webservice URL and Voila…I get some pre cooked code out there……I just have to strategise my app and not worry about the nitty gritty of code…Its kind of cool wherein you have to get in some quick plug in or small handy componenent…..

Thanks to Fortune Web Service

Here’s the DEMO version…(a bug – However I could not fire the call intially and get the quote when the app loads….will figure it out..)

and here’s the SourceCode to get going…

Parting Note: Flex 4 generated SWF files are much more heavier than Flex 3 SWF files. So Flex 4 SWF file for this Demo is 1.31 MB and its Flex 3 counterpart is only 433 KB, which makes Flex 4 SWF file approx 3 times heavier….Somebody listening…? A heavy price for all those jazzy effects and sleek shadows…

An Update: the DEMO just not might work as there’s some crossdomain.xml (Darn! I hate it) issue…Will fix it soon..

Add cool effects in Flex 4!

Flex 4 (Gumbo) is real Jumbo in sheer power and the new features. Firstly, good news for developers out there, Coding in Flash Builder is a delight. There are so many new attractions viz a viz

  • You get a more descriptive Code Help with detail window showing the heirrachy of the attribute or object you would be adding. Check the screenshots below.
  • A whole new MXML with jarring things filtered out and keeping only the most essential ones.
  • You can’t put styles in the MXML tags now…it has to be a class and added in stylename attrb
  • Overall change of Layout containers and other components
  • By default the boring blue background in Flex 3 is not there anymore…

The only way to experience all the above goodies is to download the Flash Builder Beta and dive right in….

Chk this small example using the Flex documentation help out there…just scratched some surface 🙂

Flex 4 Source Edtior View

Working on Tryptich Book Reader development…

Developing a Flex tryptich book reader application these days. This is a ebook reader with standard features. Currently, I’m working on the prototype and subsequently, we’ll be extending this to full blown app…Also contains Cover flow, Fullscreen feature, drag drop docked panels, etc.. Really Flex rocks when it comes to robustness and power…Below is a concept shot of tryptich …but it has changed lot since then…

tryptich

97 Things Every Software Architect Should Know – The Book

Chanced upon this very useful and must read book “97 Things Every Software Architect Should Know – The Book” by a bunch of reowned architects. A collection of 97 most innovative and thoughtful articles you’ll ever find bound in one place. Check this on Amazon.com

Also you can read it online on this wiki site

http://97-things.near-time.net/wiki/97-things-every-software-architect-should-know-the-book

Infact I created a new Catgory “Must Reads” to accomodate these awesome publications….Happy Reading over the weekend…

10 Ways to Improve Your Code on InfoQ.com

Watch this awesome presentation by Neal Ford an architect at ThoughtWorks on How you can improve your coding style and ATTITUDE…in 10 most useful ways. Infact, this is a must have potion for any developer and a Code loving guy…

Download the entire presentation in PDF format. 

Get the preview of topics covered in the presentation. Courtesy : InfoQ.com

 

Composed Method

  • Divide your program into methods that perform one identifiable task.
  • Keep all of the operations in a method at the same level of abstraction.
  • This will naturally result in programs with many small methods, each a few lines long.

TDD – stands mostly for test-driven development but can also be viewed as test-driven design.

  • When one uses TDD, he starts thinking about the consumer of the code he is writing. This brings awareness on how his code is going to be used by another.
  • It forces the developer to mock dependent objects, resulting in a clearer picture of the relationship between the objects.
  • TDD encourages the creation of composed methods.

Static Analysis

  • It is quite useful to use tools like FindBugs which analyzes the bytecode to discover bugs.

Good Citizenship – refers to the way classes should react to one another

  • Singletons are a bad choice because they have mixed responsibilities and are not testable. They are the objectual correspondents of global variables.
  • The proposed solution is to create a regular POJO and use a factory to make sure that only one instance gets created.

YAGNI – You Ain’t Gonna Need It

  • One should write only the code that is used now.
  • Avoid speculative development which increases the software entropy of a code.
  • Top 10 Corporate Code Smells:

Question Authority – Some things should not be done just because that is the custom.

Single Level of Abstraction Principle – everything should be at the same level of abstraction

  • All lines of code in a method should be at the same level of abstraction

Polyglot Programming – use the best language for the problem while maintaining the same platform (JVM/.NET)

Learn Every Nuance – developers benefit from learning nuances of their language

Use the Anti-Objects Pattern – “an anti-object is a kind of object that appears to essentially do the opposite of what we generally think the object should be doing.”

Line Chart Graph in Flex

Recently, I created a small Line chart Tool, which is deployed on one of our projects on Salesforce.com. This graph draws a line chart curve when the data changes dynamically. I had real fun working 0n this small app.Once again, MVC pattern made it real easy, as I had my Model class binded to my view. The data gets updated in the model class, thus changing the graph dynamically… There are many other features such as Fullscreen view on doubleclick. Checkboxes to set the curve visibility on and off, etc.

For preview, I uploaded an intial prototype of the application. click here

Well, I wish I could have shared the source code also.

Line Chart Graph in Flex

Line Chart Graph in Flex