2012-11-28 4 views
3

flex 3에서 작업하고 있습니다. mx : Canvas에서 mx : Compnonet을했습니다. 내부 컴포넌트의 캔버스에 선언 된 함수를 호출 할 수 있습니까?내부 컴포넌트의 호출 기능

는 I는 다음과 같이 somethink했습니다

<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를 호출 싶어요. 내가 어떻게 해?

답변

2

사용 outerdocument.someFunction();

구성 요소가 이제 부모가 누구인지 알고 있다면, 구성 요소의 요점은 당신이 주변에 이동 어디서나 배치 할 수 있습니다 그대로
+0

이 항상 해킹 같은 느낌하지만 당신은 outerdocument 호출 할 수 있습니다, 그것은이다 . – MonkeyMagiic