I'm having a hell of a time trying to call JavaScript from an AIR application. Here's what I'm trying to do:
1. Load an HTML page using HTMLLoader.
2. Access a link by its ID in the HTMLLoader object and simulate the JavaScript click() function on that link.
Here's the JavaScript function in the loaded HTML page (it simply submits a form on the page):
Code:
function submitAssistantForm(direction)
{
document.theForm.direction.value=direction;
document.theForm.submit();
return;
}
And here's the ActionScript code I'm trying:
Code:
var html:HTMLLoader = new HTMLLoader();
html.addEventListener(Event.COMPLETE, splash);
html.load(new URLRequest("...URL omitted..."));
[code]....
By the way, if I add the HTMLLoader object to the stage and manually click the link with my mouse, everything works perfectly. So I have to believe it's possible to programmatically send a click event to the link.
I get the alert but I can't get the lightbox window to display. When my as code makes the ExternalInterface call I get what looks like a page refresh and a blank browser window.
I'd like to call a javascript function from an embedded .swf file. Specifically, I'd like to call a function in one of my externally linked javascript files from within: function loadTrack(){
[Code]...
which is in an .as file which I assume somehow becomes the swf file. How would I go about this and 're-compile' the .as file?
I have a flash file that contains a package "game" which has a class "Scores" and a method setValue(). I want to write some lines of Javascript that allow me to call that method. Someone directed me to this tutorial, but I am still a bit confused.
Javascript: alert("start"); var so; so = document.embeds[0]; so.addParam("allowScriptAccess","always"); import flash.external.ExternalInterface; ExternalInterface.call("setValue[2600]");
displays an alert to tell me that it has indeed began to execute saves the embedded flash file into a variable and sets access imports that class calls the method.I am not sure about how this class thing works? This is just the bits and pieces I was able to come up with from that site, but I don't really understand how it all works (but certainly hope to eventually).This is the site: http:[url]...how-do-i-access-flash-function-using-javascript.When I execute the code with the importation nothing happens, but the alert does come up when I don't have that statement?
JS-to-AS3 callbacks work in kinda asynchronous way right? So for example if I ask SWF to download some file, which may take some time (depending on the size of that file), and while it downloads it, ask it to do some other operation (suppose SWF has several callbacks for various purposes), what happens in this case? Does SWF continue to download file and handle my second request in a different thread maybe, or it crashes, or throws some error? I know this is a good case for some testing, but I wonder if anyone has already done that, or maybe there is public info on the case that I cannot find?
I'm trying to call a php script/page that has some javascript calls in it, from AS3. I'm using the regular
var varSend:URLRequest=new URLRequest("http://my_www/script.php"); varSend.method=URLRequestMethod.POST;(...)
My php page has some javascript. The php passes some variables obtained in POST to my JS script, which connect to a 3rd party app. Now my problem is, i can call the script from AS3 without any problem, but when i do so, it seems like the JS is never running. My question is, if you call a php script/page in POST from flash, is the JS embed in that page running ??
Included is an example to look at for those willing to help. I have just extracted the relevant sections from the original source files. The html files are commented as well for ease of reference.I have a flash/AS3 slideshow that serves as an abstract for a html based site. There is a catch however... I use a custom content scroller and dynamic content loader (javascript & jQuery) for the body of the site.An example of the custom scroller and dynamic conten loader can be seen on the Malihu wbsite with a demo.The Javascript code that loads the new content looks like this:[code]The button (its a list item) in the html fie that would trigger the custom content loading looks like this:[code]"The ".content" class div is the section im swopping around depending on which link the user clicks. In the case above i dynamically load the contents of the ".content" div from the about.html file into the ".content" div in the index.html file (which is my main file).Is there a way to do the same from Flash?
I'm doing a Security Project now. And this project needs to intercept javascript call from Flash and do analysis. I've searched the web for a couple of days but still can't find any solution. Flash can use getURL, externalInterface.call to execute javascript code, and I want to stop the malicious calls from Flash. Thus, I need to intercept these javascript calls.
Is there any way to call MouseEvent function in as3 from JavaScript?I have HTML button and swf object, I need to sent a POST request from swf by clicking on HTML button.
I am using ExtrernalInterface.call(javascript_function, args); to call javascript functions from Flex. But this fails in case of browsers that have javascript disabled. Is there any other way to call javascript functions from flex?
I am trying to call the browse() method of the FileReference class from JavaScript (a user clicks on a text that uses the ExternalInterface to call a method in Flash).Unfortunately, I receive an error that tells me it has to be a direct action of the user (like clicking a button). I have searched through Google and realized this is a new security feature in Flash 10.The only solutions I could find was to put a Flash button or to have a hidden flash button over the text, that will call the browse() method.I wanted the browser only to show JavaScript and all the Flash code only called from JavaScript.
I want to display a Flash video in a popup window, and when the video has finished playing, close the window using a javascript function "closeIt":
<script> function closeIt() { alert("About to close...");
[code]....
How can I achieve this? I have imported a video into Flash (choosing "load external video with playback component"). This is in frame1. I thought that in the second frame I could make a call to ExternalInterface.call("closeIt") in the Actions window. I have tried this, but when I publish and view the flash movie in a web brower, I never see the javascript alert.
I have an ActionScript program that I want to access some external JavaScript functions. By external, I mean that the ActionScript/swf aren't going to be loaded via the HTML/JavaScript. Everything I see recommends ExternalInterface, but that seems to imply that your JS loads your swf. Is there a way to call a JavaScript function by URL?
I have a couple of buttons in my flash application that call two different javascript functions. They work in all browsers except IE9 (I haven't tried earlier IEs). My code to call the function is something like this:
I found out about this amazing site: [URL] it/ and,how this website was done. I really don't like flash websites and the main reason is when you want to send a friend a specific page you can't as it's all the one URL. but I like the style of flash.
how to put some kind of onClick listener on a movie clip within an swf. When it is clicked, it calls a JavaScript function within the html document. I am creating an image galery, I just want to creat the thumb viewer in flash and have everything else working through javascript and html.
I'm trying to do something really simple. I just want to be able to click a button in my flash and have it call a javascript function called "showAlert" but I can't seem to get it to work.
My html:
Code: Select all<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>
Can a SWF file, viewed locally in a folder on my PC, make a call to a function in a JavaScript file?I am facing a project where the technical architect is prescribing that all content exist in an all-in-one, giant JavaScript file. With my usual external content experience working with XML, I have always been able to load in XML into the SWF directly (for example, while viewing the SWF in the Flash authoring environment - a very speedy way to view your SWF), as well as when the SWF is actually viewed in the website. However, with the JavaScript approach, my only experience tells me that the SWF has to be embedded in HTML before it has access to the JS functions.