Category Archives: Flex Development

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>

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

Recursive XML parsing in Flex

When I had to parse a long book.xml for CD Splitter tool I was working on recently, I had a hard time to get the xml parsed effectively and with minimum code lines.  And I was hell bent, that i’ll not bother the good old friend google for this. Finally, after few attempts I got the solution.

private function onTemplateXMLLoad(event:ResultEvent):void

{

parseTemplateXML(XML(event.result));

}

private function parseTemplateXML(objXML:XML):void

{

if(objXML != null)

{

for each(var item:XML in objXML.children())

{

// trace("hasComplexContent*** : "+item.hasComplexContent());

if(item.hasComplexContent())

{

// recursive call

parseTemplateXML(item);

}

else

{

// this is the node value you are seeking

}

}

}

}

Workaround for Error #1034: Type Coercion failed: cannot convert mx.utils

When I gave my first flexool build to Zoltan, he reported 2 erros and one of them was “TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectProxy@6380a19 to mx.collections.ArrayCollection”.

Not a familiar one for me. So I checked the engine I sent him on my machine. It was working fine without error. the i googled and found the reason behind this.  It happens when there is only 1 single node in the xml flex is trying to load. So it is returned as an ObjectProxy instead of an Array and the error pops up. Perhaps a bug with flex.

See the solution here: http://forum.sephiroth.it/showthread.php?p=32751

It solved my problem. thanks tekati

Flex classes summary for certification

These are some of the points I compiled in adoc file when I studied flex. These are taken mainly from the exhaustive Flex Builder Help documentation. These might be useful for somebody who would like to appear for Flex Certification or for an interview.
Download it here

Topics covered in the document are:

  • Generic
  • Event Handling
  • Data Acess
  • Visual Components
  • Data Providers & Collections
  • Hierarchical Data Objects
  • Object Oriented Programming Structure
  • Application Design
  • Flex Security
  • Optimizing Flex Applications
  • Charting Components