[Xerte] Re: List component .fla stuff

Julian Tenney Julian.Tenney at nottingham.ac.uk
Tue Apr 5 11:02:40 BST 2011


Yes, a bit more AS3, and that will seem quite naturally the right thing to do!

From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 05 April 2011 10:46
To: Xerte list
Subject: [Xerte] Re: List component .fla stuff


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/e40c2065/attachment.html>


More information about the Xerte mailing list