O'Reilly logo

Developing BlackBerry Tablet Applications with Flex 4.5 by Rich Tretola

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. OS Interactions

Open in Browser

From within your application, you can open a link using the device’s native browser, just like with a traditional, browser-based Flex application. The URLRequest class accomplishes this. The URLRequest class accomplishes this. Let’s take a look at the following code. Simply creating a new URLRequest and passing it 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="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+= address.text;
                navigateToURL(new URLRequest(s));

            }
        ]]>
    </fx:Script>

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

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

Splash Screen

Adobe has made it very easy to add a splash screen to your application. A splash screen is an image that loads first and displays while the application is loading. There are also several options for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required