Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-11-2009, 06:28 PM   PM User | #1
soltrinox
New to the CF scene

 
Join Date: May 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
soltrinox is an unknown quantity at this point
Question Problem opening links from remote website

I have tried the example at :

http://livedocs.adobe.com/labs/air/1...st.html#method


Code:
<html>
    <head>
      <script src="AIRAliases.js" />
      <script>
function init() {
            var url = "http://www.mydomain.com/client.php";
            var request = new air.URLRequest(url);
            air.navigateToURL(request);
}

var addBridge = function(){
     document.getElementById('child').contentWindow.parentSandboxBridge = interfaceObject;
     window.runtime.trace('js bridge call');
}
</script>
    </head>
    <body onload='init()'>
<a href="#" id="child" onClick="clickButton();">link to open web browser</a>
    </body>
</html>

But i can not seem to make links in html loaded from remote domain in mx:HTML component open a default browser.

Has anyone done this?This code is running in the html of the remote page loaded inside of the following air application.


Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    showFlexChrome="false" showStatusBar="false" showGripper="true" showTitleBar="false"
    width="408" height="710" frameRate="45"
    horizontalScrollPolicy="off" verticalScrollPolicy="off"
    xmlns:chrome="com.xd.components.chrome.*"
    xmlns:sync="com.xd.components.sync.*"
    xmlns:controlbar="com.xd.components.controlbars.*"  viewSourceURL="srcview/index.html"
    applicationComplete="init()"
    >

    <mx:Style source="assets/dark_default.css" />
   
<mx:Script><![CDATA[
import flash.net.URLRequest;
       
public function clickButton():void{
var request : URLRequest = new URLRequest('http://www.mydomain.com/client.php');
navigateToURL(request )   
} 


private var testInterface:Object = new Object();

private function init():void
{
testInterface.clickButton = this.clickButton;
}

private function addBridgeObject():void
{
trace("Added bridge object");
html.domWindow.interfaceObject = testInterface;
}


]]></mx:Script>

    <!-- Application Custom Chrome -->
    <chrome:CustomChrome top="10" bottom="10" left="10" right="10" />
   
    <!-- ContentBackgroundArea -->
    <mx:VBox top="11" bottom="11" left="11" right="11" styleName="contentBackground" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
       
    </mx:VBox>
   
    <!-- ContentArea -->
    <mx:Canvas visible="true" top="66" bottom="34" left="11" right="11" styleName="contentArea" horizontalScrollPolicy="off" verticalScrollPolicy="auto" >
        <chrome:BorderHighlight top="0" bottom="0" left="0" right="0" />
        <mx:Button click="clickButton()" />
<mx:HTML id="html" location="http://www.mydomain.com/client.php" htmlDOMInitialize="addBridgeObject()" width="100%" height="100%"/>
    </mx:Canvas>

    <!-- Application ControlBar -->
   
    <!-- Application StatusBar -->
    <chrome:StatusBar bottom="11" left="11" right="11" />
   
</mx:WindowedApplication>
How can i get the links in the remote webpage to open the default system browser (firefox, IE, etc..) ?

I get the following error on line 7 of the loaded html page in the debugger.


TypeError: Undefined value


i think this means that the value is not defined? or cant access the function

air.URLRequest


Which is declared in the AIRAliases.js file for sure i checked.
also when clicking the hyper link in the page i get


ReferenceError: Can't find variable: clickButton


TIA,


soltrinox
soltrinox is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:29 AM.


Advertisement
Log in to turn off these ads.