1 Reply Latest reply on Jan 13, 2010 5:18 PM by Gregory Lafrance

    Inline item <mx:Image ...> in <mx:itemRenderer > could not see the defination of method

    glen08

      I have following code and got a compilation error ("possiblely called an undefined function") because the <mx:Image ...> in the <mx:itemRenderer > could not see the defination of "aMethod" method:

       

      <mx:Form ....>

       

      <mx:Script><![CDATA[

       

      ....

       

      private function aMethod(evt:Event):void {
                 // code...
      }
      ]]></mx:Script>

       

      <mx:Canvas label="Tile View" width="100%" height="100%" >

                ...
                <mx:TileList id="photosTileList" dataProvider="{this.photoDP}" width="100%" height="100%"  >
                          <mx:itemRenderer >
                              <mx:Component>
                                  <mx:Image horizontalAlign="center" source="{data.url.text()}"
                                      toolTip="{data.caption.text()}" width="55" height="38" complete="aMethod(event)"/>  <!-- It causes the error -->
                              </mx:Component>
                          </mx:itemRenderer>
               </mx:TileList>

       

               <mx:Image .... complete="aMethod(event)"/>  <!-- It is OK here -->

      </mx:Canvas>

       

      </mx:Form>

       

      I do not know why the inline <mx:Image> inside <mx:itemRenderer> can not see the "aMethod" function defination in the same mxml file.

      Any suggestions?