The RatingBar in ANDROID
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 Create a pin-Joint on a body in Box2D iphone?
Here mybody is a body to which I am connecting a pinpoint. The pin joint is between the world and the body. So it will appear as hanging in the wall if the gravity is downwards. ‘The ground’ is the other body to which the my_body is connected. First you create a big ground body with 3 or… Read More »
How will you check whether you have touched a body in Box2D?
You can iterate through all bodies in the world and check whether you have touched a particular body. You can get all the userdata from the current body The userdata contains the width, height, sprite etc. Just Log the userdata in the current body to see all these. for (b2Body* b = world->GetBodyList(); b; b = b->GetNext()) {… Read More »
How to implement a bomb explosion in Box2D iphone?
How to check whether you have touched a body in Box2D iPhone?
How to shoot a bullet in the direction of touch in Box2D iphone?
How to rotate a body manually in Box2D?
The below code helps you to rotate a body in Box2D manually. Here the body is named “rotating_body” which is going to rotate and a sprite named “rot_sprite” is it’s userData, please give your own image for it. Make sure that you have it in your resources otherwise your program will crash. Note: call this function in a… Read More »
How to get the ANDROID SDK Version? How to get your Phone’s IP Address in ANDROID? Also how to get your phone number from the phone?
How to get the ANDROID SDK Version? How to get your Phone’s IP Address in ANDROID? Also how to get your phone number from the phone?
How to get the ANDROID SDK Version? How to get your Phone's IP Address in ANDROID? Also how to get your phone number from the phone?
How to use Webview in ANDROID together with javascript?
How to access a remote php file from ANDROID?
Detect when the ANDROID Screen Goes Off ?
This is the main Java file that extends activity. Create a file named ScreenON_OFF_ACTIVITY.java and place the below code in it. This is the class that extends the Broadcast receiver class that receives the notifications. create a java file and name it ScreenReceiver.java and place the following code in it. This the class that updates the service name… Read More »
How will you access the clipboard in an AIR application?
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 »