Monday, December 29, 2008

Monitoring System Idle State in AIR


Please look this code:

NativeApplication.nativeApplication.idleThreshold = 120;

NativeApplication.nativeApplication.addEventListener(Event.USER_IDLE, idlefunction(event:Event) {trace("Idle");} );

NativeApplication.nativeApplication.addEventListener(Event.USER_PRESENT, presentfunction(event:Event) { trace("Present");} );


Note:
Using the idleThreshold property, the specified interval( in seconds) are set, The system is reaching the idle state, upto specified seconds, Event.USER_IDLE is fired and any interrupt to the system (keyboard, mouse or input devices) is done, Event.USER_PRESENT is fired. Its very helpful to screen saver samples.

Finding Screen Resolutions in AIR

Using the capabilities , we can find the current screen resolutions ,As per the simple code, listed below :


desktopWidth = Capabilities.screenResolutionX;


desktopheight = Capabilities.screenResolutionY;




The screenResolutionX is defines the screen width and screenResolutionY is defines the screen height.

Wednesday, December 17, 2008

Skinning for Horizontal & Vertical Scroll Bars

The belowed code shows the skinning effects for both horizontal and vertical scrollbars.

.scrollskin
{
upArrowUpSkin: Embed("../assets/Up_Arrow.png");
upArrowOverSkin: Embed("../assets/Up_Arrow.png");
upArrowDownSkin: Embed("../assets/Up_Arrow.png");
downArrowDownSkin: Embed("../assets/Down_Arrow.png");
downArrowUpSkin: Embed("../assets/Down_Arrow.png");
downArrowOverSkin: Embed("../assets/Down_Arrow.png");
trackSkin: Embed("../assets/Bar.png");
thumbUpSkin:Embed("../assets/Scroll.png");
thumbDownSkin:Embed("../assets/Scroll.png");
thumbOverSkin :Embed("../assets/Scroll.png");
}