Javascript :: Flash - Functions Registered With ExternalInterface.addCallback Not Available?

Apr 14, 2010

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

[code]....

View 8 Replies


Similar Posts:


ActionScript 3.0 :: Control A Flash Video Player With External Javascript Commands Using 'ExternalInterface.addCallback'

Mar 26, 2009

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:

[Code]...

View 1 Replies

Javascript :: ExternalInterface.addCallback Is Not Working?

Nov 4, 2009

This is my AC3 code

private function uploadet( dosya:String ):void {
var uploader:URLRequest = new URLRequest(dosya);
localFile.upload(uploader);

[code].....

View 4 Replies

Javascript :: Can't Get ExternalInterface.addCallback To Work?

Jun 15, 2010

I'm trying to use ExternalInterface.addCallback to allow js to call an as3 method. My code is as follows:

AS:

ExternalInterface.addCallback("sendToActionscript", callFromJavaScript);

function callFromJavaScript():void{
circle_mc.gotoAndStop("finish"); [code]....

It's not working. What am I doing wrong?

View 3 Replies

ActionScript 3.0 :: Access Built-in Functions Not Exported With ExternalInterface.addCallback()?

Sep 23, 2010

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?

View 3 Replies

JavaScript :: ExternalInterface.AddCallback Does Not Work On Firefox?

Apr 15, 2010

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:

<script type="text/javascript">
window.onload = function(e){
init();
}function init(){
document.getElementById('div').onmouseout = function(e) {
[Code] .....

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.

View 2 Replies

Javascript :: ExternalInterface.addCallback For As3 Doesn't Work

Mar 17, 2011

I want to call AS function from JS.

I have the following ActionScript 3 code:

package {
import flash.display.*;
import flash.events.*;

[Code]....

But obj has no method PlaySound() (obj is not null).

View 2 Replies

Javascript :: Call A Function Using The ExternalInterface.addCallback API ?

Jun 1, 2011

I'm trying to call a function in an action script using the ExternalInterface.addCallback API, but I can't seem to get it to work. Here's what I have:

ActionScript:

//MyClass.as
package {
import flash.display.Sprite;[code]....

The Error I'm getting is: Uncaught TypeError: Object #<HTMLObjectElement> has no method 'getStringJS'

I also tried adding in a timeout in case the swf file wasn't loading, but I didn't have any success with that method either.

View 2 Replies

ActionScript 3.0 :: Add An ExternalInterface.addCallback To Get A String Back From A Javascript?

Jun 22, 2009

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:

[Code]...

View 3 Replies

Javascript :: ExternalInterface. Addcallback Works Locally, But Not On Server?

Nov 9, 2010

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?

View 1 Replies

Javascript :: ExternalInterface.addCallback, Access Of Undefined Property?

Sep 10, 2011

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.

[Code]...

View 2 Replies

ActionScript 2.0 :: Alternative To ExternalInterface.addCallback() To Communicate With The Javascript

Feb 21, 2009

Any alternative to ExternalInterface.addCallback() to communicate with the javascript

View 2 Replies

Flash :: ExternalInterface.addCallback Fails In Local Environment?

Jul 15, 2011

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.

View 3 Replies

ActionScript 3.0 :: ExternalInterface.addCallback?

Feb 11, 2009

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.

View 3 Replies

ActionScript 2.0 :: ExternalInterface.addCallback?

Jan 8, 2007

i have a flv movie and i need to be able to stop it through javascript. so i found out that i need to use ExternalInterface.addCallback

View 3 Replies

ActionScript 2.0 :: ExternalInterface.addCallback In IE?

Jan 30, 2009

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.

[Code]...

View 1 Replies

ActionScript 3.0 :: ExternalInterface.addCallback Won't Work On IE

Nov 21, 2011

I've got this piece of code in flash:

[Code]...

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.

View 4 Replies

ActionScript 2.0 :: F8 ExternalInterface AddCallback Not Working?

Mar 18, 2008

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 {

[code].....

View 4 Replies

IDE :: ExternalInterface.addCallback Not Working In FireFox?

Jun 26, 2008

I have set up a function in Flash that i want available to Javascript.

Code:
function OpenBrowse():Void {
...
}
_trace(flash.external.ExternalInterface.addCallback("OpenBrowse",null,openBrowse));

[code].....

View 3 Replies

ActionScript 3.0 :: Cannot Load Swf Using ExternalInterface.addCallback

Jun 29, 2011

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.

View 3 Replies

Actionscript 3 :: Finding The Method Name From An ExternalInterface.addCallback

May 23, 2011

Let's say we have a number of ExternalInterface.addCallback functions, like so:

ExternalInterface.addCallback( 'foo', handler );
ExternalInterface.addCallback( 'bar', handler );
ExternalInterface.addCallback( 'foobar', handler );

In the function handler I'd like to find the method name called through the external interface, such as foo, bar or foobar; is there a way? Eg:

private function handler(...args):void
{
arguments.callee.arguments[ 0 ];
}

View 2 Replies

ActionScript 3.0 :: ExternalInterface.addCallback() Return To Frame 1

Sep 22, 2009

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)?

View 0 Replies

Actionscript :: ExternalInterface.addCallback Only Working Locally, Not In Production

Jan 15, 2011

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.

[Code]...

View 1 Replies

ActionScript 2.0 :: Functions Not Getting Registered Inside Onload Event?

Jun 24, 2010

I am loading an xml configuration file and based upon values obtained from it, I am connecting to an xml socket in the server.

But I can't register for socket.onConnect Function now. I could do it in my old cold in which I didn't use a configuration file. The configuration values are loaded properly. It seems the issue is in the way, socket.OnConnect function is registered.

[Code].....

View 3 Replies

Javascript :: Flash - Get A VAR With ExternalInterface?

Nov 5, 2010

I am trying to use the ExternalInterface.call function in my ActionScript(2.0) to get a javascript var value set in the wrapping document. The following seems to work in FireFox and in Chrome but, naturally, it does not work in IE(8). getting the value stored at this variable?

var linkPath = ExternalInterface.call("function(){return window.customLinkLocation;}", null);

[Code].....

View 5 Replies

Javascript :: Insert Javascript Functions To An HTML Document From The Child Flash Swf File?

Jan 29, 2012

I need to execute some javascript string code from flash swf file using actionscript 3.
I read that it could be done by passing the javascript code to the parent html document , using externalinterface.call function. Then I assume it will be faster if I can declare functions in the javascript code in the HTML document in the first use of externalinterface.call funtion ; if flash code calls the javascript code repeatedly. So let me ask you how to do that. For details , any javascript to be loaded is unknown in design time and I can not prepare a javascript file to be loaded.

View 2 Replies

Javascript :: Linking Flash To OOP Using ExternalInterface?

Dec 6, 2009

I'm looking to call a flash method from a method in javascript and recieve a result:Example:Flash -

ExternalInterface.addCallback("getProgress", getProgress) // Javascript to flash
public function getProgress():void {
ExternalInterface.call("getProgress", progress); // Send progress back to javascript from

[code].....

View 1 Replies

Javascript :: Calling A Flash ExternalInterface ?

Mar 27, 2009

I'm trying to call a function declared with ExternalInterface in a Flash swf, using JavaScript.It worked once, but all of a sudden, it stopped working.I have a debug version of the Flash Player, but no errors occur in Flash.Not even a "Security Sandbox Error" or something. The only error I get is the following error in JavaScript Error: Error in Actionscript. Use a try/catch block to find error.I'm using AS3, exporting for Flash Player 10 and testing on Firefox 3/Safari 4, on a Mac.

View 4 Replies

ActionScript 3.0 :: Pass A Value To Javascript From Flash Using Externalinterface

Jun 1, 2009

i'm currently trying to call a javascript function and pass values to it. but i'm not really familiar in using the addcallback since i only tested on calling a function from flash without passing anything to the function.
 
Basically, i'm going to retrieve the values of a node from xml. and then i will assign those values to a variable in flash. now what i'm going to do next is pass this value to a javascript parameter..is it done using externalinterface?

I just need to throw the value to the javascript function parameter and no return values to the actionscript. The event is that whenever an image is click, the corresponding value for each image is passed to the javascript function.

[Code]....

View 1 Replies

Flash :: AS2.0 And JavaScript / JQuery (ExternalInterface) Communication

Jan 7, 2010

Im trying to use JS to send data to my Flash AS2.0 music player with ExternalInterface, except there are no good tutorials or guides on ExternalInterface that I can find. I want to be able to change the current song in the player by clicking a JavaScript link, and on page / window load without clicking, play a default song.

I dont need a super complicated answer on loading sounds in flash, etc., I am just having a lot of difficulties getting JS to send anything to Flash, and when I get that to work - would I need to put some if / else into the flash to determine if the link has been clicked or not?

[Code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved