Your problem is not with the script tag.  What you have would work except that 
you are trying to reference the function within an itemRenderer Component.  
mx:Component creates its own scope.  

You can reference the outer function using outerDocument
click="outerDocument.removeItem(data.idheight)"

Even if removeItem() was in the same file, you could not reference it directly 
inside the in-line renderer.

Tracy Spratt


--- In [email protected], "Paulo Henrique" <paulode...@...> wrote:
>
> Good afternoon people,
> 
> i just started developping with Flex Builder 3 and I seem to have found some 
> issues. Let me explain my situation:
> 
> I have an application on a mxml file.
> In this application i have a AS code file, and I've declared the 'script' 
> block right at the beggining of the application, with the source property 
> pointing to the file.
> This block is praticaly the first thing on the application.
> But the program wouldn't accept when i referenciate some function of the as 
> file, it would accuse that the function might not exist. I put everything 
> back on the mxml, and, another day, i put it back on a as file, but this 
> time, it accepted just fine. Idid not understood or questioned that.
> But yesterday, and today, I am having the same problem.
> I have the following declarations:
> 
> <mx:Script source="CCM.as" />
> <mx:Script>
>  <![CDATA[
>  private var _editWindow:generalEdit_window = new generalEdit_window();
>  ]]>
> </mx:Script>
> <mx:Script source="validation_src.as" />
> <mx:Script source="heights_src.as" />
> 
> right at the bbeggining of the mxml application,
> and after some code I have:
> 
> <mx:DataGridColumn headerText="Options" dataField="" width="70">
>  <mx:itemRenderer>
>  <mx:Component>
>  <mx:Image source="assets/imgs/Erro_X_v3.gif" 
> click="removeItem(data.idheight)"/>
>  </mx:Component>
>  </mx:itemRenderer>
> </mx:DataGridColumn>
> 
> and on the file "heights_src.as" i have:
> 
> private function removeItem(idheight:*):void{
> ....
> }
> 
> I had it as "idheight:int", but I changed to * to see if would make any 
> difference, but nothing happened.
> Even with the function declared, the program still accuses:
> 
> Severity and Description Path Resource Location Creation Time Id
> 1180: Call to a possibly undefined method removeItem. CCM/src CCM.mxml line 
> 120 1256660977276 253
> 
> Right at that "<mx:Image..." line.
> 
> Would anyone here know the reason?
> Do you guys see anything wrong?
> 
> I really could use some help, since I am somewhat begginner at this...
> 
> Thanks for you attention.
> 
> Paul.
>


Reply via email to