在自定义的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: ...
随机推荐
- input file弹出框选择文件后缀限制
在页面选择文件时的弹出框默认显示的是所有类型的文件,有时候文件太多不好选择,我们就要过滤掉不想展示的文件,这是需要用到input的accept属性,只有在type="file"才有 ...
- ubuntu14.04安装google chrome
安装好Ubuntu14.04之后安装google chrome浏览器 1.按下 Ctrl + Alt + t 键盘组合键,启动终端 2.在终端中,输入以下命令 (将下载源加入到系统的源列表.命令的反馈 ...
- opencv:边缘提取
#include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace st ...
- C9300升级-TFTP
1.操作命令:CAT9300(config)#ip tftp blocksize 8192CAT9300(config)#install add file tftp://10.1.100.37/cat ...
- 【音乐欣赏】《TIT FOR TAT》 - MYTH & ROID
曲名:TIT FOR TAT 作者:MYTH & ROID [00:00.000] 作曲 : MYTH & ROID [00:01.000] 作词 : MYTH & ROID ...
- PHP 文件上传之如何识别文件伪装?——PHP的fileinfo扩展可!
问题:文件上传时候需要验证上传的文件是否合法,文件伪装如何识别? 一个简单测试:把txt文件后缀直接改成jpg;上传 <!DOCTYPE html> <html> <ti ...
- 一年读100本书---HHR,NZJ---19年最后4个月
那些自律到极致的人,都拥有了开挂的人生.生物钟,绝对一致之后,一切都会很高效. 19年最后一个季度的HHR计划:还剩下3个月的时间,主要搞定几件事情:创业(以太一堂,混沌大学),工作能力(推荐算法工程 ...
- JSON parse error: default constructor not found. class java.time.YearMonth; nested exception is com.alibaba.fastjson.JSONException: default constructor not found. class java.time.YearMonth
java8新出的YearMonth可以方便的用来表示某个月.我的项目中使用springmvc来接收YearMonth类型的数据时发现 x-www-from-urlencoded 格式的数据可以使用&q ...
- 【C语言】赋值运算中的类型转换
#include<stdio.h> int main() { int a, b; double x = 1.54; char ch; a = x; x = ; b = 'a'; ch = ...
- enviroment linux jdk and git and maven
#java_home export JAVA_HOME=/usr/local/java/jdk1.8.0_211 export JRE_HOME=$JAVA_HOME/jre export CLASS ...