PDA

View Full Version : Integrating Flex, HTML, Javascript in AIR


glidealong
02-07-2008, 04:48 PM
Hello all,
I am not sure if my post fits a flex forum. but then if it doesn't fit here it wont fit any place either.
I am working on an AIR application which integrates works of different people in our team. The different types of work consits of HTML pages, javascript code, flex movies(swf). There are two things in which I am stuck.
1. I want to embed my swf into the html page and invoke certain methods registered with ExternalInterface.adCallback api. I tried the normal <object> and <embed> tags and the script method to put the swf into the html. I can' detect the swf object to invoke the method callbacks.
2.This is a bit more confusing. I'll try to explain myself clear. I build an AIR application by importing a flex application as an swc, into an AIR project using flex builder. Once my swf is ready in the bin folder i take this swf into my master air project in aptana, since i want a combination of html,javascript,swf in the final application. But the issue is that i cannot see the component i imported into the air application in flex builder. But if i embed an swf movie created as a flex project, it works fine.
Is there anything wrong in my work flow? . it seems i am over engineering things. but i dont see any other obvious way of getting what i want.

Thanks in advance

Added: Thank you for moving the post to the appropriate forum. i missed this forum in the first place.

glidealong
02-13-2008, 07:56 AM
OK.. let me put it a bit more simpler.
Does anybody know a way to embed an air application created using flex builder (swf output) into an air application created using AJAX/HTML in Aptana.?

The first issue has been solved. I had to remove the AC_FL_RunContent() method added by dreamweaver and use the following javascript method to access the swf object. That's it.

function getFlashMovie(movieName) {
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}
}