ActionScript 3.0 :: Call C++ Functions Using ExternalInterface?
Oct 20, 2009
I am trying to call a C++ function from actionScript3. using Programming ActionScript 3.0 > Using the external API > Using the ExternalInterface class > Calling external code from ActionScript, I could call function from JavaScript .
it will be good if i could call C++ functions directly from Action Script.
View 2 Replies
Similar Posts:
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
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
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
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
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
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
Nov 25, 2010
Is it not possible to call other functions from generic mouse event functions?
Code:
_root.myButton.onPress = function(){
hide();
[code]......
View 6 Replies
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
Sep 1, 2011
I use a SWF file that exposes functions and events using ExternalInterface. Here is an example of an exposed function:
ExternalInterface.addCallback("myFunction", ExecuteMyFunction);
If I embed the file in an HTML page, I can access those functions using JavaScript. Now, I'm embedding that same SWF file dynamically in a Flex app using the mx:SWFLoader component, something like:
<mx:SWFLoader id="myLoader" source="[URL]" autoLoad="true"/>
I'm trying to access those exposed functions and events, but I can't find how to interact with those from the Flex app. I would like to be able to call a function just like from JavaScript, like:
myLoader.myFunction();
How can I access a function that is exposed by the ExternalInterface within Flex?
View 1 Replies
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
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 20, 2011
I'm wondering if you guys know a way to log every data coming to a flash 8 swf from its container?
I know that it is a bit weird, but I'm trying to figure this one out. Maybe one of you already faced a similar situation?
View 3 Replies
Apr 22, 2010
I am having a problem using ExternalInterface.call to a javascript function. I have used this method many times in many places and at some point during this project, it was working, but now it stalls my Flash file when executed. I have the function: var initialize=function(){ExternalInterface.call("SCOInitialize");statusTxt.text="initializing"; } On my html page, there is a SCOInitialize function that works perfectly if I call it via the html page: <body onLoad="SCOInitialize()"> ... </body> When I make the call using flash... initialize(); ...the Flash file just gets hung up and it actually wont execute the second line of code in the function: statusTxt.text="initializing"; What is the deal? I can't for the life of me figure out why it won't
View 7 Replies
Jan 11, 2011
I want to ActionScript3 set HomePage to Google ",so I use following stagement:[code]Then I call this swf in html page,like follows:[code]When I use mouse click,IE8 raise javascript error.'null' is null or not object
View 5 Replies
Apr 8, 2011
I am trying to make a JS function call from a child swf, but I am running into issues when the child swf is loaded on a different domain than the parent.
Here's what my scenario looks like:
my HTML test page is on domainA.com and loads the parent swf, which is located in [URL].
The parent swf loads a child swd located in domainC.com.
After the child swf is loaded I want to make a JS function call, but when I call ExternalInterface.call("myJSFunction", "params"), the JS code never gets executed.
When I placed all of the files under the same domain, everything works fine.
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
Aug 22, 2009
This does not work:
Within the HTML Head tags:
Code: Select all<script type="text/javascript">
function show_alert()
{
alert("I am an alert box!");
[Code]...
View 1 Replies
Feb 11, 2008
I'm having some serious issues trying to get externalinterface to work in ie. I've looked around and seen that there are problems with ie when the swf is inside a form tag but my swf is not. Also I have set "allowscriptaccess" to "always" and still nothing. It works fine in FF and safari. In ie all i get is a little icon in the bottom corner that says "Error on page" and when I select that it just says something to the effect that there is a syntax error but doesn't give any helpful details at all.
View 10 Replies
Jun 30, 2009
in an aspx page, the call for a lightbox to appear is this:
Code:
<a href="somePage.htm" rel="superbox[iframe][873x436]">
i need to make the same call, but from flash. i am pretty sure this would be done using ExternalInterface.call(); however, i am not sure how this would be done. can anyone shed some light on this? i tried doing the following, but to no avail:
[Code]....
View 4 Replies
Oct 22, 2010
I'm trying to assign the current URL in the browser to a variable in AS3 (CS3).URl...I have tried the following code Actionscript Code: import flash.external.*;var currentURL:String = String(ExternalInterface.call("window.location.href.toString"));trace(currentURL);I export the file (html & SWF) and try it locally and I have [code]I get no compile errors but I do get the security warning from my Flash player 10 in IE8 saying it stopped due to a potentially unsafe operation etc etc.
View 4 Replies
Oct 7, 2009
Are there any known issues (and workarounds) involving multiple calls toExternalInterface.call in ActionScript 2.0?I have 3 functions, each of which calls an external JavaScript function. These 3 functions run nearly back-to-back-to-back. The first time I load the page containing my Flash movie in a browser, I see the effects of all 3 JavaScript functions, as expected. However, once I begin reloading the page a few times, I begin to randomly see the effects of only 1, 2, or 3 of the JavaScript functions. Clearing the browser cache seems to "reset" this cycle, guaranteeing all 3 calls to work again successfully.
View 1 Replies
Dec 26, 2011
I am trying to scroll an html page back to top in response to an actionscript call
i have no knowledge of html or js, but i did this
in flash pro, in my document class i have this:
ExternalInterface.call("JumpScroll");
in the automatic html page wrapper made by flash pro (publish template "Flash with FSCommand") i added these lines inside the script block[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
Dec 4, 2010
I can call JS functions with ExternalInterface.call('func_name',.args). OK
But what if I would like to call a js class instance method instead?
ExternalInterface.call('obj.method_name',.args) //this seems not to work
Is there any way of doing it?
View 2 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
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
Feb 10, 2012
I am trying to get the value of a global variable from JS. The variable is defined in the HEAD section of my HTML document.
if(ExternalInterface.available){
return ExternalInterface.call("window.myVar.toString()");
}
As I debug my application this call keeps returning "undefined" but if I make the same call in firebug's console it returns a string as expected.
View 3 Replies