在自定义的widget中引入图表后,运行时出现TypeError #1009错误
本人网上查找了很多资料,其中大部分都是关于Flash中的动画效果问题,与这里的问题关系型不太大。故把问题的解决方法写在这里,与人方便,与己方便。
方法一:
1.在自定义的widget中添加如下两个方法:
private function copyStyleFromParent(selector:String):void
{
var chartBaseStyle:CSSStyleDeclaration = styleManager.getStyleDeclaration(selector);
if (!chartBaseStyle && styleManager.parent)
{
var parentStyle:CSSStyleDeclaration = styleManager.parent.getStyleDeclaration(selector);
if (parentStyle)
{
styleManager.setStyleDeclaration(selector, parentStyle, false);
}
}
}
protected function preinitializeHandler ():void
{
var styleObjects:Array =new Array();//FlexGlobals.topLevelApplication.styleManager.selectors;
styleObjects.push( "mx.charts.chartClasses.ChartBase" );
styleObjects.push( "mx.charts.chartClasses.CartesianChart" );
styleObjects.push( "mx.charts.chartClasses.PolarChart" );
styleObjects.push( "mx.charts.BarChart");
styleObjects.push( "mx.charts.ColumnChart" );
styleObjects.push( "mx.charts.LineChart");
styleObjects.push( "mx.charts.PieChart");
styleObjects.push( "mx.charts.AxisRenderer" );
styleObjects.push( ".blockCategoryAxis");
styleObjects.push( ".blockNumericAxis");
styleObjects.push( ".linedNumericAxis");
styleObjects.push( ".dashedNumericAxis");
styleObjects.push( ".dashedCategoryAxis");
styleObjects.push( ".hangingCategoryAxis");
styleObjects.push( "mx.charts.GridLines");
styleObjects.push( ".horizontalGridLines");
styleObjects.push( "mx.charts.series.BarSeries" );
styleObjects.push( "mx.charts.series.ColumnSeries" );
styleObjects.push( "mx.charts.series.LineSeries" );
styleObjects.push( "mx.charts.series.PieSeries" );
for each(var styleObj:String in styleObjects) {
copyStyleFromParent(styleObj);
}
}
2.在该自定义widget头部中添加preinitialize="preinitializeHandler ()" 。
方法二:
在自定义widget中覆盖父类的moduleFactory方法:
override public function get moduleFactory():IFlexModuleFactory {
return FlexGlobals.topLevelApplication.moduleFactory;
}
在自定义的widget中引入图表后,运行时出现TypeError #1009错误的更多相关文章
- 报错:此版本的SQL Server Data Tools与此计算机中安装的数据库运行时组件不兼容
在Visual Studio 2012中使用Entity Framework,根据模型生成数据库时,报如下错误: 无法在自定义编辑器中打开Transact-SQL文件此版本的SQL Server Da ...
- c++ 程序编译后运行时的内存分配
程序编译后运行时的内存分配 太好的文章了,看到不得不转,转自:http://blog.sina.com.cn/s/blog_5420e0000101a0w1.html 一.编译时与运行时的内存情况 1 ...
- 为什么一定要调用 setlocale 呢? 因为在 C/C++ 语言标准中定义了其运行时的字符集环境为 "C" ,也就是 ASCII 字符集的一个子集。使用setlocal改变整个应用程序的字符集编码方式(wcstombs使用前要设置 setlocale (LC_ALL, "chs"); )
setlocale 配置地域化信息. 语法: string setlocale(string category, string locale); 返回值: 字符串 函数种类: 操作系统与环境 内容 ...
- ios 引入第三方库 运行时找不到函数实现
今天引入webtrends 这个库,结果一直运行时找不到函数,纳闷了一下午! 后来发现,是other flag没有设置对,对于那些包含category用来扩展ios原始类型的库,链接的时候需要特别的链 ...
- 关于Java项目打包成Runnable jar文件后运行时图片不显示的问题
现象:在eclipse中能够无误运行,但导出Runnable jar后运行jar包时不显示图片. 原因:路径问题. 方法1: 新建一个文件夹.文件夹中放那个jar包和image文件夹.在这种情况下,双 ...
- WP8.1中C++的winodws运行时组件位移操作的差异
最近学习WP8.1应用开发,想把C语言的SM3国密算法移植到手机app中.由于把C语言的代码转换成C#代码工作量较大,因此只能用winodws运行时组件来实现. SM3国密算法是一种HASH算法,具体 ...
- Java中获取类的运行时结构
获取运行时类的完整结构 通过反射获取运行时类的完整结构 Field(属性).Method(方法).Constructor(构造器).Superclass(父类).Interface(接口).Annot ...
- Springboot 项目中引入WebSocket后,单元测试出现错误
报错信息 java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test. ...
- 如何解决weblogic server启动中在IIOP后运行缓慢
WebLogic Server在Linux环境中,有时因为linux OS的安全包没有安装,导致weblogic server 在启动的时候会在长时间的停留在 <2/07/2009 08:54: ...
随机推荐
- intellij idea设置打开多个文件显示在多行tab上
- 【PAT甲级】1110 Complete Binary Tree (25分)
题意: 输入一个正整数N(<=20),代表结点个数(0~N-1),接着输入N行每行包括每个结点的左右子结点,'-'表示无该子结点,输出是否是一颗完全二叉树,是的话输出最后一个子结点否则输出根节点 ...
- Go_defer
package main import "fmt" func main() { //外围函数 /* defer的词义:"延迟","推迟" 在 ...
- vue卸载与安装+vue创建项目
vue卸载 npm uninstall -g vue-cli npm install -g @vue/cli 和 npm install -g @vue/cli-init 命令安装新版本vue-cli ...
- SQL语句,pymysql模块,sql注入问题
一.完整版SQL语句的查询 select distinct post,avg(salary) from table where id > 1 group by post` having avg( ...
- SQL中AVG、COUNT、SUM、MAX等聚合函数对NULL值的处理
一.AVG() 求平均值注意AVE()忽略NULL值,而不是将其作为“0”参与计算 二.COUNT() 两种用法 1.COUNT(*) 对表中行数进行计数不管是否有NULL 2.COUNT(字段名) ...
- 谈谈一些有趣的CSS题目-- 单行居中,两行居左,超过两行省略
开本系列,讨论一些有趣的 CSS 题目,抛开实用性而言,一些题目为了拓宽一下解决问题的思路,此外,涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果解题中有你感觉 ...
- Tomcat部署Web项目的3种方式
一.将war包丢进webapps 这是最简单粗暴的方式:将web工程打成war,丢进tomcat/webapps目录即可,tomcat会自动解压.无需修改任何配置文件即可完成部署. 这里我准备了tom ...
- canvas的beginPath和closePath
https://www.cnblogs.com/xuehaoyue/p/6549682.html https://segmentfault.com/a/1190000010330319 https:/ ...
- CSS-复选框默认样式修改
在css文件中添加如下代码 input[type='checkbox'] { -webkit-appearance: none; background: #fff url('../../static/ ...