Friday, August 20, 2010

Embedding assets

[Embed( source="/assets/images/box.jpg", mimeType="application/octet-stream" )]
private var jpgBytes:Class;

Creating popup in flex using popupmanager

var printComponent:PagesPreview = PagesPreview(PopUpManager.createPopUp(this,PagesPreview,false));
printComponent.width = 0;
printComponent.height = 0;
PopUpManager.centerPopUp(printComponent);

Thursday, July 22, 2010

Setting Font Family in css static

@font-face
{
src:url("CSSStyles/Fonts/arialbi.ttf");
fontFamily: Arial;
fontWeight: bold;
fontStyle: italic;
text-decoration: none,underline;
advancedAntiAliasing: true;
}
@font-face
{
src:url("CSSStyles/Fonts/arialbd.ttf");
fontFamily: Arial;
fontWeight: bold;
fontStyle: normal;
text-decoration: none,underline;
advancedAntiAliasing: true;
}
@font-face
{
src:url("CSSStyles/Fonts/ariali.ttf");
fontFamily: Arial;
fontWeight: normal;
fontStyle: italic;
text-decoration: none,underline;
advancedAntiAliasing: true;
}
@font-face
{
src:url("CSSStyles/Fonts/arial.ttf");
fontFamily: Arial;
fontWeight: normal;
fontStyle: normal;
text-decoration: none,underline;
advancedAntiAliasing: true;
}
.myPlainStyle1
{
fontSize: 12;
fontWeight: bold;
fontStyle: italic;
text-decoration: none,underline;
fontFamily: Arial;
}

Thursday, June 17, 2010

Setting Text in Text area with styles without effect

var tf:TextFormat = new TextFormat();
var tfield:TextField = new TextField;
tfield= richText.textArea.mx_internal::getTextField();
tf = tfield.getTextFormat();
tf.letterSpacing = letterSpace;
richText.textArea.mx_internal::getTextField().setTextFormat(tf);

Wednesday, April 7, 2010

Clock in Flex

Hi The way you want to develop digital clock in flex is
private var timer:Timer;

private function init():void {
this.timer = new Timer(1000);
this.timer.addEventListener(TimerEvent.TIMER, this.resetNow);
this.timer.start();
}


private function resetNow(event:TimerEvent):void {
this.clock.text = new Date().toLocaleTimeString();
}

]]>



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 );