[Xerte] Re: xerte: getting page names

Julian Tenney Julian.Tenney at nottingham.ac.uk
Fri Sep 16 09:00:20 BST 2011


but you know you can create properties based on strings:

myObject['name'] = 'jules';

debug(myObject.name);

prop = "name";
myObject[prop] = "jules";

debug(myObject.name);

________________________________________
From: xerte-bounces at lists.nottingham.ac.uk [xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney [Julian.Tenney at nottingham.ac.uk]
Sent: 15 September 2011 07:40
To: Xerte discussion list
Subject: [Xerte] Re: xerte: getting page names

Names are not good. They aren't unique and can contain invalid characters for a variable name.


________________________________________
From: xerte-bounces at lists.nottingham.ac.uk [xerte-bounces at lists.nottingham.ac.uk] On Behalf Of KnowledgeWare [knowledgeware at kccsoft.com]
Sent: 15 September 2011 04:58
To: Xerte discussion list
Subject: [Xerte] xerte: getting page names

Hello All:

First of all please understand I’m an AS beginner and in over my head, so I don’t want to waste anyone’s time, especially yours Julian. I will figure this out in time and be a better person for it but if anyone has helpful comments on my questions below they are appreciated.

I’ve setup an array to be able to add/track variables throughout a piece (started when I wanted to put the results of a quiz on a page after the quiz, but since the quiz icon/variables have been destroyed when we go to the next page I need to store them somewhere – thus the array).

The array currently tracks by page number (trackingData[4],etc) …I was going to try to do it by page ‘name’ theorizing that that might be easier to handle in the future ( I might be wrong on this). Where I’m lost is on how to get page ‘names’. I was going to try to loop through the main pages of the piece and stuff the names of all the pages (instead of numbers) into the array.

I pulled these code samples below out of the wiki and tried them all in desktop xerte. Only the bottom two get something, and I don’t understand what the bottom one is getting (_level0.engine.IFC.PG_MC24 ).

//pageIcon = myIcon.XMLElement.attributes.name;    //Doesnt work
//pageIcon = Icon.parentNode.XMLElement.attributes.name;   //Doesnt work
//pageIcon = rootIcon.currentPage.XMLElement.attributes.name;  //Doesnt work
//pageIcon = rootIcon.XMLElement[currentPage].name;  //Doesnt work
//pageIcon = rootIcon.XMLElement.currentPage.name;  //Doesnt work

//pageIcon = _level0.contentXML.firstChild.attributes.name;  //Works gets Learning Object name
pageIcon = icon.parentNode.clip(); //the page   //Works gets: _level0.engine.IFC.PG_MC24
debug(pageIcon);

This line below would likely do the job if I could figure out how to swap ‘firstChild’ to an identifier for the page icons I’m looping through:

pageIcon = _level0.contentXML.firstChild.attributes.name

I’m wondering if anyone knows of a good tutorial or helpfile that explains this page naming/hierarchy/child/uncle/auntie stuff – I sense it is the key to a lot of things but I find it highly confusing at this point.

Thanks
RonM2


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


More information about the Xerte mailing list