Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6. OS Interactions > Create Text Message

6.2. Create Text Message

The URLRequest class can be used to open the Messages application to send text messages. By prepending the request with sms:, iOS will launch the Messages application when the navigateToURL method is called. Figure 6-2 shows the sample application running and Figure 6-3 shows the Messages application with the phone number prepopulated. Unfortunately, at this time it is not possible to send a message along with the phone number when opening the Messages application:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:s="library://ns.adobe.com/flex/spark">

    <fx:Script>
          <![CDATA[
               protected function sendIt_clickHandler(event:MouseEvent):void
               {
                     var s:String = "";
                     s += "sms:";
                     s+= sendTo.text;
                     navigateToURL(new URLRequest(s));

               }
          ]]>
    </fx:Script>

    <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <s:Label text="Send To" top="40" left="50"/>
    <s:TextInput id="sendTo" top="30" left="110" text="2125559999" width="200"/>
    <s:Button id="sendIt" label="Send" click="sendIt_clickHandler(event)" top="110" left="110"/>
</s:Application>

					  


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial