I have an AIR Application which uses the mx:HTML tag to load a webpage hosted by me.
In my webpage, I want to invoke a function in the containing AIR application via javascript?
Is this possible?
eg:
in my AIR application:
public function goBack():void{
trace('invoked from javascript!');
}
<mx:HTML id="coreHtml" width="100%" height="100%" backgroundAlpha="0" location="http://mydomain.com/myhtmlpage.html" />
Then in myhtmlpage.html
function callActionscript(){
asfunction.goBack();
}
With this setup I get the following error:
ReferenceError: Can't find variable: goBack
If i change my function to:
function callActionscript(){
asfunction.parent.goBack();
}
I get the following error:
TypeError: Value undefined does not allow function calls.
Update:
If I change the function to:
function callActionscript(){
asfunction.goBack;
}
I get the following error:
ReferenceError: Can't find variable: goBack
Now if I put a hyperlink on in myhtmlpage.html:
<a href="asfunction:goBack">test</a>
I get the following error:
*Error: SECURITY_ERR: DOM Exception 18*