Select to view content in your preferred language

Communication between widgets

1899
2
06-02-2014 01:30 AM
SaadiaElaarji
Deactivated User
hi,
i'm new in flex, and im working on Webmapping application using flex 4.6, java, and sql server as database, i'm just trying to make a communication between wigdets, i would like to copy each selected item of my combobox in widget1, and show it in the textinput in widget2, i just followed this steps explaind by Robert here http://forums.arcgis.com/threads/13863-Communication-between-widgets?highlight=widget+communication http://forums.arcgis.com/threads/13863-Communication-between-widgets?highlight=widget+communication but no luck, the problem that i'm facing is that i can't call components of the first widget (textinput, button....) from the second widget, they are often underlined !!

at jump you found the change i made,



Widget 1

var layoutArr:ArrayCollection = new ArrayCollection();
   private function widgetCommunication1():void
   {
    addSharedData("Liste des chapitres", layoutArr); 
   }


Widget 2

<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx"
       xmlns:viewer="com.esri.viewer.*"
       width="638" height="552" creationComplete="application1_applicationCompleteHandler(event)" 
       initialize="basewidget1_initializeHandler(event)">

<fx:Script>
  <![CDATA[

                        import com.esri.viewer.AppEvent;
   import mx.events.FlexEvent;
 protected function basewidget1_initializeHandler(event:FlexEvent):void
   {
    ViewerContainer.addEventListener(AppEvent.DATA_PUBLISH, sharedDataUpdated);
   }

 private function sharedDataUpdated(event:AppEvent):void
   {
    var data:Object = event.data;    
    if (data.key == "Liste des chapitres")
     
    {
     dplist.selectedIndex = IntChap.text;
    } 
   } 

]]>
 </fx:Script>

<s:DropDownList id="dplist" x="10" y="10" width="282" height="26" labelField="IntituleChap" dataProvider="{RemoteRapportDao.Selection.lastResult}" change="dplist_changeHandler(event)" ></s:DropDownList>



IntChap wich is on red and bold is the textinput in widget1 , i got it underlined in widget 2, even if i made this communication
any one can tell me what i'm messing ??
any help or code will be appreciated !
Tags (2)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Saadia,

   The principle of widget communication is to pass data (an array collection or object) between widgets, not to allow a component or variable of one widget to be seen and used by another. If you are wanting widget 2 to get the text in the intchap.text then you need to pass that text value in the array collection that is passed from widget 1.
0 Kudos
SaadiaElaarji
Deactivated User
thank you for your reply, it works now 😉
0 Kudos