Blograby

Place Call

The URLRequest class can be used to open the Phone application to place a call. By prepending the request with tel:, you will tell Android to launch the Phone application when the navigateToURL method is called. Figure 6-8 shows the sample application running and Figure 6-9 shows the Phone application with the phone number pre-populated:

<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”>
<fx:Script>
<![CDATA[
protectedfunction sendIt_clickHandler(event:MouseEvent):void
{
var s:String = “”;
s += “tel:”;
s+= call.text;
navigateToURL(new URLRequest(s));
}
]]>
</fx:Script>
<fx:Declarations>
<!– Place non-visual elements (e.g., services, value objects) here –>
</fx:Declarations>
<s:Label text=”Phone #” top=”40″ left=”50″/>
<s:TextInput id=”call” top=”30″ left=”160″ text=”2125559999″ width=”250″/>
<s:Button id=”sendIt” label=”Send” click=”sendIt_clickHandler(event)” top=”110″
left=”160″/>
</s:Application>

Exit mobile version