首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

求教高手,NumericStepper 作为itemrenderer 内存上溢,该怎么解决

2012-02-29 
求教高手,NumericStepper 作为itemrenderer 内存上溢代码如下,麻烦高手给试运行一下:XML code?xml versio

求教高手,NumericStepper 作为itemrenderer 内存上溢
代码如下,麻烦高手给试运行一下:

XML code
<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"                            xmlns:s="library://ns.adobe.com/flex/spark"                            xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">        <s:layout>                <s:BasicLayout/>        </s:layout>        <fx:Script>                <![CDATA[                        import mx.collections.ArrayCollection;                        [Bindable]                        public var dgArray:ArrayCollection = new ArrayCollection([                                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:10},                                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:2},                                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4},                                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4},                                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4},                                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4}                        ]);                ]]>        </fx:Script>        <fx:Declarations>                <!-- 将非可视元素(例如服务、值对象)放在此处 -->        </fx:Declarations>        <mx:AdvancedDataGrid dataProvider="{dgArray}" width="400" height="400">                <mx:columns>                        <mx:AdvancedDataGridColumn headerText="ceshi" dataField="daizuo">                                <mx:itemRenderer>                                        <fx:Component>                                                <mx:NumericStepper value="{data.daizuo}"  minimum="1" maximum="{data.daizuo}" stepSize="1" >                                                </mx:NumericStepper>                                        </fx:Component>                                </mx:itemRenderer>                        </mx:AdvancedDataGridColumn>                </mx:columns>        </mx:AdvancedDataGrid></s:Application>

我的需求是,从数据源中取出daizuo 属性,作为最大值和当前值. 可是有问题,麻烦大哥们帮忙一下,先谢过了,小弟学flex不久,折腾一晚上了

[解决办法]
这个很简单,自己多实践下就可以了。
JScript code
<?xml version="1.0" encoding="utf-8"?><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"                xmlns:s="library://ns.adobe.com/flex/spark"                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">    <fx:Declarations>        <!-- 将非可视元素(例如服务、值对象)放在此处 -->    </fx:Declarations>        <fx:Script>        <![CDATA[            import mx.collections.ArrayCollection;            [Bindable]            public var dgArray:ArrayCollection = new ArrayCollection([                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:10},                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:2},                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4},                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4},                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4},                {foodName:"AA",tableNum:"男性",deliveredNum:"30",daizuo:4}            ]);        ]]>    </fx:Script>        <mx:AdvancedDataGrid dataProvider="{dgArray}" width="400" height="400">        <mx:columns>            <mx:AdvancedDataGridColumn headerText="ceshi" dataField="daizuo" itemRenderer="NumberCustom">                            </mx:AdvancedDataGridColumn>        </mx:columns>    </mx:AdvancedDataGrid></s:Application> 

热点排行