1
votes

I have a windowed Flex application (AIR) that uses an HTML file for the UI, but I have some Flex code that needs to be executed when the page is loaded.

I have imported the HTML interface into the app using the < mx:HTML /> tag. The Adobe help at http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_5.html shows a way to communicate between javascript and flex, but only if you are using an external HTML file in a browser, and not in a windowed app.

So my question is this: how do I make a call to a flex method from javascript that will return data in a windowed/AIR app?

Any help will be appreciated as I am very new to flex/flash.

2

2 Answers

1
votes

It should also work in windowed app. Using ExternalInterface

Flex -> js

ExternalInterface.call("jsFunction", {par:value});

js -> Flex

flashObject = document.getElementById(flashid);

if( flashObject ) {
    flashObject.flexMethod("par");
} else {
    alert('Error! could not get flash object');
}

http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_4.html

1
votes

What you need to be looking at is the documentation for the HTMLLoader Class, such as this http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7ed4.html .