Chapter 6. OS Interactions

Open in Browser

From within your application, you can open a link using the device’s native browser in the same way you can within a traditional browser-based Flex application. This is accomplished with the URLRequest class. Simply creating a new URLRequest and passing this into the navigateToURL method will invoke the user’s browser to handle the request. Figure 6-1 shows the sample application running:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx=""

               protected function sendIt_clickHandler(event:MouseEvent):void
                     var s:String = "";
                     s+= address.text;
                     navigateToURL(new URLRequest(s));


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

    <s:Label text="URL" top="40" left="50"/>
    <s:TextInput id="address" top="30" left="160" text="" width="400"/>
    <s:Button id="sendIt" label="Open" click="sendIt_clickHandler(event)" top="110" left="160"/>
Open a link in a browser
Figure 6-1. Open a link in a browser

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 ...

Get Developing iOS Applications with Flex 4.5 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.