Javascript :: Returning A Variable From An ExternalInterface.call Back Into Flash
Feb 17, 2010
I'm calling a JS function with ExternalInterface.call and trying to get a return value inside Flash. When I trace out the op variable I get 0 instead of 500. Is there something wrong with my embed code?[code]
View 4 Replies
Similar Posts:
Jan 21, 2010
I am working on my open source project Downloadify, and up until now it simply handles returning Strings in response to ExternalInterface.call commands.
I am trying to put together a test case using JSZip and Downloadify together, the end result being that a Zip file is created dynamically in the browser, then saved to the disk using FileReference.save. However, this is my problem:
The JSZip library can return either a base64 encoded string of the Zip, or the raw byte string. The problem is, if I return that byte string in response to the ExternalInterface.call command, I get this error:
Error #1085: The element type "string" must be terminated by the matching end-tag "</string>"
ActionScript 3:
var theData:* = ExternalInterface.call('Downloadify.getTextForSave',queue_name);
Where queue_name is just a string used to identify the correct instance in JS.
JavaScript:
var zip = new JSZip();
zip.add("test.txt", "Hello world!
");
var content = zip.generate(true);
return content;
If I instead return a normal string instead of the byte string, the call works correctly.I would like to avoid using base64 as I would have to include a base64 decoder in my swf which will increase its size.
Finally: I am not looking for a AS3 Zip generator. It is imperative to my project to have that part run in JavaScript
View 2 Replies
Feb 10, 2011
I have a function defined in JavaScript like so:
function fadeBack() {
alert("fadeBack called");
};
I call that function from my Flash file like so:
import flash.external.*;
flash.external.ExternalInterface.call("fadeBack");
This works in both Safari and Chrome, but for some reason Firefox won't ever call the function. Still, I can't figure this out. How can I fix it?
View 2 Replies
Jun 28, 2011
i have some actionscript that makes a
ExternalInterface.call('someFunction');
call.is it possible to reference the html object that made the call to someFunction directly using the ExternalInterface.call call?
Assume that the object that makes the call also has some Callbacks (via ExternalInterface.addCallback) that are accessible via javascript.
Currently:
Actionscript source
ExternalInterface.call("someFunction");
ExternalInterface.addCallback("someCallback",someASfunction);
[code]....
View 1 Replies
Dec 7, 2010
I can't call a javascript function from flash, when the flash object is added within an OOP structure in javascript. In short the code:
In flash:
if (ExternalInterface.available) {
ExternalInterface.call("flashMessages", "ready");
}
[Code]....
Flash gets loaded, but the call to the javascript function isn't received.
View 1 Replies
Jun 22, 2009
I'm trying to use ExternalInterface.Call to call a JavaScript function to launch a lightbox window. So far I have this:
AS3:
flash.external.ExternalInterface.call("launchLB", "" + aUrl + "");
JavaScript:
function launchLB(url) {
alert(url);
[Code]....
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.
View 1 Replies
Sep 29, 2008
I'm trying to call a javascript function from a flash movie. I'm using IE.
This one works:
AS3: ExternalInterface.call("test();");
Javascript:
function test()
[Code].....
...it says "undefined" insted of alert(666)...it seems that if i use a field in the function it simply stops working. (I'm accessing the page [URL]
View 2 Replies
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
Aug 11, 2010
<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script language="javascript" >
swfobject.registerObject("myId", "10.0.0");
function execute(){
return a;
}
[Code] .....
I have this which is based off of this question: [URL]. However this neither works in firefox and IE. If I embed my flash into the browser like this:
<embed src="helpdeskApp_three.swf" id="flash" quality="high" scale="exactfit" width="800" height="500" name="movie" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="[URL]"/>
This works in Firefox but not IE. What is the proper way of embedding my flash movie so it works across all browsers?
View 1 Replies
Jan 20, 2011
In Actionscript 3, I make a call to Javascript using:
ExternalInterface.call('javascriptFunction');
If in Javascript, there's an error or a blocking call, the entire browser will freeze. I can't use Firebug in Firefox to debug it because the act of stepping through the callback also crashes the browser. How do I go about debugging this?
[Code]...
I'm on an HP desktop with Windows 7, Firefox 5.0, IE9, and Chrome 12.0.742.122. Either alert call will randomly cause Firefox to freeze...it actually usually happens in bunches, where it'll freeze for a few times continuously (obviously restarting Firefox each time)..and then stop for a few hours and be alright.It has yet to crash IE9 or Chrome, though I haven't tested it as extensively with Chrome. Using the Firefox console doesn't help since Firefox just crashes all together. If anyone could shed some light on that, that'd be great!
View 2 Replies
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
Sep 15, 2011
On my page, I'm going to embed multiple Flash files that use ExternalInterface to communicate back to the page. When the page receives the ExternalInterface calls, is there any built-in way to determine which swf the call came from?
I don't mind giving each movie a guid FlashVar and attaching that to each ExternalInterface call, but I don't want to duplicate more tested functionality.
View 1 Replies
Jul 11, 2008
I'm trying to use ExternalInterface.call() to access a function from an outside domain that I have linked in my html page. Is there anyway to do this?
Code:
<script type="text/javascript">
var flashvars = {};
[code]......
View 3 Replies
Sep 15, 2011
using ExternalInterface to call JavaSript function on other html site. (because most of the examples show only how to use it within the same domain).
View 1 Replies
Sep 14, 2011
I've written an html page that is using some javascript to hide and display a flash movie object. It all works fine until I try to exit from the tab, and when that happens the entire browser will crash with not so much as an error text box.
Flash Code
if(ExternalInterface.available)
ExternalInterface.call('hideTimeline');
Javascript code
function showTimelineFirstPlay()
{
var timeline = document.createElement('span');
[Code].....
View 1 Replies
Mar 26, 2010
I want to be able to call a JavaScript function from a Flex app using ExternalInterface and pass a reference to a different JavaScript function as an argument.
[Code]....
View 1 Replies
Dec 28, 2011
I am simply trying to get the variable from JS but can't get it
Code:
<script>
var APIfound = true
</script>
[code]....
View 0 Replies
Feb 21, 2010
I have a simple thing to do, change a value in Javascript from flash.My issue ? I suck in coding ^^Here is the details : In Javascript I have a function named ShowPage ().I want my flash to say ShowPage(2) for example.I know we can do that with ExternalInterface really simply.I know that part of the code :
Code:
import flash.external.ExternalInterface
on (press) {
ExternalInterface.call("ShowPage", " ");
}
I know I have to call the function in the first " " but where can i put the value ? Where do I set my ShowPage to 2 ? With which correct syntax ?
View 2 Replies
Jan 18, 2010
How would I go about passing a variable to a javascript function using ExternalInterface?
View 1 Replies
Feb 23, 2012
This has been my problem for a couple of days now.... I need to send a variable from flash that is embedded in an html to a javascript that will eventually should print the variables(that is the use of the js :to print).
So I've been using externalInterface.call("printval",param1,param2,pa ram3) to send my variables... I've put an alert in my javascript so that i could test if the value is there, the frustrating thing is the alert is showing with the variables but the printing part isnt executed. I tried this in firefox and it work, but I need this in ie...
View 9 Replies
Nov 4, 2010
I need to get a javascript var in my Flash application. I like to be able to just set a variable in the javascript (client constraints) rather than define a function.
Can this be done? I am trying to use the ExternalInterface.call()
AS:
ExternalInterface.call("function(){return window.someVar}", null);
JS:
var someVar = "Test";
This does not work and I suspect it is because the ExternalInterface.call() does not like the anonymous function.
View 2 Replies
Dec 21, 2009
I have a picture upload function in my flash and when I upload a picture I lose focus on the flash. This results in that all my listeners disappears. I cant click buttons, use dragbars etc. This only happens in FF. Im using flash player 10 and Snow Leopard. ive tried to get the focus back by sending a call to javascript:
[Code].....
View 2 Replies
Feb 10, 2011
We have been given some code that does a URLRequest call which is really slow to respond, so I was looking to make it pull the data from the page, as it is already on the page.[code]I have tried to replace it with this (actionscript is definitely not my forte):[code]I am using addCallBack as that is what the editor suggested via autocomplete, unfortunately it doesn't seem to work. Unfortunately I cannot go back to the developer at this time.The error message is:Call to a possibly undefined method addCallback through a reference with static type flash.external:ExternalInterface
View 3 Replies
Oct 11, 2011
For some reason when I click a button in my flash to load a new page in "self" and then hit the back button .. the button I first clicked is now dead.
View 1 Replies
Feb 21, 2010
I am having an issues with ExternalInterface.call to return a value in IE. It is working fine in Firefox. Eventhough I changed the "allowscript access" to "always", still it is not working. Is there any thing that I need to change in Flex or the HTML to make this work? or this is a security setting in IE?
View 1 Replies
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
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
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
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
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