解决itemRenderer中的进度条问题

时间:2012-05-24 14:02:21

标签: actionscript-3 flex

我有以下代码:

<mx:Script>
    //I WANT TO ADRESS THE FUNCTION INSIDE MY HBOX FROM HERE
</mx:Script>
    <mx:DataGrid id="dg_uploads" x="10" y="10" width="500" height="350" editable="false" variableRowHeight="true">
        <mx:columns>
            <mx:DataGridColumn headerText="progress" sortable="true" paddingLeft="10">
                <mx:itemRenderer>

                    <mx:Component>
                        <mx:HBox>
                            <mx:Script>
                                <![CDATA[
                                public function updateProgress(event:CustomEvent):void {
                                    trace(event);
                                    bar.setProgress( event.data.bytesLoaded, event.data.bytesTotal );
                               }
                               ]]>
                            </mx:Script>
                            <mx:VBox>
                                <mx:ProgressBar id="bar" labelPlacement="top" minimum="0" visible="true" maximum="100" verticalGap="0"
                                                color="0x323232" label="{data.name}" direction="right" mode="manual" fontWeight="bold" trackHeight="10" width="280" bottom="0"/>
                                <mx:ProgressBar id="subbar" mode="manual" direction="right" labelPlacement="bottom" minimum="0" visible="true" label="{data.status}"
                                                maximum="100" width="280" styleName="subBarStyle"/>
                            </mx:VBox>
                            <mx:Image source="images/Clear-Red-Button.png" useHandCursor="true" buttonMode="true" click="outerDocument.deleteItem(event)" />
                            <mx:Image source="images/Clear-Green-Button.png" useHandCursor="true" buttonMode="true" click="outerDocument.stopUploadProcess(event)" />
                        </mx:HBox>
                    </mx:Component>
                </mx:itemRenderer>          
            </mx:DataGridColumn>
        </mx:columns>   
    </mx:DataGrid>

如何从hbox脚本外部解决hbox脚本中的功能?我希望在文档启动时触发它

0 个答案:

没有答案