Array

Writing the Code

Must Read

Private Student Loans For College – Credit and Cosigner Requirements

Today, the cost of obtaining a quality education increases each year. This can leave families struggling to pay their...

Nikon D7000, The ISO Sensitivity Auto Control Trick

There is a very cool trick that can get you the best of both worlds and that won’t sacrifice...

Canon PowerShot G12, Stop Right There!

Shutter speed is the main tool in the photographer’s arsenal for capturing great action shots. The ability to freeze...

Student Loan Consolidation – Why Not?

You hear commercials about consolidation loans all the time on the radio and see them on TV. These are...

Re-Financing with a Line of Credit Loan

Some homeowners might consider re-financing with a home equity line of credit as opposed to a traditional loan. There...

The Best Fast College Loans

Going to school should be available to everyone but with the mere cost of living going through the roof...
Admin
test

For this exercise, we will draw three clickable sprites: one to make a phone call, one to send a text message, and one to send an email. Figure 2-2 shows our application and three native applications launched upon interactivity.
our application with three buttons

An AIR application cannot call, send a text message, or send an email directly, but it can invoke the native applications dedicated to these tasks and pass arguments such as the phone number or email address.

The URI scheme is a way to include small data items inline. AIR passes the argument to the Android system according to the official tel, sms, and email URI schemes. If the argument contains invalid characters or spaces, the command will be ignored. Valid characters are digits, dots, and the plus sign (+). Android currently does not support multiple numbers or a body argument for a text message, but it does support multiple emails and a body argument for an email.

If more than one application has a custom URI, the choices are represented in a menu. This is the case with mailto, as demonstrated in Figure 2-2, with both native email and Gmail applications.

Note that a mouse event works on a multitouch device as though it were a single-touch device.

Using Flash Professional

If you are using Flash Professional, add the following code to the Document class named Main, created earlier:

package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
public class Main extends Sprite {
public function Main() {
// create the three sprites and their listeners
var callButton:Sprite = createSprite(0xFF3300, 140, 150);
callButton.addEventListener(MouseEvent.CLICK, callMe);
addChild(callButton);
var textButton:Sprite = createSprite(0x0099FF, 140, 350);
textButton.addEventListener(MouseEvent.CLICK, textMe);
addChild(textButton);
var mailButton:Sprite = createSprite(0x00FF11, 140, 550);
mailButton.addEventListener(MouseEvent.CLICK, mailMe);
addChild(mailButton);
}
function createSprite(hue:int, xPos:int, yPos:int):Sprite {
var temp:Sprite = new Sprite();
temp.graphics.beginFill(hue, 1);
temp.graphics.drawRect(0, 0, 200, 100);
temp.graphics.endFill();
temp.x = xPos;
temp.y = yPos;
return temp;
}
function callMe(event:MouseEvent):void {
trace(“calling”);
navigateToURL(new URLRequest(‘tel:18005551212’));
}
function textMe(event:MouseEvent):void {
trace(“texting”);
navigateToURL(new URLRequest(‘sms:18005551212’));
}
function mailMe(event:MouseEvent):void {
trace(“emailing”);
navigateToURL(new URLRequest
(‘mailto:[email protected]?subject=Hello&body=World’));
}
}
}

Select Control→Test Movie→Test to compile the application. You should always run your code on the desktop before installing it on a device in case you have syntax errors.

Using Flash Builder

The code is the same.

Select the small black arrow to the right of the Run button, and then select Run Configurations. Under Mobile Application, select Main if it is not selected. The “Target platform” should be Google Android. Under “Launch method”, select “On desktop” and choose your device from the pull-down menu. Click Run to compile and create the mobile application. If you don’t see your device listed, you can add it manually.

For Windows users, if you see the name of your device in the list, it indicates that the necessary drivers are preinstalled. Otherwise, make sure to install them.

 

 

 

Latest News

Digital Marketing for Beginners

Digital marketing for starter, Let to basic learning about connecting with your audience in the right place at the...

What are 7 things poor people do that the rich don’t?

1. poor people watch TV in which people read books how many hours you spend in front of the TV and when was the...

Top 18 best small business ideas for beginners starting

A small business can be frightening and requires plenty of careful planning there are many small business ideas which can be beneficial as well...

Summer that makes you happy

We saw were already here I've been thinking about some of the things. I used to do with my husband even though he had...

4 Point to helpful tips specifically for caregivers

What you need to take a vacation. I know it sounds impossible creative and try to make it work for you almost everyone needs...

More Articles Like This