Tag Archives: function
How to bind variables in Angular JS using ng-bind?
What is ng-model in Angular JS and How to use it?
What are Angular JS modules? – A Simple Demo
Angular JS modules means : An AngularJS module defines an application. The module is a container for the different parts of an application like controller, services, filters, directives etc. The module is a container for the application controllers. Controllers always belong to a module. Example Here we have a module named “MyApp” and controller for this module is… Read More »
Creating Dynamic table rows and colums in JQuery and removing it one by one.
Hi all… Apart from Android, I am now going to post something in jquery. In this post I will be showing how to create a dynamic table in jquery and adding data to it using objects and also deleting each row with a remove button in the corresponding row. This is how it is done. At first you… Read More »
How to crop an Image in Android?
This is a sample program that launches the camera and crop the captured image. Check this link to another crop image example. http://www.coderzheaven.com/2011/03/15/crop-an-image-in-android/ This is the layout xml. activity_main.xml Now this is the Main Java File that implements the crop functionality. Here we are using the “com.android.camera.action.CROP” Intent to crop the Image passing the captured Image URI to… Read More »
How to add sprite to a body in Box2D in Adobe AIR, FLEX and FLASH? Or Add image/Sprite to a body in ActionScript.
How to drag and drop a file from outside to your flex or AIR application and render it correctly?
Actually we have to do this by registering your application with the eventlisteners for NATIVE_DRAG_ENTER and NATIVE_DRAG_DROP. The following code shows how to do this. Just copy and paste the code to your MXML file and see the result. Drag and drop an image file from outside to your AIR application. import mx.controls.Alert; import mx.controls.Image; import flash.filesystem.File; private… Read More »
Creating Menu in Iphone Cocos2D or Box2D?
Use CCMenuItemSprite and CCMenu in iPhone to create menu. call this function to set up the menu for your home page in your iPhone game or you can change this code directly to ANDROID and it will work. Make sure you have all the images mentioned in the above example. This menu will appear on the centre of… Read More »
Creating Menu in Iphone Cocos2D or Box2D?
Use CCMenuItemSprite and CCMenu in iPhone to create menu. call this function to set up the menu for your home page in your iPhone game or you can change this code directly to ANDROID and it will work. Make sure you have all the images mentioned in the above example. This menu will appear on the centre of… Read More »
Creating Menu in Iphone Cocos2D or Box2D?
Use CCMenuItemSprite and CCMenu in iPhone to create menu. call this function to set up the menu for your home page in your iPhone game or you can change this code directly to ANDROID and it will work. Make sure you have all the images mentioned in the above example. This menu will appear on the centre of… Read More »
Creating Menu in Iphone Cocos2D or Box2D?
Use CCMenuItemSprite and CCMenu in iPhone to create menu. call this function to set up the menu for your home page in your iPhone game or you can change this code directly to ANDROID and it will work. Make sure you have all the images mentioned in the above example. This menu will appear on the centre of… Read More »
Trim a string in Javascript.
Listening to keyBoard in Adobe AIR/FLEX….
Hi all…. We all need to know which key is pressed in an application up on which we may need to take an action. For example if the user presses “Ctrl + s” we know he want to save. So for that we need to listen to keyBoard events. For this we use the keyBoard event Listener. First… Read More »
How to check whether an application is installed in your ANDROID Phone?
This sample code comes handy when you have to check that an application is already installed in your ANDROID Phone. Call the below function appInstalledOrNot() with the package name of the app installed on the ANDROID Device as a string parameter. This function returns true if the app is installed otherwise returns false.
Get a file from PhotoGallery and copy it to your directory in your project resources in Titanium(iPhone or ANDROID).
This example opens the photogallery and then when you select a file from it , it will be copied to your resources directory. First manually create a directory in your resources, here the directory is named “mydirectory”. Call this functiion inside a button click or something Now after running this code check the directory you have created. If… Read More »
ToolTip Sound in Adobe AIR/FLEX…
Sometimes we may need to have a sound when we hover over something, i.e when a tooltip appears. Actually this can be done easily by adding an eventListener to the corresponding control. Take a look at the example. This line is the important line. myLabel.addEventListener(ToolTipEvent.TOOL_TIP_SHOW, myListener); The function myListener gets called when we hover over the label thus… Read More »
Encapsulation Using Properties in C#.NET / ASP.NET
Hi, Let’s see how encapsulation can be implemented using properties in C#.NET/ASP.NET. Let’s see the code first. using System; public class Student { private int stud_id = -1; public int ID { get { return stud_id; } set { stud_id = value; } } private string stud_name = string.Empty; public string Name { get { return stud_name; }… Read More »
How to Disable Right Click on HTML page using jQuery ?
Hi, In some special cases you may need to disable the Right Click option on HTML page you are using. An easy way to do it using jQuery is follows. Use the following code in the HTML page where you want to disable Right Click. $(document).ready(function(){ $(document).bind(“contextmenu”,function(e){ return false; }); }); 🙂
Remove unwanted memory from iPhone….
Hi all …… You know iPhone doesnot have garbage collection like ANDROID. So it becomes the responsibility of the developer or programmer to release the resources and remove the unwanted textures from your memory. If you don’t remove the unused textures and other variables from your memory your application will exit after a while. You often have the… Read More »
Play an MP3 in Adobe AIR/FLEX
Often in out applications we need to play sounds , so this code explains how to play, stop and resume an mp3 sound in Adobe AIR/FLEX. What you have to do is to copy the following code and place it inside your “mx:Script” tag. After that place three buttons for play, pause and stop and connect it to… Read More »
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 »
Client Side Form Validation – using JavaScript
Hi, JavaScript is mainly used for client side scripting. In client side scripting one of the thing which we are usually in need is Validation of Forms. We want to know the user , who is interacting with the form have already given the necessary details before submitting or saving etc. Here is a simple form validation example… 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 »
How to load a URL in Objective C or Cocoa in iPhone?/ Open Safari in Objective C
This code snippet helps you to open a webpage in Safari. Code uses openURL to load the webpage in the web browser. Write this function as an action to a button……… – ( IBAction ) loadWebPageInSafari : ( id ) sender { NSURL *my_URL = [NSURL URLWithString:[Your_URL stringValue]]; if ( [ [NSWorkspace sharedWorkspace] openURL : my_URL ] ){… Read More »