8/21/2008

gwt-fabridge 1.2 released

gwt-fabridge 1.2 updates the underyling version of gwt2swf to the current version 0.6 (upgrade to swfobject 2).

These changes will not affect your code except for the instantiation of SWFABridgeWidget. Thanks to changes in gwt2swf it's easier now. One way to do it is this:

//SWFABridgeWidget(String swfName, int width, int height, String bridgeName)
SWFABridgeWidget swfWidget = new SWFABridgeWidget("app.swf",400,400,"example");

Everything else stays the same.

Again, there are some problems with the fabridge.js. This time it's not the combination with gwt, but with swfobject that is causing problems. Gladly, the swfobject developers have found a way to get things working, but they had to modify the javascript file (read more about it here).

To fix a problem between fabridge and gwt I already had modified the file myself for gwt-fabridge. So I could not use the new version. Instead I have integrated the new changes into my modified version that is compatible with gwt (inline frame problem). Please do not use any other version of fabridge.js!

Let's hope that Adobe will someday integrate all these changes into the official version.

You can download gwt-fabridge here

5 Kommentare:

Unknown hat gesagt…

Hi, thank you for the great tool.

I tried to run it in my GWT code, but I am getting some errors:
[ERROR] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): '$wnd.FABridge[...]' is null or not an object
number: -2146823281
description: '$wnd.FABridge[...]' is null or not an object
at org.argunet.gwt.fabridge.client.SWFABridgeWidget.getBridgeRoot(Native Method)
at org.argunet.gwt.fabridge.client.SWFABridgeWidget.root(SWFABridgeWidget.java:79)
at com.yht.ui.gwt.client.widget.util.AudioRecorder.init(AudioRecorder.java:69)
at com.yht.ui.gwt.client.widget.util.AudioRecorder. (AudioRecorder.java:39)
at com.yht.ui.gwt.client.widget.MainPanel.getData(MainPanel.java:194)
at com.yht.ui.gwt.client.widget.util.BasePanel.getStore(BasePanel.java:288)
at com.yht.ui.gwt.client.widget.util.BasePanel.getAccordionNav(BasePanel.java:156)
at com.yht.ui.gwt.client.widget.util.BasePanel.init(BasePanel.java:83)
at com.yht.ui.gwt.client.widget.MainPanel.init(MainPanel.java:118)
at com.yht.ui.gwt.client.Application$1.onSuccess(Application.java:50)
at com.yht.ui.gwt.client.Application$1.onSuccess(Application.java:1)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:215)
at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:254)
at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:226)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:217)

I noticed that it is crashing on swfWidget.root():

SWFParams params = new SWFParams("MyTest1.swf", new Integer(400),new Integer(400));

params.addVar("bridgeName", "audio");
swfWidget = new SWFABridgeWidget(params);
BridgeObject flexApp2 = swfWidget.root();


Any suggestion on how I can resolve this problem?

Thank you for your great help in advance.

Mark

Anonym hat gesagt…

Hello Christian,

Thank you for your work in this area. It is valuable, indeed. I have a peculiar problem when calling functions on flex BridgeObjects. namely, I am able to retreive Boolean and number/integer values as expected, however, when I try to get a String value, I get a "java.lang.ClassCastException: java.lang.String". I am not too sure what this means, or how to deal with it. I am certain the problem arises from the marked line below (BridgeObject.java):
private native JavaScriptObject invokeASMethod(String name, JavaScriptObject params) /*-{
var asObj=this.@org.argunet.gwt.fabridge.client.bridge.BridgeObject::jsObj;
if(asObj!=null){
var parameterString="";
for(var i=0; i<params.length; i++){
if(i<0){
parameterString+=",";
}
parameterString+= "p["+i+"]";
}
eval("var obfuscatedWorkaround= function(p, obj){return obj."+name+"("+parameterString+");}");

var result= obfuscatedWorkaround(params,asObj);
if(typeof(result)=="number"){
result= new Number(result);
}else if(typeof(result)=="string"){
result= new String(result);
}else if(typeof(result)=="boolean"){
result= new Boolean(result);
}
**--***--**return (result == null) ? null : result;

}else{
return null;
}
}-*/;
public BridgeObject invokeMethod(String name, JavaScriptObject params){
Object result = this.invokeASMethod(name, params);
return new BridgeObject(result);
}

I would greatly appreciate any help with this. Thank you very much!

Hector

Christian Voigt hat gesagt…

Hey Mark and Hector! I have just released a new version with some small changes I made weeks ago and forgot about...

Hector, these changes should fix your problems as they are exactly the same ones I had (It's caused by the upgrade to GWT 1.5). Sorry for being so lazy...

As for your problems Mark: The error occurs because GWT cannot find Adobe's Fabridge Javascript Object that should be initalized when your app starts. Please check if the FABridge.js file is really loaded (you can do that with Firebug).

Do you have any problems with running the demo? If not, can you isolate your problem in a simple test case? This seems to be a problem with loading FABridge so it shouldn't be too hard to fix it.

good luck,
christian

Anonym hat gesagt…

Hi Christian, Thank you for your quick response! It is working fine now. I appreciate it.

-Hector

lena hat gesagt…

I have de same issue that markmorreny.

Have you fixed the problem? Does anyone know a solution?