RSS

Reflection Container in Flex/AIR

<s:VGroup id=”reflectionContainer” x=”50″ y=”50″ gap=”0″>

<s:BitmapImage id=”image” source=”{Harbor}”
x=”50″ y=”50″ width=”400″ height=”200″/>
<s:BitmapImage source=”{Harbor}” scaleY=”1″
alpha=”.4″
width=”{image.width}” height=”{image.height}”/>
</s:VGroup>

src: Flex 4 Fun p.no : 67

 
Leave a comment

Posted by on January 9, 2012 in Flex

 

Add Link in TextArea Flex/AIR

public function onLinkHandler(event:TextEvent):void{
Alert.show(event.text);
}

<mx:TextArea width=”300″ height=”100″ link=”onLinkHandler(event)” >
<mx:htmlText>
<![CDATA[

<u><a href='event:http://rajajinfo.wordpress.com'>Navigate to http://rajajinfo.wordpress.com.</a> </ u>

] ]>
</mx:htmlText>
</mx:TextArea>

src: cookbook

 
Leave a comment

Posted by on January 9, 2012 in Uncategorized

 

Without press ctrl key select multiple item on list based control ?

Extend list control

override protected function item_mouseDownHandler(event:MouseEvent):void
{
event.ctrlKey=true;
super.item_mouseDownHandler(event);
}

 
Leave a comment

Posted by on January 9, 2012 in Flex, Uncategorized

 

How to hide/disable copy/paste option in context menu on spark TextArea in Adobe AIR

Just try with this

protected function editor_rightMouseDownHandler(event:MouseEvent):void

{

if((editor.textDisplay as RichEditableText) != null && (editor.textDisplay as RichEditableText).contextMenu != null)

{

((editor.textDisplay as RichEditableText).contextMenu as ContextMenu).hideBuiltInItems();
((editor.textDisplay as RichEditableText).contextMenu as ContextMenu).clipboardMenu = false;
}

}
protected function editor_copyHandler(event:Event):void
{

event.preventDefault();
System.setClipboard(“”);
Clipboard.generalClipboard.clear();

}

 
Leave a comment

Posted by on January 9, 2012 in Basic Flex, Uncategorized

 

How to set scrollbar at left side for List component in Flex ?

1) protected override function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
{
	super.updateDisplayList( unscaledWidth, unscaledHeight );

	if( verticalScrollBar && verticalScrollBar.visible )
	{
		verticalScrollBar.x = -verticalScrollBar.width;
	}
}

2) [HostComponent("spark.components.List")]
<!--- The Scroller component to add scroll bars to the list. -->
	<!-- left/right values are adjusted here to prevent the rolloverColor/selectionColor from overlapping onto the border.  -->
	<s:Scroller left="4" top="10" right="4" bottom="10" id="scroller"
				minViewportInset="1" hasFocusableChildren="false" layoutDirection="rtl">
		<!--- @copy spark.components.SkinnableDataContainer#dataGroup -->
		<s:DataGroup id="dataGroup" itemRenderer="spark.skins.spark.DefaultItemRenderer" layoutDirection="ltr" >
			<s:layout>
				<!--- The default layout is vertical and measures at least for 5 rows.
				When switching to a different layout, HorizontalLayout for example,
				make sure to adjust the minWidth, minHeihgt sizes of the skin -->
				<s:VerticalLayout gap="0" horizontalAlign="contentJustify" requestedMinRowCount="5" />
			</s:layout>
		</s:DataGroup>
	</s:Scroller>
output:

List


			
 
Leave a comment

Posted by on August 12, 2011 in Flex

 

How to make auto centre main AIR Application window in AS3?

private function centreApp():void
{
var screenBounds:Rectangle = Screen.mainScreen.visibleBounds;
var w:int = width;
var h:int = height;

var x:int = screenBounds.x + ((screenBounds.width-w)/2);
var y:int = screenBounds.y + ((screenBounds.height-h)/2);
stage.nativeWindow.x = x;
stage.nativeWindow.y = y;
visible = true;
}
 
Leave a comment

Posted by on August 12, 2011 in Adobe AIR

 

How to disabling paste on spark TexInput ?

<s:TextInput
   change="if (event.operation is PasteOperation)
   (event.target as SkinnableTextBase).text = '' "
/>

It will also work with TextArea.
source : http://www.robertbak.com/
 
Leave a comment

Posted by on August 12, 2011 in Basic Flex, Flex

 

In Flex How to remove duplicates value in ArrayCollection ?

notebookAC.filterFunction = removeDuplicateNoteBookById
notebookAC.refresh();			

var tmpObjPage:Object = new Object();
private function removeDuplicatePageById(item:Object):Boolean
{
     if (!tmpObjPage.hasOwnProperty(item.page_id)) {
	tmpObjPage[item.page_id] = item;
	return true;
	}
	return false;
 }

private function removeDuplicatesValue(element:*,index:int,array:Array):Boolean
{
     return array.indexOf(element)== index;	//Tricks here
}
 
Leave a comment

Posted by on August 12, 2011 in Flex

 

Refresh ItemRenderer in Spark

1)myList.dataGroup.invalidateDisplayList();

2)myList.itemRenderer = null;
contentCollection = event.result as ArrayCollection;
myList.itemRenderer = new ClassFactory(HListRenderer);

3)myList.dataProvider = null;
pageTabBar.dataProvider = _modelLocator.pagesCollection;
 
Leave a comment

Posted by on August 12, 2011 in ItemRenderer

 

Chromeless Adobe AIR Window

1) <!– The type of system chrome to use (either “standard” or “none”). Optional. Default standard. –>
<systemChrome>none</systemChrome>
2)<!– Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. –>
<transparent>false</transparent>

3)<fx:Style>
@namespace s “library://ns.adobe.com/flex/spark”;
@namespace mx “library://ns.adobe.com/flex/mx”;

s|WindowedApplication
{
skinClass:ClassReference(“spark.skins.spark.SparkChromeWindowedApplicationSkin”);
}
</fx:Style>

 
Leave a comment

Posted by on May 23, 2011 in Uncategorized

 
 
Follow

Get every new post delivered to your Inbox.