Reputation:
I am trying to use the embedded webkit in AIR to write a little browser with HTML+Javascript.
I am so displaying the page at the URL typed by the user in an iframe.
From there, I would like to:
For 1), I know that's forbidden in a browser for security. However, I would guess that this should be possible in an AIR app', may be by asking the user permission (like with Gecko in Firefox).
Does anyone know how to do 1) ? Is there an event or something to do 2) ?
Thanks for your help,
J.
Upvotes: 1
Views: 4919
Reputation:
Dirk,
What can I do without you;) Are you working for Adobe or something?
I don't have (yet) FB, just using plain basic compiler mxmlc. I did not know that HTMLLoader were working just for AIR!! ;) Using amxmlc compiled it smoothly...
So I am moving on...
By the way the External Interface is to be able to load pages in my frame from my "main" javascript (I am more fluent in JS than in AS3 so want to minimize AS3).
Now, I will add the other way: be able to call a function in my main JS from a function in AS3, dealing with the "COMPLETE" event on the HTMLLoader and passing to JS the string of the HTML I want to read with jQuery.
Upvotes: 0
Reputation: 111130
Since Julien sounds like he'll sue me, I'll reply ;)
So, you are not using Flex Builder? If you are, it'll show you the little red dots on your right. Flex Builder is cranky at times, and it helps to close and reopen the solution. And in extreme cases the IDE itself and reloading the project. BTW: did you create a Desktop (AIR) application? HTMLLoader is there for AIR only.
If you are not using the Flex Builder IDE, I suggest you go through this link. It is recommended by Adobe (here).
Your code compiles absolutely fine on my end. However, what confuses me is what you are trying to achieve with ExternalInterface.
Upvotes: 2
Reputation: 111130
To access the content of the frame
Assuming you have an id ifrm
for the iframe:
var html:HTMLLoader = new HTMLLoader();
// ...
// in the `complete` event handler
trace(html.window.document.getElementById("ifrm").innerHTML); // content
be alerted when the user clicked into the frame
If you can have a javascript event handler to catch modifications to your iframe sub-element, you can call your AS function/event-handler.
You will want to read this :)
Upvotes: 1