Lucas Merencia
Lucas Merencia

Reputation: 802

Call Function on Inner Component

I'm working with flex 3. I've a mx:Compnonet in a mx:Canvas, Can I call a function declared in canvas on inner component?

I've somethink like this:

<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>

I wanna call someMethod in anotherMethod. How can I do it?

Upvotes: 3

Views: 151

Answers (1)

ayahya82
ayahya82

Reputation: 386

Use outerdocument.someFunction();

Upvotes: 2

Related Questions