I'm trying to call a method inside a flash movie from js, every time the mouse leaves the "div". It works on Internet Explorer, but not in firefox. Here is the html script:
Here is example of the problem, there is an alert for the js and the flash should be able to remove the swf (see a gray background? it works! see a image, flash didn't receive the call): [URL]. This should work with internet explorer / safari / chrome (pc/mac) only firefox seams to reject this.
I have never posted to this forum before but I am about to pull my hair outI've created a page that used External Interface before with no problems and I can't figure out what makes this one different. It works fine on both Firefox and Safari on a Mac. On a pc, however, the Flash has no problem calling JavaScript functions but the JavaScript can't call the ActionScript function. It doesn't matter if I try Firefox, IE7 or IE6. The error IE gives is that the object doesn't support the property or method.ere is the AS:
Code: this.createEmptyMovieClip("samplework_mc", 999); function loadWork(workname:String):Void {
In my Flex app, I need a Javascript control to call one of my Actionscript methods. Simple enough, according to the Flex/Actionscript documentation, I wrote this in my Actionscript code:
if (ExternalInterface.available) ExternalInterface.addCallback("setName", setNameInActiveWindow); In the Javascript control I wrote: document.getElementById('FlexAppId').setName(name);
Works great. Exactly as expected, so I went to production. But it doesn't work in production :(. Same exact code... I can't figure it out. The above Javascript code is run, but the callback is not executed in the Actionscript code.
I've got a very basic test file that just fires a Javascript function with an alert() in it (i.e. alert("You clicked a button."). In IE this works just fine, but in Firefox it wasn't doing a thing. I finally realised it might be SWFObject, so I published the HTML file straight from Flash and all of sudden my ExternalInterface call works perfectly in Firefox as well.
Here's my SWFObject embed code: PHP Code: <script type="text/javascript">var params = {}; var flashvars = {}; var attributes = {id:"testTool", name:"testTool"} params.allowscriptaccess = "always"; params.bgcolor = "#B0E3DE"; [Code] .....
I've been googling this for about 4 hours and there are lots of mentions of the SWFObject requiring an ID attribute for addCallBack calls (hence the attributes object), and I've been through a whole bunch of posts in various forums but can't pinpoint a single solution for ExternalInterface.call() not working with SWFObject in Firefox.
I have been trying to get this working for a while now and am at the end of any ideas or samples.In 2.0 it was setVariables and was not problem.But now I'm trying to get ExternalInterface.addCallback to work and just can't seem to get it to work.Just want to send a variable from javascript to actionscript class.Ok, here is the javascript:
Code: function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName];[code]....
I have been trying to get this to work but with no luck.It's in a .Net aspx page. Even stripped the page of everything but this with no luck. And no master page either or ajax.
This is so frustrating...I'm going to do my best to be concise here, so forgive me if I leave too much out.I'm also going to try to simplify so I don't get bogged in details. I have a set of html pages that guide you through a tutorial. The different pages are REALLY just one big page that has divs hide and unhide as you go through the flow via previous and next buttons.
There are 4 pages which play a video clip. Each video clip .swf contains an FLVPlayback component that plays an .flv, and uses an .swf skin file. All these things play fine. If you're watching a video and you click "NEXT" the sound is still playing because of course you're still on the same page. So we looked into it and found out about the whole ExternalInterface.addCallback thing.
This code works perfectly with Chrome, Firefox and Opera but won't do it in IE. And... I also would need to have it working on IE6 = PS: the alert works fine in all the browsers (except IE6,7,8 because of the .src attribute =_=)! So I think the problem isn't the object retriving.
I try to create a switcher-swf. Its purpose is to detect parameters like screensize and then decide whether to load lowres.swf or highres.swf. Both lowres.swf and highres.swf work when tested independently.
The problem is the switching doesn't work. It's not the loading- or switching procedure itself. Rather I tracked the problem down to this single line which is present in the classcode of both lowres.swf and highres.swf:
PHP Code:
ExternalInterface.addCallback("update", update);
All it does is make a function called "update" available for external javascript-calls. If this line is removed, everything else works (including "ExternalInterface.call()"-statements!). However, I absolutely need this update-function to be available.
It seems that loading fails when the swf to be loaded contains an ExternalInterface.addCallback-Statement.
how I would go about writing code with ExternalInterface.addCallback() that would have my flash file return to frame 1 if clicked outside of the flash movie (if clicked anywhere in the html page)?
I'm trying to add an ExternalInterface.addCallback, to get a string back from a javascript function so that I can set the "visible" property of movie clip "title" to "true." Can someone tell me what I'm doing wrong?Here's my AS code:
I'm working on a Flash game that needs to call some Javascript on the page and get data back from it. Calling Javascript from Flash works. Calling the Flash functions from Javascript (often) doesn't. I'm using the Gaia framework.The swf is loaded in with SWFObjectThere's a button in the Flash file. On click, it uses ExternalInterface.call() to call a Javascript function. This works.The Javascript function calls a Flash function that was exposed with ExternalInterface.addCallback().Sometimes, the Javascript produces the following error: TypeError: myFlash.testCallback is not a function.
When the error happens, it affects all functions registered with addCallback(). Gaia and some of its included libraries use addCallback(), and calling those functions from Javascript also produces the TypeError.Waiting a long time before pressing the button in Flash doesn't solve the error.Having Flash re-try addCallback() periodically doesn't solve the errorWhen the error occurs, ExternalInterface.available = true and ExternalInterface.objectID contains the correct name for the Flash embed object.When the error occurs, document.getElementById('myflashcontent') correctly returns the Flash embed object.Edited to add:This issue shows up in Firefox 3.6, but not Chrome or IE8. I haven't tried older browsers.
I'm running the Debug version of the Flash player.My calls toExternalInterface.addCallback() are wrapped in a try...catch block. When the JS error occurs, the catch block is not triggered. It's a silent failure.The error occurs when testing on a webhost, with the swf loaded from the same server as the page it's on. I set allowScriptAccess = always.Setting flash.system.Security.allowDomain("mydomain") doesn't fix the error.From my Page class:
public class MyPage extends AbstractPage { // declarations of stage instances and class variables
Mainly because I have it ALWAYS working locally, when I test in a browser, but the moment I deploy to a server it stops working.
I've added trace commands and confirmed that ExternalInterface is in fact available before adding the callback, and an alert command in the javascript method correctly identifies the flash object. I also checked and allowscriptaccess is set to 'always'.
Could it have something to do with the flash being served on a remote server?
I thought this question would answer my question, but I have applied the following fixes:
.as Security.allowDomain("*"); Security.allowInsecureDomain("*"); html param name="allowScriptAccess" value="always" />
[Code]...
And I am still seeing the ExternalInterface.addCallback method fail locally. It works on a web server, or in the dev folder. But not in an arbitrary local folder.
I am trying to use javascript to run AS3 functions. When I attempt to compile I'm getting an "Access of undefined property" error message. I've read a few things online about this but I'm still not understanding it. I want to have the flash file always listening for javascript.
I am trying to write C++ code to interface to arbitrary instances of flash player 10 contained in arbitrary web pages from IE. All I need to be able to do is:
1) determine if the player is playing,
2) start playback, and
3) stop playback.
I am searching for a way to so this programmatically, without resorting to simulating user input to the control.
I have played around with the IShockwaveFlash COM interface which works OK on some sites but not others (e.g. not on YouTube). I am wondering if it is possible to use IShockwaveFlash::CallFunction() with the appropriate XML string to invoke predefined functions in ActionScript that have not been explicitly exported using ExternalInterface.addCallback().
Or perhaps there is enough functionaly using accessibility and the IAccessible interface?
I'm trying to control a Flash video player with external Javascript commands using 'ExternalInterface.addCallback' but I'm not having any success. Here is the HTML code:
I've spent about a day on this... Publishing a swf for AS3/FP9, following the example in the ActionScript 3 documentation to get two-way communication between a SWF and javascript. Works great in IE.
I've sifted through what seems like a million posts on the subject, with people getting the same result... the function I/they are attempting to call doesn't exist.
In the documentation example, there's a function to find/return either the SWF as an object or embed tag depending on which browser you're viewing the page in.
I have an issue with my ExternalInterface. The way it is currently set up is, on the page load up, a boolean is set to true in JavaScript and then checked by ActionScript constructors (using a timer) until it is true. This marks that JavaScript is ready to get calls from AS3.
At this point, AS3 will add the callback and do some internal stuff, and at the end of the constructor I call JavaScript. So far so good. JavaScript will at this point call a function in AS3 (that was defined in the callback described above), and this is where it all messes up.
On IE this works perfectly fine. On FireFox though, it does not. When I debug it, I see that the javascript function is called but when it tries to call AS3, nothing happens. I also tried to add a timer, but for some reason the function STILL executes straight away (in IE).
I am trying to execute an AS3 function from my javascript using the ExternalInterface. Seems to work fine in IE, but firefox is always returning javascript error method undefined.
I have been Googling this for ages and eliminated the following possibilities:
1) Some people say you need to have an embed tag inside your object tag, so added one - no luck.
2) Many people say that you need to make sure that your flash is loaded before calling the javascript. Well my call is after pressing a link on the page. I am always using the flash application first and only pressing the link at the end.
3) Then I thought that maybe it is a security problem so added the following:
works perfect on my macbook pro (safari, firefox, and opera) but when I view the site on Vmare Fusion Windows XP and use IE and FireFox the pages don't load... I don't know what to make of this. Has anyone hear or seen anything like this happen before? BTW the website was created in Adobe Flash CS4/ AS 3.0 and published using Flash Player 10.
I have two swf files: swf_sender and swf_receiver. The swf_sender controls the swf_receiver via java script.Everything works fine in IE however, the swf_receiver doesn't receive communication from java script if openned by Safari or Firefox.The first part of communication: swf_sender - Java works ok (I tested it with alert() in Java) in all browsers.Here is my Java interface code:
Code: <script type="text/javascript"> function getFlashMovie(movieName) {
The ad on the bottom right of the screen (the one with lightning flashing) has an invisible button in its Flash file (CS5) linking to [URL]. This file is imported as SWF in Dreamweaver CS5.
The hyperlink works in Firefox, but not in Safari. Maybe it is just my computer.