在自定义的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: ...
随机推荐
- thinkphp新的心得
1,代码的高度复用 1,js的删除,弹出框都可以用嵌入的js,不用每个页面都写 2,控制器的初始化函数可以实现配置某些变量,比如admin模块的topic控制器的初始化函数可以 $this->o ...
- SpringMVC_001 第一个SpringMVC程序
今天我们来学习第一个SpringMVC程序 一.配置开发方式 (1)首先建立一个SpringMVC web程序 (2)导入jar包 (3)建立UserController.java package ...
- MySQL数据完整性
数据完整性 一个数据库就是一个完整的业务单元,可以包含多张表,数据被存储在表中 在表中为了更加准确的存储数据,保证数据的正确有效,可以在创建表的时候,为表添加一些强制性的验证,包括数据字段的类型.约束 ...
- jmeter-BeanShell PreProcessor的使用
BeanShell简介 BeanShell是一个小型嵌入式Java源代码解释器,具有对象脚本语言特性,能够动态地执行标准JAVA语法.在BeanShell中,我们可以使用java语言自定义函数来处理特 ...
- dbGet net trace instant pin
proc rn { net_name } {puts " "puts "Net name : $net_name : "set name_rule [dbget ...
- 中国大学MOOC 邮箱验证的问题
在使用 中国大学 MOOC 过程中,在PC端修改个人资料时,其中有项“常用邮箱”,于是写了QQ邮箱,结果发现一直无法验证,连邮件都无法收到. 经过多番尝试,重新使用邮箱注册的方式注册账号,然后注册成功 ...
- 负环--spfa
洛谷板子题 负环?是有负权边的环还是一个边权之和为负的环? 还没有准确的定义(那就先忽略吧qwq 判断负环的方法: 暴力枚举/spfa/mellman—ford/奇怪的贪心/超神的搜索 可惜我只会sp ...
- opencv:图像直方图相似性比较
void hist_compare(Mat src1, Mat src2) { int histSize[] = { 256, 256, 256 }; int channels[] = { 0, 1, ...
- CLI配置WLAN-PSK认证和802.1X认证
一.该部分配置主要是针对PSK认证 1.创建WLAN 2 2.让WLAN使用PSK的方式 config wlan create 2 OK OK //创建WLAN Profile Name和SSID ...
- 7,请描述下cookies,sessionStorage和localStorage的区别
7,请描述下cookies,sessionStorage和localStorage的区别 首先,cookie是网站为了标识用户身份而储存在用户本地终端(client side,百科: 本地终端指与计算 ...