Create Email

The URLRequest class can be used to open the Messaging application to send text messages. By prepending the request with mailto:, you will tell Android to launch the Email application when the navigateToURL method is called. There are several properties that can be passed into the URLRequest to set the “send to” email address, the email subject, and the email message.

Figure 6-5 shows the sample application running, Figure 6-6 shows the email selection window being launched after the Send button has been clicked, and Figure 6-7 shows the properties being pre-populated in the Gmail application:

<?xml version=”1.0″ encoding=”utf-8″?>
<s:Application xmlns:fx=”″
protectedfunction sendIt_clickHandler(event:MouseEvent):void
vars:String = “”;
s += “mailto:”;
s+= sendTo.text;
s+= “?”;
s+= “subject=”;
s+= subject.text;
s+= “&”;
s+= “body=”;
s+= message.text;
navigateToURL(new URLRequest(s));
<!– Place non-visual elements (e.g., services, value objects) here –>
<s:Label text=”Send To” top=”40″ left=”50″/>
<s:TextInput id=”sendTo” top=”30″ left=”160″ text=”[email protected]
<s:Label text=”Subject” top=”100″ left=”50″/>
<s:TextInput id=”subject” top=”90″ left=”160″ text=”hello” width=”250″/>
<s:Label text=”Message” top=”160″ left=”50″/>
<s:TextInput id=”message” top=”150″ left=”160″ width=”250″/>
<s:Button id=”sendIt” label=”Send” click=”sendIt_clickHandler(event)” top=”210″

A sample Email application

The email selector after clicking Send

Message properties set within Gmail