[Xerte] Making a page counter in Xerte 1.8 - Solved

Paul Swanson Paul.Swanson at harlandfs.com
Tue Oct 30 20:55:29 GMT 2007


Yep, it's working now. I had actually tried index(), but had one too
many parentNode references, and it was returning zero. I stumbled on
index() kind of accidentally. childIndex() returned "NaN" ('Not a
Number' for those who aren't familiar with NaN), so, out of despiration,
I just changed it to index(); not expecting it to work. But it returned
a number, it's just that it was the same number no matter what page I
inserted it on. I now know that I had one too many parentNode
references, and it was correctly returning the index number of the
framework icon itself. My working code is:
 
slideCounter.setText('Slide ' + icon.parentNode.index() + ' of ' +
(icon.parentNode.parentNode.childNodes.length - 1));
 
Since the first node of the framework is an Entry Frame icon, I don't
need to add 1 to the index to get the content page number, but I do need
to subtract 1 from the length. I can copy this to each content page in a
framework, and it will correctly print "Slide x of y". No icon
references needed.
 
Thanks!
Paul


________________________________

	From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Tenney Julian
	Sent: Tuesday, October 30, 2007 12:44 PM
	To: Xerte discussion list
	Subject: RE: [Xerte] Making a page counter in Xerte 1.8 - Solved
	
	
	You can do xmlNode.index() which will return the index of the
node. 
	Julian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20071030/40b27942/attachment.html


More information about the Xerte mailing list