<!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=881384720-13102008><FONT face=Verdana
color=#0000ff size=2>Here is what I have:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=881384720-13102008><FONT face=Verdana
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=881384720-13102008><FONT face=Verdana
color=#0000ff size=2>A page off the Interface page with an id of 'aboutDP' which
contains a framework with an id of aboutDPFrame. The aboutDPFrame has an Entry
Frame, with an onInit event interaction (eventName = onInit, icon = rootIcon,
erase = 0, exit = 1). To this event is attached a script icon with
'aboutDPpageCount = aboutDPFrame.pages.length;'. The entry frame also includes a
script icon with an id of 'aboutDPCounter' positioned where I want the page
numbers to appear.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=881384720-13102008><FONT face=Verdana
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=881384720-13102008><FONT face=Verdana
color=#0000ff size=2>The framework has a number of pages, each with a script
icon (I'll change to the onPageOpen event once I've got the page count working)
with: aboutDPCounter.setText('Page ' + (aboutDPFrame.currentPage + 1) + ' of ' +
aboutDPCount);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=881384720-13102008><FONT face=Verdana
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=881384720-13102008><FONT face=Verdana
color=#0000ff size=2>What prints is 'Page 1 of undefined', 'Page 2 of
undefined', etc. So I still must not have the event set up
correctly...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=881384720-13102008><FONT face=Verdana
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=881384720-13102008><FONT face=Verdana
color=#0000ff size=2>P</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> Monday, October 13, 2008 1:08 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=idOWAReplyText82891 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>rootIcon fires onInit; all
frameworks fire onPageOpen,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>HTH,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </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> Mon 13/10/2008 18:08<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 dir=ltr>
<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> </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> </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> </DIV>
<DIV dir=ltr><FONT face=Arial size=2> //do things with the node - like
create an icon or execute some script</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2> //instantiate classes using the
information from the xml node to create icons</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2> //icons will intialise before
this code continues</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2> //script icons are executed here
too, in engine scope</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2> </FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2> //then loop over each child of
node, calling this function recursively</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2> for (var i = 0; i <
node.childNodes.length; i++){</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>
parse(node.childNodes[i]);</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2> }</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2> //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> </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> </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> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Only then are 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> </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> </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> Paul Swanson</FONT>
<BR><FONT face="Courier New" color=#808080 size=2> Instructional
Designer</FONT> <BR><FONT face="Courier New" color=#808080
size=2> Harland Financial Solutions</FONT> <BR><FONT face="Courier New"
color=#808080 size=2> 800.274.7280 Ext. 2462</FONT> <BR><FONT
face="Courier New" color=#808080
size=2> Paul.Swanson@harlandfs.com</FONT> <BR><FONT face="Courier New"
color=#808080 size=2>_____________________________</FONT>
</P></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></BODY></HTML>