Wednesday, March 10, 2010

Storing in ArrayCollection if the result is only one object

if(flash.utils.getQualifiedClassName(acSubcatTemp[j].product).toString()=="mx.collections::ArrayCollection")
{
arraycollection = arraycollectiondemo[i]
}
else
{
arraycollection = new ArrayCollection(ArrayUtil.toArray(acSubcatTemp[j].product));
} }

Tuesday, March 9, 2010

Image resize in Flash

var disp:DisplayObject = leftImageLoader.content as DisplayObject;
var thumbBMD:BitmapData = new BitmapData( 240, 149, false, 0xffffff );
var area3:Rectangle = new Rectangle( 0, 0, 240, 149);
var matrix:Matrix = DisplayUtils.fitIntoRect( disp, area3, true, Alignment.MIDDLE, false );
thumbBMD.draw( disp, matrix, null, null, null, true );
var thumb:Bitmap = new Bitmap( thumbBMD, "auto", true );
thumb.smoothing = true;
expandedImageLeft_mc.addChild(thumb);

Monday, March 8, 2010

Calculating Number of Days between two dates

private function calcuateDays( start:Date, end:Date ) :int
{
var daysInMilliseconds:int = 1000*60*60*24
return ( (end.time - start.time) / daysInMilliseconds );