zoukankan      html  css  js  c++  java
  • 【原创】关于flexviewer中引入图表时报的TypeError #1009解决方法

         在自定义的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;
       }
      
      
    从娃抓起学抓娃
  • 相关阅读:
    php RabbitMQ使用
    phalcon: 开启模板缓存和缓存路径
    phalcon:整合官方多模块功能,方便多表查询
    mysql: 模糊查询 feild like keyword or feild like keyword , concat(feild1,feild2,feild3) like keyword
    php的http数据传输get/post...
    java大数字操作:BigInteger,BigDecimal(浮点型)
    DecimalFormat数据格式函数
    MySQL比like语句更高效的写法locate position instr find_in_set
    mysql中使用instr替换like
    mysql中的多行查询结果合并成一个
  • 原文地址:https://www.cnblogs.com/javasharp/p/3764852.html
Copyright © 2011-2022 走看看