Tag Archives: Adobe AIR
Load a webpage in Adobe AIR
This example shows how to load a webpage inside Adobe AIR, For this first you have to place an HTML control in your design for loading the html content. Create an page “index.html” inside the application directory of your current project and add some Html content to it. After that copy the following code to your source file.… Read More »
Using ButtonBar in Adobe AIR/FLEX, A simple Example
Hello………. A button Bar is a convenient way to place your buttons in an application. It saves a lots of space in your application interface. Take a look at the following example which shows how to use the ButtonBar. An itemClickEvent is attached to each button in the ButtonBar. You can place as many buttons inside a button… Read More »
Toggle between Full Screen and normal Screen in Adobe AIR or FLEX.
Hi all……… We often need to toggle between fullscreen and normal screen in our application. The following code snippet helps you to toggle between these two screens in Adobe AIR or Flex. Here I am using StageDisplayState class to do both which has “stage.displayState = StageDisplayState.FULL_SCREEN” and ” stage.displayState = StageDisplayState.NORMAL” constants to do this.
Programmatically change background in Adobe AIR/FLEX.
Create PopUp Window in Adobe AIR / FLEX, A simple Example.
Below code shows how to create a new popUp window in Adobe AIR or FLEX. To create a new window “right click on the src folder and create a new MXML Component named Here “MyLoginForm” It should be aTitleWindow for the example below. How ever You can create other components, but the code accordingly must change. import mx.managers.PopUpManager;… Read More »
FullScreen Event in Adobe AIR or FLEX
The following simple code snippet explains how to get an eventListener for FullScreen Event in Adobe AIR or FLEX. The function “onScreenModeChange ” gets called when you maximizes your window. private function init():void { stage.addEventListener( FullScreenEvent.FULL_SCREEN, onEnteringFullScreenMode); } private function onEnteringFullScreenMode( e:FullScreenEvent ):void { if( e.fullScreen ) { // Do something on fullscreen…………… } else { // Do… Read More »
How to remove an item in a row in Datagrid in Adobe AIR or FLEX?
Most often you may need to delete data from a datagrid in your application. The code below shows one of the ways in which you can delete the corresponding row in your application. Here I am placing a button in the datagrid for deleting and on its click I am getting the index of the datagrid, thus identifying… Read More »
How to dynamically add controls in Adobe AIR or Flex?
Below example shows how to add a label control dynamically in AIR or FLEX. var L : Label = new Label(); L.addEventListener(MouseEvent.CLICK,LabelListener); L.name = “my_label_name”; L.text = “my Text”; addChild(L); // This function listens to the mouse click in the above added label. private function LabelListener(event:MouseEvent):void { } Please note that you can add any control by this… Read More »
Access a remote database from Adobe AIR or FLEX.
Access a remote database from Adobe AIR or FLEX. Many often you need to access online database from your application. For doing it in Adobe AIR of FLEX you need HttpService. The following example shows how to access an online database from an AIR Application. Note that you cannot return an array from a remote file or database,… Read More »
Crop an Image in Adobe AIR or Flex.
Below code shows how to crop an image in Adobe AIR. Change the mx:WindowedApplication to mx: Application to run it as a FLEX Application. The code uses copyPixels to extract the desired part from the image file. The important line in the below code crops the image. cropBD.copyPixels(loadBD, new Rectangle(startPoint.x, startPoint.y, squareSize, squareSize),posPoint);
Using StyleManager in Adobe AIR and FLEX.
Dynamically change the background of a window in Adobe AIR?
Pass a variable from one window to another in Adobe AIR?
We often need to access another window variable in the current window. The following example shows how to access a variable from one window in the next window. The logic is to create an object of next window in the current window and assign the value of variable in the current window itself so that it becomes available… Read More »
Create a polygon in Flash or Adobe AIR using Box2D.
The below function creates a polygon in the shape of a triangle. Please call the debugdraw function inside your update method to view the results. Make sure you import the Box2D classes into your file. public function init():void { debug_draw(); addEventListener(Event.ENTER_FRAME, update); createTriangle(); } public function createTriangle():void { var fd : b2FixtureDef = new b2FixtureDef(); var initVel :… Read More »
How to Implement Box2D in Adobe AIR?
Everyone will be fascinated how flash games are built on the web that implements the real world physics. Well for your information there are a lot of physics engines available. One of them is the Box2D. Box2D was written in C++. Then it was converted to flash. So now I am going to show you how to build… Read More »
How to read and write an XML file in Adobe AIR or Flex?
Add Context menu in Adobe AIR or FLEX.
This sample shows how to add a menu to your context menu or the right click of your menu in Adobe AIR. AIR Uses the ContextMenu class to add menu to your mouse right click. import flash.events.ContextMenuEvent; import mx.controls.Alert; // call this function to create context menu in AIR and FLex private function createContextMenu():void { var myContextMenu:ContextMenu =… Read More »