Professional :: ScriptBridge Class Provides Another Way To Communicate From JavaScript?
Jun 3, 2010
In Flash Player 10.1 and later, the ScriptBridge class provides another way to communicate from JavaScript running in a browser to ActionScript (but not from ActionScript to JavaScript). The ScriptBridge class offers significantly better performance than the ExternalInterface class, and provides access to the entire ActionScript 3.0 API from JavaScript. By contrast, the ExternalInterface class provides access only to callback functions in ActionScript.If you need to call JavaScript from ActionScript, or need to communicate between ActionScript and any other programming language
you must use the ExternalInterface API. If you need to call ActionScript from JavaScript, the ScriptBridge class is recommended. The rest of the section describes the ExternalInterface class.my research makes me believe that this new Flash Player plugin API is most likely resulting from implementing recent changes in the Netscape Plugin API. Hopefully it should be as simple as having the player script NPObject properties and functions to use to access objects, packages and classes of the flash application.
View 2 Replies
Similar Posts:
Aug 1, 2009
for some reason, whenever I dynamically load a swf on a $(document).ready() by writing to a div, I am unable to make javascript calls to the browser. Specifically, all calls to the browser return "null". This does not occur when embedding the swf normally on the page load, but I would like to prevent loading of the swf until a specified point in time.
What the heck is going on here? Is there something special about dynamically embedding a swf that prevents the swf from talking to the browser? The methods ARE called (I've proven such by showing alerts), but all return values to any function, regardless of type returned, shows as null when it gets to flash.
View 3 Replies
Nov 27, 2010
My index.php file loads the Facebook JavaScript SDK and the FBJS bridge:[code]When I run this file on my server, I can communicate with Facebooks JavaScript SDK either indirectly through ExternalInterface calls, launching various Facebook UI dialogs etc. And I can also use the facebook-actionscript-api to launch the same dialogs directly from ActionScript.When I however use this index file as my Facebook canvas url and load the swf in a Facebook iFrame, the communication crashes the application. I'm not sure how to debug this but I think it might have to do with crossdomain security. Any ideas on debugging and/or solutions are welcome.
View 3 Replies
Jun 2, 2011
What's an easy and secure way to let my Flash app communicate with my back-end server?
The Flash app, which is a video player, should retrieve the person's username and send back an ID. How would I do this?
Note: Back-end is written in Javascript.
View 2 Replies
Aug 9, 2011
If I playing one swf, the other swfs should pause if it was playing. I can able to communicate two swfs using javascript(both swfs are different name). But come to multiple swfs, I don't know how to differentiate the swfs beacause all are same name. I have embed 3 swf files in my html page using the following script.
[Code]....
View 1 Replies
Feb 20, 2012
I have a windowed Flex application (AIR) that uses an HTML file for the UI, but I have some Flex code that needs to be executed when the page is loaded.I have imported the HTML interface into the app using the < mx:HTML /> tag. The communicate between javascript and flex, but only if you are using an external HTML file in a browser, and not in a windowed app.
View 2 Replies
Mar 14, 2012
Say i need to send some data from AS 3.0 to a server-side script for it to do some actions. Can I do this in a sub-class called some where in a document class or should we always do it in a document class?
View 1 Replies
Nov 4, 2011
My program running in web browser. I dont have internet connection. How can i call Javascript functions.Also not working ExternalInterface.
View 11 Replies
Feb 21, 2009
Any alternative to ExternalInterface.addCallback() to communicate with the javascript
View 2 Replies
Jun 22, 2010
i have recently started a project that would require writing a set of classes and a small API.i know some basics of inheritance and extending classes but i still have some questions.
1) how should sub-class refer/communicate with super class.i think that dispatching events is the way to go but i have no experience on that. i have previously done it by having a parent set up a reference to itself in a subclass e.g
ParentClass.addChild(SubClass);
SubClass.myParent = ParentClass;
//i know that there is already a "parent" keyword in flash objects if i extend one but is that a decent way to communicate with super class
e.g SubClass.myParent.removeChild(this);//sounds a bad call
//but is it better if i dispatched an event that calls the removeChild() in the parent.i have is about dispatching events in a class that is likely going to be extended.
ActionScript Code:
public class Button
{
//add event listeners[code]....
//now if i extend the Button class into another class, let say ControllerButton and want that button to dispatch different event. e.g ControllerEvent, i am forced to override and rewrite all the common stuff in the handler functions.how to avoid having to override allot of common stuff.
View 3 Replies
May 17, 2010
I want to have my overlay adjust in size depending on how much content is being shown in the flash movie. Also, I want it to resize in real time when the user adjusts the content.
View 2 Replies
Feb 3, 2009
Im having a little problem making javascript communicate with actionScript, Here is the problem, i have a application that uses javascript to communicate with SWF and pass it some values, and the code was working in AS2 with the following:
[Code]....
in this example the aplication would pass key to the javascrip function and the function would put the value in the swf variable called _root.valor. So the problem is (as you already know) _root has gone in AS3. And every thing i tryed so far seems not to work. every thing i read so far was to embeb the swf in the js and use
root.loaderInfo.parameters.valor, well i dont want to use the embedSWF because i need to get the activeX cotnrol from my document. Is there any _root replacement? is anyway to get this to work at all ?
View 5 Replies
Oct 14, 2011
I'm working on a site that allows administrators to upload arbitrary SWFs and embed them on the page. Administrators are in theory trusted, but I still want to protect against potentially malicious administrators or misguided administrators from harming the site.
A part of the functionality of the site is that the SWFs can communicate to the containing browser page when it's finished and for the page to react.
Now, I can think of two ways to do this:
Use ExternalInterface.addCallback to create a global callback named something like isComplete that does logic and returns true or false depending on whether the Flash app is in a completed state. Then, just do something like setTimeout to just call that function repeatedly. I don't think this would require me to open up allowscriptaccess to the movie. Embed the movie with allowscriptaccess and have the movie call something like ExternalInterface.call('done') when it's finished. This option seems like it requires me to open up allowscriptaccess, which is a potential threat since I can't control the SWFs that would be embedded with this directive.
View 1 Replies
Feb 21, 2011
communicate between custom classes.
For example: how to get public var value in document class from another class in another package.
i know two ways but i need to know what if i am in the right side or not:
1- public static var Root:Main = this; and then call Main.Root.PublicVarName from another class.
2- make instance from the class ( var classInstance:ClassName = new ClassName() ) then to call function or var ... ( classInstance.PublicVarName ) but in this case i can't call the Main ( Document class ) as i got an error when try to create instance from Document class.
View 3 Replies
Feb 4, 2011
How do I communicate from a class to the root? I've got a class that does some different things including communicating with a webserver. When it does its thing, I want it to communicate that back to the main part of the program. I'm thinking that an eventdispatcher could do it, but I haven't been able to get it working right. When all is said and done in my class, I tried including:
[Code]...
View 1 Replies
Nov 20, 2010
I have a document class .as file and I'm trying to communicate an object to another class with a getter. But it's nested inside another movie clip. The compiler says the movie clip it's nested in is undefined. Also, the moviecllip it's nested in is on the stage, dragged manually from the FLA LIbrary and has the instance name, gamelevel1 in the instance name box. I referred to it when I put the _player movie clip, which I'm trying to communicate with the getter, on the stage via and addChild method. Anyway here's the friggin' document class script:
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Bitmap;
import flash.display.BitmapData;
[code]....
View 3 Replies
Mar 6, 2011
I have an app with a setup page that requires the user to select a scenario for a quiz. Their choice determines the content that's loaded next.
With as2 I would have used a global variable to indicate the users choice but of course that's not longer an option, and I don't think I can send an event because the next page isn't loaded yet.
So how do I communicate with a class belonging to a dynamically loaded swf that isn't loaded yet?
View 1 Replies
Mar 15, 2012
I am within a class, "Enemy". This class has a function "collision". How can I communicate with the amount of lives a player has left from within this class?
View 1 Replies
Dec 4, 2011
I have the following class, I want to do what is in the comments.I know I can do it with conditionals.I'd like to know if there is a way of doing that dinamicaly.This code is in AS3, but I know maybe this is related to javascript because AS3 is based on ECMAScript
public class ClientStatus
{
public static const INVITED:int = 0;[code].....
View 2 Replies
Feb 11, 2011
I have an abstract class which gives specific 'base' behavior to multiple sub classes. I want to instantiate a Singleton inside this abstract class. Is it good practice to:a) instantiate a class within an abstract classb) do this with a Singleton (I know these may be frowned upon)For clarity I will give an example, the method instantiating the Singleton is:
public function createErrorRepository(repositoryType:String):void {
this._errorFactory = ErrorFactory.getInstance();
this._errorRep = this._errorFactory.createErrorRepository(repositoryType);
[code].....
View 1 Replies
Jan 13, 2010
How do I create a custom event class similar to ActionScript? What I mean by that is a class that I can use to fire off my own events, send the necessary data.
I don't wanna use third-party libraries like YUI or jQuery to do it. My goal is to be able to send a event that looks like this.[code]...
View 4 Replies
Aug 28, 2011
Here's my actionscript (compiled with mxmlc, embedded into html, and the functions are called with js):
[Code]...
View 1 Replies
Jun 22, 2010
I have this Fla which contains a symbol that is linkaged to a certain class that is in my project. That class inherites a base class named CMovieClip which resides in one of the libraries that is in the class path (and inherites from MovieClip).Of some reason, every change that I do in the base class doesn't seem to influence the resulting linkaged class, much as if this library is cached somewhere that I can't feagure out.I tried to create the same conditions in a separate Fla but it does not repeat the issue.I tried to duplicate the symbol but the issue isn't solved that way.
View 4 Replies
Oct 3, 2011
I copied my actions from frame 3 to frame 4 and frame 4's class doesn't work when frame 3's class works fine and normal, here is the source code:
Frame 3:
stop();
var rowNum:int = 10;
for (var i:int=0; i<rowNum; i++)[code]....
View 7 Replies
Jul 28, 2010
I'm trying to build a shuffle function that somebody gave me into my card game. I two external .as classes; one is Shuffle.as, which is my document class, and the other is card.as. I'm building the shuffling function into Shuffle.as. I think I'm getting close to making it work, but there are some problems. I keep getting this error message: "5000: The class 'Shuffle' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type." Here is my code. Shuffle.as code
[Code]....
View 2 Replies
Mar 14, 2011
I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem to be working for me.[code]
View 1 Replies
Mar 14, 2011
I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem to be working for me
package jab.enemy
{
import flash.display.MovieClip;
[code].....
View 1 Replies
Jun 12, 2011
I can't find a way to directly access a MC (or textfield, etc) on the timeline from a Class loaded into my Document Class. No problem from the Doc Class, but can't do it directly from the loaded Class. Is there a trick to essentiall extend the Doc Class AS from another external class?
View 7 Replies
Aug 6, 2010
I've just created a quick video player using the FLVPlayBack Component. When I publish, the HTML file always has a bunch of JavaScript in the <header> tab. What is this JavaScript for? I've tried to move the JavaScript into a seperate file and link it in the HTML file, but the .swf will not load. I've also tried just deleting the JavaScript, but the .swf will not load. I have found the only way to get the .swf to play is to keep the javascript in the HTML file. The problem I am looking at is I am building a webpage that will have two seperate video players, thus requiring two seperate .swf files. What I am concerned about is I'll have to have a boat load of JavaScript in the one HTML page which makes it messy. I've tried searching the internet, but not able to find much help. Is there a way around having to keep the JavaScript in the HTML file?
View 4 Replies
Mar 26, 2011
I have a GoDaddy certification seal that is JavaScript. Anybody have any thoughts as how to incorporate into my Flash website?
View 1 Replies