2011-03-15 25 views
1

下面这个例子 http://teethgrinder.co.uk/open-flash-chart/gallery-bg-image.php背景图片属性没有被正确设定

我想

import com.extjs.gxt.charts.client.model.ChartModel 

ChartModel cm = new ChartModel(graphTitle, "color: #738995;font-weight: bold;font-size: 20px; font-family: arial; text-align: left;"); 
cm.setBackgroundColour("ffffff"); 

cm.set("bg_image", "http://teethgrinder.co.uk/open-flash-chart/images/logo.png"); 
cm.set("bg_image_x","right"); 
cm.set("bg_image_y","top"); 

没有bg_image(_x,_y)位的一切工作 它抛出

(字符串):调用NPObject上的方法时出错! [插件异常:在Actionscript中出错。使用try/catch块来查找错误。]。

ChartModel cm = getChartModel(dataSet); 
     try { 
      this.setChartModel(cm); 
     } catch (Exception ex) 
     { 
     GWTMessageHandler.handleInfoMessage(
     "Message ="+ex.getMessage()+ 
     "Cause = "+ex.getCause()+ 
     "getLocalizedMessage = "+ex.getLocalizedMessage()+ 
     "StackTrace="+ex.getStackTrace()); 
     } 

返回Message =(String):在NPObject上调用方法时出错! [插件异常:在Actionscript中出错。使用try/catch块来查找错误]。Cause = nullgetLocalizedMessage =(String):在NPObject上调用方法时出错! [插件异常:在Actionscript中出错。使用try/catch块找到错误]堆栈跟踪= [Ljava.lang.StackTraceElement; @ 2起

回答

0

编辑:。 这听起来就像是由安全限制阻碍的JavaScript和ActionScript之间的相互作用。试试这个security adjustment


包装你的代码在这样的try/catch块,看看它是想告诉你:

try{ 
    ChartModel cm = new ChartModel(graphTitle, "color: #738995;font-weight: bold;font-size: 20px; font-family: arial; text-align: left;"); 
    cm.setBackgroundColour("ffffff"); 

    cm.set("bg_image", "http://teethgrinder.co.uk/open-flash-chart/images/logo.png"); 
    cm.set("bg_image_x","right"); 
    cm.set("bg_image_y","top"); 
} catch(err:Error) { 
    trace("name: " + err.name); 
    trace("message: " + err.message); 
    trace("problem code: " + err.getStackTrace()); 
} 

没有与代码摆弄,我的第一个猜测是,以下行应该取数字而不是字符串:

cm.set("bg_image_x","200"); //instead of "right" 
cm.set("bg_image_y","0"); //instead of "top" 
+0

same situationMessage =(String):在NPObject上调用方法时出错! [插件异常:在Actionscript中出错。使用try/catch块来查找错误]。Cause = nullgetLocalizedMessage =(String):在NPObject上调用方法时出错! [插件异常:在Actionscript中出错。使用try/catch块来查找错误。]。StackTrace = [Ljava.lang.StackTraceElement; @ 2ff – Rodriguez 2011-03-16 12:09:04

+0

@Bogdan:他们肯定没有给你任何有用的信息!大声笑。奇怪的是stacktrace没有打印,所以我查了一下,发现getStachTrace()在Flash Player的非调试版本上不起作用。所以这不会有太大的帮助。我会再看看这个...... – gMale 2011-03-16 15:11:34

+0

@Bogdan:试试这个[安全调整](http://www.wrichards.com/blog/2009/02/error-calling-method-on-npobject/) ... – gMale 2011-03-16 15:14:28