2 Replies Latest reply on Mar 5, 2007 11:05 AM by bobk1

    how to change panel title

    bobk1 Level 1
      I have a master/detail view based on code generated by the ColdFusion Application wizard. When a user selects a record in the top panel, the details get displayed in the bottom panel.

      What I want to do is to have the title of the bottom panel dynamically display one of the fields in the record (the patient's name), i.e., whenever a different record is selected the panel title should change.

      I tried giving the panel an ID (pendingDetailPanel). then referring to it in the file which contains the contents of the panel like this:

      <mx:Script >

      But that gives me the following error:

      1120: Access of undefined property pendingDetailPanel.

      How should I go about it?


        • 1. Re: how to change panel title
          First, you cannot do assignments like that outside of a script. Get in the habit of doing all work inside of an initialize or creationComplete handler. Only declare instance (global) variables outside of a function

          Next, you cannot use binding braces in AS.

          What you want to do is have the select operation set the value of a bindable instance variable:

          [Bindable] var _sPatientName:String = "";

          private function onChangePatient(oEvent:Event):void {
          _sPatientName = oEvent.target.selectedItem.patientName;

          And in the panel:
          <mx:Panel title="{_sPatientName }" .../>


          • 2. Re: how to change panel title
            bobk1 Level 1
            Thanks Tracy, that solved the problem. I'm just getting started with Flex - looks like there's a lot to learn:-)