3

我正在使用 flex 3。我在 mx:Canvas 中有一个 mx:Compnonet,我可以在内部组件上调用在 canvas 中声明的函数吗?

我有这样的想法:

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
       xmlns:flexlib="http://code.google.com/p/flexlib/" xmlns:local="*" 
       horizontalScrollPolicy="off" verticalScrollPolicy="off"
       creationPolicy="all">

    <mx:Script>
        <![CDATA[

            public function someFunction():Boolean {
                //do something
                return someBoolean;
            }

        ]]>
    </mx:Script>

    <mx:Component>
        <mx:HBox width="100%" height="100%" horizontalAlign="left" verticalAlign="middle" paddingLeft="4" paddingRight="8" horizontalGap="4">
            <mx:Script>
                   <![CDATA[
                        private function anotherFunction():Boolean{
                            //do something else
                            //here I need call someFunction()
                        }
                   ]]>
            </mx:Script>

            <mx:Image source="@Embed('/assets/icons/compress_folder_down16.png')" 
                    buttonMode="true" click="this.setFocus(); this.dispatchEvent(new Event('multipleDownload',true));"
                    visible="{this.anotherFunction()}" includeInLayout="{this.anotherFunction()}"/>

        </mx:HBox>
    </mx:Component>

我想在 anotherMethod 中调用 someMethod。我该怎么做?

4

1 回答 1

2

采用outerdocument.someFunction();

于 2012-11-28T14:13:47.533 回答