[Xerte] Re: List component .fla stuff

Dave Burnett d_b_burnett at hotmail.com
Tue Apr 5 10:45:52 BST 2011



Right you are.

And apparently you need to manually dispatch the change as well in order to display the result as if it had been clicked:

For the archives:
list component selected selection index set

function init(initObject){
  for (i = 0; i < initObject.glossData.PAGE.length; i++) {
    glosslist.addItem({label:initObject.glossData.PAGE[i].TITLE[0], def:initObject.glossData.PAGE[i].QUES[0]});
  }
  glosslist.selectedIndex = 0;
  glosslist.dispatchEvent({type:"change", target:glosslist});
}


Cheers,
Dave



From: Julian.Tenney at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk
Date: Tue, 5 Apr 2011 08:15:25 +0100
Subject: [Xerte] Re: List component .fla stuff











I think you are setting the selected index before the init function runs.
 


From: xerte-bounces at lists.nottingham.ac.uk [xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett [d_b_burnett at hotmail.com]

Sent: 04 April 2011 20:01

To: Xerte list

Subject: [Xerte] List component .fla stuff







I have a list component that loads up some glossary .xml to populate.

When the user clicks an entry in the left pane listing, the definition appears in the right.



On setup It would be nice to have the default selectedIndex at 0, but I can't get it to do that.

Any ideas?





function init(initObject){

  for (i = 0; i < initObject.glossData.PAGE.length; i++) {

    glosslist.addItem({label:initObject.glossData.PAGE[i].TITLE[0], def:initObject.glossData.PAGE[i].QUES[0]});

  }

}



glosslist.selectedIndex = 0;



//Create listener object.

var listListener:Object = new Object();

listListener.change = function (evt_obj:Object) {

  def_string = "<b>" + evt_obj.target.selectedItem.label + "</b><br>ll<br>" + evt_obj.target.selectedItem.def;   


  deffield.htmlText = def_string;

}



//Add listener.

glosslist.addEventListener("change", listListener);



stop();

   






























This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, 
copy or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.


This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.





_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110405/97c1c9bd/attachment.html>


More information about the Xerte mailing list