Select to view content in your preferred language

About functions in another components.

896
1
Jump to solution
06-26-2014 06:48 AM
EvelynHernandez
Frequent Contributor
Hello.

Im having a problem with this, i hope u guys can help me.

I have a main app called Lllayllay where i put some title windows adding them as mx component binded with some functions about arcgis map and layers.
Now im trying to change the title windows to a popup because i cannot drag them.
To do that i read something that i need to change those title windows objects to a mxml component, so when i tried to do that i figure out that my functions binded in the main file the new componenr (the other mxml file) cannot be used.
So, how can i call functions from a mxml component that they are being used in the main file?

An example is.

Main app:
A button with click event and a click function to do something with arcgis develop

TWindowComp.mxml
<?xml version="1.0" encoding="utf-8"?> <mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"      xmlns:s="library://ns.adobe.com/flex/spark"      xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:components="org.example.components.*">  <fx:Script>   <![CDATA[    import mx.core.Application;    import mx.core.FlexGlobals;    import spark.components.Application;                protected function exExcelMedidores_clickHandler(event:MouseEvent):void    {     // TODO Auto-generated method stub         }       ]]>  </fx:Script>    <fx:Declarations>   <!-- Place non-visual elements (e.g., services, value objects) here -->  </fx:Declarations>    <s:VGroup width="100%" bottom="5" height="100%">   <s:HGroup width="100%" verticalAlign="middle">    <components:SearchBar id="searchBar" width="100%"/>    <s:Button id="exExcelMedidores" click="generateXLS()"  label="Exportar" width="20%" height="22" />   </s:HGroup>   <s:DataGrid id="dgridEquipos" resizableColumns="true" skinClass="dataGridSkin" sortableColumns="true" contentBackgroundAlpha="1"  width="100%" height="90%" visible="true" editable="false" bottom="1" click="dgridEquipos_clickHandler(event)"   >    <s:columns>     <s:ArrayList>      <s:GridColumn dataField="id_medidor" headerText="ID Equipo"></s:GridColumn>      <s:GridColumn dataField="nis" headerText="NIS"></s:GridColumn>      <s:GridColumn dataField="luminarias" headerText="Cant. Luminarias"></s:GridColumn>      <s:GridColumn dataField="tramos_ap" headerText="Cant. Tramos"></s:GridColumn>      <s:GridColumn dataField="tipo_equipo" headerText="Tipo"></s:GridColumn>     </s:ArrayList>    </s:columns>   </s:DataGrid>  </s:VGroup> </mx:TitleWindow>



The generateXLS function and the dgridEquipos_clickHandler(event) i have them in the main app and i cannot put them out of the main file.

So how can i access them?
Thx in advice!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
EvelynHernandez
Frequent Contributor
I solve the problem putting some event listeners on the main app.
Thx anyways.

View solution in original post

0 Kudos
1 Reply
EvelynHernandez
Frequent Contributor
I solve the problem putting some event listeners on the main app.
Thx anyways.
0 Kudos