Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 获取Adobe Flex图表的属性_Actionscript 3_Apache Flex_Flex4 - Fatal编程技术网

Actionscript 3 获取Adobe Flex图表的属性

Actionscript 3 获取Adobe Flex图表的属性,actionscript-3,apache-flex,flex4,Actionscript 3,Apache Flex,Flex4,我需要通过使用/调用相应的图表来获取flex图表的所有属性。 弹性面积图的示例有xField、yField和minField 是否有任何方法可以通过任何方法从每个图表中获取这些属性。图表上没有可以这样做的方法。如果您想了解图表及其系列的属性,则需要通过反射来完成此操作 为此,可以在任何对象上使用全局describeType()方法。这将返回一个包含对象所有属性的XML对象 DescripteType顶部还有一个API,允许更轻松地访问和内省对象:也许这段代码会有用,这是查看ChartBase对象

我需要通过使用/调用相应的图表来获取flex图表的所有属性。 弹性面积图的示例有xField、yField和minField


是否有任何方法可以通过任何方法从每个图表中获取这些属性。

图表上没有可以这样做的方法。如果您想了解图表及其系列的属性,则需要通过反射来完成此操作

为此,可以在任何对象上使用全局describeType()方法。这将返回一个包含对象所有属性的XML对象


DescripteType顶部还有一个API,允许更轻松地访问和内省对象:

也许这段代码会有用,这是查看ChartBase对象的所有信息的示例:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" minWidth="955" minHeight="600" creationComplete="init()">
    <mx:Script>
        <![CDATA[
            import mx.charts.chartClasses.ChartBase;

            public function init():void{
                getInfo(new ChartBase());   
            }

            private function getInfo(obj:Object):void{
                txt1.text = describeType(obj);
                var myXML:XMLList = new XMLList(describeType(obj));
                var info:String = "";
                for each(var node:XML in myXML.children()){
                    switch(node.name().toString())
                    {
                        case "variable":
                        {
                            info = info + "var - " +  node.@name + "\n";    //properties
                            break;
                        }
                        case "accessor":
                        {
                            info = info + "accessor - " +  node.@name + "\n";   //getter-setter
                            break;
                        }
                        case "method":
                        {
                            info = info + "method - " +  node.@name + "\n"; //methods
                            break;
                        }                               
                    }
                    txt2.text = info;
                }

            }
        ]]>
    </mx:Script>
    <mx:Label text="View Information of 'ChartBase' Object"/>
    <mx:HBox width="100%">
        <mx:HBox width="50%">
            <mx:VBox width="100%" height="100%">
                <mx:Label text="All Object Information"/>
                <mx:TextArea id="txt1" width="800" height="800"/>
            </mx:VBox>
        </mx:HBox>
        <mx:HBox width="50%">
            <mx:VBox width="100%" height="100%">
                <mx:Label text="Properties,Accessor and Methods from this Object"/>
                <mx:TextArea id="txt2" width="800" height="800"/>   
            </mx:VBox>
        </mx:HBox>      
    </mx:HBox>
</mx:Application>

基本上,方法
describeType
返回一个包含对象信息的XML


在这里,您可以使用此代码运行SWF

谢谢您宝贵的回复。@user2677772:不客气。我发布的信息能解决这个问题吗?