My account  |  Support  |  Shopping Cart
Jumpeye Components, V3 Flash Components, Flash Components Pro, Flash V3 Components

ActionScript Bridge


home » flash components » various » actionscript bridge »


actionscript bridge flash components


download free version

Download

To download the FREE source for the flash demo above and the FREE ASB files you need to create an account, and sign in. Than, just click to the Free Download button above to download the ASB files.

What can be done using ASB?

A. Use flash AS2.0 flash components in AS3.0 projects.
B. Use older AS2.0 widgets, flash files inside newer AS3.0 projects.
C. Use AS2.0 methods, functions or classes inside AS3.0 projects, call them and get returns back.
Technically: Load Macromedia/Adobe Flash AS2.0 projects (swf) inside Adobe Flash AS3.0 projects using ASB and communicate between them. Call functions, fire up events and get return variables using our ASB API.

The story of ASB

With the launch of the new Flash CS3 and ActionScript 3.0, Adobe created a gap, in terms of compatibility, between applications created using ActionScript 2.0 and ActionScript 3.0. This means that a Flash clip created using ActionScript 3.0 can load and play a clip created using ActionScript 2.0, but it will not have access to anything (variables, functions, objects) inside the AS2 clip.

ActionScriptBridge is a project that aims to fill the gap between AS2 and AS3. It gives the possibility for two Flash movies, one created using AS2 and the other using AS3, to communicate with one another (at least regarding function calls). This means that the AS3 clip will be able to call functions found in the AS2 clip loaded in it, and the AS2 clip will be able to call functions found in its’ parent, the AS3 clip. All this, by using two components: ASBContainer, for Flash CS3 and AS3, and ASBTerminal, for Flash MX 2004 or later and AS2.

Creative Commons License
The ASB is now version 0.9 beta, and it is free for use, share and distribute under the Creative Commons Attribution-No Derivative Works 3.0 License

What is the ASB API?

The ASB API consists of easy to use methods and 2 flash components:
1. ASBTerminal (the drag and drop ASB terminal/connector for AS2.0, enables any AS2.0 swf files for AS3.0 integration and communication).
2. ASBContainer (the loader/container that is used in AS3.0 projects to include ASB enabled AS2.0 files, using the source parameter)

The included installer will install the components for Flash CS3 both AS2 and AS3 components.

ASBTerminal - AS2.0 flash component

This component, used by AS2 clips, provides a mean to call functions inside an AS3 clip.

Methods
public function run(arg):Void – Requests the execution of a function found in an AS3 clip.
Parameters:
arg – A string representing the function to be called or an object containing the function name, the object it is attached to (client) and a list of arguments to pass as parameters.

Example
instanceName.run("myFunction(1, 2, 3)");
or
instanceName.run( { client:"", functionName:"myFunction", args:[1, 2, 3] } );


Events

status – Event triggered when the component tries to connect to an ASBContainer instance. The event object contains the level parameter with specifies weather the connection succeeded ("status") or failed ("error").
ASBReturn – Event triggered when a function called from the AS3 clip returns a parameter. The event object contains the parameters value, the value returned by the function, and functionName, the function that returned the value.

Example
var listener:Object = new Object();
listener.status = function(evtObj:Object):Void {
if (evtObj.level == "status") trace("Connection succeeded…");
if (evtObj.level == "error") trace("Connection failed…");
}
listener.ASBReturn = function(evtObj:Object):Void {
trace("The AS3 function "+evtObj.functionName+" returned "+evtObj.value);
}
instanceName.addEventListener("status", listener);
instanceName.addEventListener("ASBReturn", listener);


Notes
If the parameter passed to the run method is of type Object and the functionName is missing, the component will display the following error message in the output panel: ERROR: you must send at least the functionName property trough the object.

ASBContainer - AS3.0 flash component

This component, used by AS3 clips, provides a mean to call functions inside an AS2 clip.

Properties

source:String – The url to the .swf file created using AS2.

Methods
public function run(arg):Void – Requests the execution of a function found in an AS2 clip.
Parameters:
arg – A string representing the function to be called or an object containing the function name, the object it is attached to (client) and a list of arguments to pass as parameters.

Example
instanceName.run("_root.myFunction(1, 2, 3)");
or
instanceName.run( { client:"_root", functionName:"myFunction", args:[1, 2, 3] } );


Events

init – ASBEvent.INIT – Event triggered after the external AS2 clip has been loaded.
connect – ASBEvent.CONNECT – Event triggered after the ASTerminal instance has been initialized and connected with ASBContainer instance. After this event has been triggered, ASBTerminal and ASBContainer instances can call function to execute from each other.
status – ASBEvent.STATUS – Event triggered when the component tries to connect to an ASBTerminal instance. The event object contains the level parameter with specifies weather the connection succeeded ("status") or failed ("error").
asb_return – ASBEvent.ASB_RETURN – Event triggered when a function called from the AS2 clip returns a parameter. The event object contains the parameters value, the value returned by the function, and functionName, the function that returned the value.

Example:

import ASBEvent;
instanceName.addEventListener(ASBEvent.INIT, initHandler);
instanceName.addEventListener(ASBEvent.CONNECT, connectHandler);
instanceName.addEventListener(ASBEvent.STATUS, statusHandler);
instanceName.addEventListener(ASBEvent.ASB_RETURN, returnHandler);
function initHandler(evtObj:ASBEvent):void {
trace("The external AS2 file has been loaded.");
}
function connectHandler(evtObj:ASBEvent):void {
trace("The ASBTerminal instance has connected to me.");
}
function statusHandler(evtObj:ASBEvent):void {
if (evtObj.level == "status") trace("Connection succeeded…");
if (evtObj.level == "error") trace("Connection failed…");
}
function returnHandler(evtObj:Object):void {
trace("The AS2 function "+evtObj.functionName+" returned "+evtObj.value);
}


Notes
If you execute the run method, before the external AS2 clip is loaded, the component will display the following error message in the output panel: ERORR: The source is not loaded, yet.
If the parameter passed to the run method is of type Object and the functionName is missing, the component will display the following error message in the output panel: ERROR: you must send at least the functionName property trough the object.
If the AS3 clip is unable to transmit the connection id to the AS2 clip, the component will display the following error message in the output panel: ERROR: the connection id could not be sent to the AS2 file.

How to use ASB components?

After installing the components, you should drag in instance of them on the Stage, for each type of movie clip: ASBTerminal for the ActionScript 2.0 clip and ASBContainer for the ActionScript 3.0 clip. Give them an instance name and set the source parameter of the ASBContainer instance to the path and file name of the ActionScript 2.0 file. Next write the code you need for each file (following the examples given earlier) and test the results.

Download free trial/demo
User rating: Not rated yet.
Date: 31-07-07

User Comments

hallo
posted by randomroutine on 14-08-07

first of all, your bridge component is working really great. i have only one problem: doesnt seem to work properly under i.e. should it be a problem with the component or its some variable loading order issue what firefox can sort out, but the explorer can't. thx
ASB working in I.E.
posted by jumpeyecomponents on 21-08-07

ASB works perfectly in IE try opening this page (with the example) in a IE window... it works perfectly..
However if you really need support and want us to help, we have to charge you, since this product is a FREE product, and does not include support. Write an email to support and we'll find a way to solve your coding problem.
a Bit disapointing ...
posted by minutepapillon on 26-08-07

The component successfuly loads and displays the swf (just like a simple UILoader and then ...
Here is the output I got :
"The external AS2 file has been loaded.
ERROR: The source is not loaded, yet."

Contradictory no ?

In between the to I try to interupt the swf with à stop() ...
(the stop is trigered by the ASBEvent.INIT event)
May be the shortness of the "documentation" is responsable of this ...


Menu

FlashEff Premium Special Offer



Get your FlashEff Premium Now!

Free Trial Versions

The trial versions do have a major limitation. They will ONLY run into debugger flash player versions, such as the Flash IDE player and the activeX FP used by developers.

Switch from Free Trial version to Full version.

You can switch from Trial to Full versions in a blink of an eye.
See this tutorial in order to find out how.

We accept Google Checkout

Google Checkout Acceptance Mark

Secured by VeriSign

Translate this page