header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Mac
Points:0
Posts:0

6/19/2010 11:02:56 PM

Title: Call ActionScript function from JavaScript


I am in an AIR application.
htmltext poperty only works in Flex.

I have an HTML control with id as "html" and an HTML page is loaded inside it.
I want to invoke an ActioScript function inside my AIR application from the javascript inside that HTML page
(eg : If I have a button inside HTML page when I click on it it should invoke an AS function inside the mx:Script).
PLease provide an example using the HTML control inside AIR
PLease anyone Help



1
Andrid
Points: 720
Posts:0
6/20/2010 7:05:25 AM



The loaded URL in HTML control for Adobe AIR can be of any domain , so its security restriction to not allow the execution of java script to access the flex and vice verse. i.e you can load a yahoo page and execute there java script inside there page to do something and this would be security breach.


2
Jaguar
Points: 0
Posts:0
6/20/2010 9:40:38 AM



you can capture the link click of html inside HTML component Adobe AIR and attach a listener to it in the actionscript. See this example to capture link click in HTML component AIR in actionscript:

// your html link inside Adobe AIR html component
    html.data = 'Go to <a href="mySite.com" id="myLinkID">This is a link</a>';

// actionscript code in adobe air application

var linkRef:Object = html.htmlLoader.window.document.getElementById("myLinkID");
if (linkRef!=null){
linkRef.addEventListener("click", LinkClickHandler);
}

//link click handler function
private function LinkClickHandler(obj:Object):void {
trace("myLinkID link is clicked in ")
}



Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 5+6 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions