<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML 
dir=ltr><HEAD><TITLE>Problem getting accurate count of pages in framework</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=555150017-13102008><FONT face=Verdana 
color=#0000ff size=2>I still have not got this to work. What icon id should be 
used for the icon property of the Event Interaction? I've tried the icon id of 
the framework, the icon id of the page holding the framework, rootIcon, and the 
icon id of the first child page of the framework -- in the first three cases I 
get 'undefined' as the value of aboutDPFrame.pages.length, and in the last case 
I get 0 (which doesn't surprise me). And should the onPageOpen be within the 
onInit event, or should that be a separate event?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=555150017-13102008><FONT face=Verdana 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=555150017-13102008><FONT face=Verdana 
color=#0000ff size=2>Paul</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> xerte-bounces@lists.nottingham.ac.uk 
  [mailto:xerte-bounces@lists.nottingham.ac.uk] <B>On Behalf Of </B>Julian 
  Tenney<BR><B>Sent:</B> Wednesday, October 08, 2008 2:43 PM<BR><B>To:</B> Xerte 
  discussion list<BR><B>Subject:</B> RE: [Xerte] Problem getting accurate count 
  of pages in framework<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV id=idOWAReplyText86825 dir=ltr>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2>An .rlo is an xml tree. It 
  is parsed sideways like an AW dive. Content is created as each node is 
  encountered:</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>//this is really what the engine 
  does...</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2>function parse(node){ //a 
  node from the .rlo file's xml</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; //do things with the node - like 
  create an icon or execute some script</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; //instantiate classes using the 
  information from the xml node to create icons</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; //icons will intialise before this 
  code continues</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; //script icons are executed here 
  too, in engine scope</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; </FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; //then loop over each child of 
  node, calling this function recursively</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; for (var i = 0; i &lt; 
  node.childNodes.length; i++){</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 
  parse(node.childNodes[i]);</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; }</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>&nbsp; //decide whether to break or 
  continue?</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2>}</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial color=#000000 size=2>As the tree is parsed, the 
  entry frame and it's content is created. At this point the rest of the 
  framework's xml hasn't been parsed.</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>Flow moves to the next child node of the 
  framework's xml - the first page. The page is created and it's content's 
  parsed. The second page hasn't been parsed yet, so 1 of 1 is expected. 
  </FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>Only then are&nbsp;the rest of the pages 
  are created - but - by definition - you cannot place code in page 1 that will 
  execute afterwards.</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>for that very reason there is the onInit 
  event. This event is broadcast by rootIcon when the initial parse IS complete. 
  Use this in the entry frame to initialise your interface, and use onPageClose 
  / onPageOpen rather than have code in each page to set the interface items. 
  onInit will correct give you fw.pages.lenth, and onPageClose / onPageOpen are 
  more elegant / easier to maintain than code on each page.</FONT></DIV>
  <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV dir=ltr><FONT face=Arial size=2>J</FONT></DIV></DIV>
  <DIV dir=ltr><BR>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> xerte-bounces@lists.nottingham.ac.uk on 
  behalf of Paul Swanson<BR><B>Sent:</B> Wed 08/10/2008 17:53<BR><B>To:</B> 
  xerte@lists.nottingham.ac.uk<BR><B>Subject:</B> [Xerte] Problem getting 
  accurate count of pages in framework<BR></FONT><BR></DIV>
  <DIV>
  <P><FONT face=Verdana size=2>I'm adding a "Page x of y" to a framework, and 
  I'm not getting the correct value for y (the number of pages in the 
  framework).</FONT></P>
  <P><FONT face=Verdana size=2>I'm using an Entry Frame to the framework, and 
  within that is a text icon with an id of aboutDPCounter. The framework id is 
  aboutDPFrame. On each page, I include a script icon with the 
  following:</FONT></P>
  <P><FONT face=Verdana size=2>aboutDPCounter.setText('Page ' + 
  (aboutDPFrame.currentPage + 1) + ' of ' + aboutDPFrame.pages.length;</FONT> 
  </P>
  <P><FONT face=Verdana size=2>When I enter the framework, which currently has 
  two pages of content, the page counter reads "Page 1 of 1." When I go to the 
  next page, it reads "Page 2 of 2," and when I back to the first page it reads 
  "Page 1 of 2." If I then advance to page 2, it reads "Page 2 of 2."</FONT></P>
  <P><FONT face=Verdana size=2>What's going on? I would expect 
  myFramework.pages.length would be consistent. It appears as though it doesn't 
  count the page until you've actually navigated to it.</FONT></P>
  <P><FONT face="Courier New" color=#808080 
  size=2>_____________________________</FONT> </P>
  <P><FONT face="Courier New" color=#808080 size=2>&nbsp;Paul Swanson</FONT> 
  <BR><FONT face="Courier New" color=#808080 size=2>&nbsp;Instructional 
  Designer</FONT> <BR><FONT face="Courier New" color=#808080 
  size=2>&nbsp;Harland Financial Solutions</FONT> <BR><FONT face="Courier New" 
  color=#808080 size=2>&nbsp;800.274.7280 Ext. 2462</FONT> <BR><FONT 
  face="Courier New" color=#808080 
  size=2>&nbsp;Paul.Swanson@harlandfs.com</FONT> <BR><FONT face="Courier New" 
  color=#808080 size=2>_____________________________</FONT> 
</P></DIV></BLOCKQUOTE></BODY></HTML>