[Xerte] use of isFunc and passing of parameters

Julian Tenney Julian.Tenney at nottingham.ac.uk
Tue Apr 20 16:05:09 BST 2010


It's not ideal , but they'll just overwrite each other

-----Original Message-----
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of johnathan.kemp at ntlworld.com
Sent: Tuesday, April 20, 2010 4:06 PM
To: Dave Burnett
Cc: Xerte discussion list
Subject: RE: [Xerte] use of isFunc and passing of parameters

Dave,

I thought that in Xerte each page existed separately, i.e. the code for the page was only loaded when that particular page was being displayed, so that in practice only one copy of the navToPage function would exist at any one time.

Am I wrong in this assumption?

Kind regards

Johnathan
---- Dave Burnett <d_b_burnett at hotmail.com> wrote: 
> 
> 
> Johnathan, one thing to look out for is you have 3 identical function script icons called "navToPage".
> I think that may lead to some weird issues when it comes to debugging.
> 
> ----------------------------------------
> > Date: Mon, 19 Apr 2010 23:46:07 +0100
> > From: johnathan.kemp at ntlworld.com
> > To: d_b_burnett at hotmail.com
> > Subject: RE: [Xerte] use of isFunc and passing of parameters
> > CC: xerte at lists.nottingham.ac.uk
> >
> > I have attached a zipped up sample xerte project.
> >
> > If you unzip it and open it in Xerte you will be able to see what I am referring to.
> >
> > The use of href="asfunction:_level0.engine.navToPage,destPageName", appears to be setting the value of args[0] such that the value of the passed parameter when using navToPage(pageName) is ignored.
> >
> > The only solution I have found is to set args[0] in the script that calls the function and then to pass args[0] as the parameter, e.g.
> >
> > args[0] = hsData.hotspot[icon.parentNode.index()].destination;
> > navToPage(args[0]);
> >
> > This does not feel right. I don't understand what it is that the hyperlink approach is doing that is affecting the receipt of the passed parameter.
> >
> > Any ideas would be most welcome.
> >
> > Kind regards
> >
> > Johnathan
> >
> > ---- Dave Burnett  wrote:
> >>
> >>
> >> Do you have a sample file I could take a peek at?
> >>
> >> Dave
> >>
> >> ----------------------------------------
> >>> Date: Sun, 18 Apr 2010 22:33:38 +0100
> >>> From: johnathan.kemp at ntlworld.com
> >>> To: xerte at lists.nottingham.ac.uk
> >>> Subject: Re: [Xerte] use of isFunc and passing of parameters
> >>>
> >>> Just to clarify my first posting.
> >>>
> >>> I originally tested the second method, that of calling the function from a script e.g. navToPage(parameter1,parameter2,parameter3), but found that only parameter 1 was passed through to the function as args[0]. args[1] and args[2] were undefined. However this still left me with the situation where if I had two wizards.
> >>>
> >>> The routed hotspot wizard that called the function from a script using navToPage(destPageName)
> >>>
> >>> and
> >>>
> >>> The routed text wizard that called the function using href="asfunction:_level0.engine.navToPage,destPageName"
> >>>
> >>> Pages created with the routed hotspot wizard work fine until a page based on the routed text wizard is used to redirect the user to a page based on the routed hotspot wizard. At which point the args[0] from the routed text page appears to persist so that the routed hotspot page effectively redirects to itself, rather than the page name passed to it.
> >>>
> >>> The only solution appears to redefine args[0] to the destination page and then call navToPage(destPageName)
> >>>
> >>> I hope this makes things a bit clearer.
> >>>
> >>> Any ideas as to what is happening here and how to modify things so that the parameter is passed correctly, without the work around would be much appreciated.
> >>>
> >>> Kind regards
> >>>
> >>> Johnathan
> >>>
> >>> ---- johnathan.kemp at ntlworld.com wrote:
> >>>> I am developing a couple of page wizards, both of which provide the capability to define exit points from the page.
> >>>>
> >>>> The first is a text page that allows you to define hyperlinks to other pages in the project. This is supported by a script where isFunc = 1.
> >>>>
> >>>> I am calling it with
> >>>>
> >>>> Routed Tab.
> >>>>
> >>>> The destination page name, in this case rtFinal, is received as args[0] in the script navToPage. It appears only possible to pass one parameter.
> >>>>
> >>>> I have a second wizard based on the hotspot in which any hotspot can have a destination page assigned to it. I have a similar function script in this wizard which is called by the script that runs when the hotspot is clicked on.
> >>>>
> >>>> This script calls the function by navToPage(parameter1,parameter2,parameter3)
> >>>> The results are received by the script in args[0],args[1],args[2]
> >>>>
> >>>> All has worked well when the pages work in isolation, but once the text page has been run this then appears to define the args array at a level that dominates over the hotspot page. The only way I can get this to work is if I set args[0] before I call the function and then pass args[0] as a parameter, otherwise it picks up the value of args[0] set by the text page.
> >>>>
> >>>> Can anyone shed any light on what is going on here?
> >>>> Do I need to declare a new array args at the start of every page?
> >>>> How would you operate two functions in a page if every function is going to handle its parameters as the same array args[]?
> >>>>
> >>>> Kind regards
> >>>>
> >>>> Johnathan
> >>>> _______________________________________________
> >>>> Xerte mailing list
> >>>> Xerte at lists.nottingham.ac.uk
> >>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
> >>>
> >>> _______________________________________________
> >>> Xerte mailing list
> >>> Xerte at lists.nottingham.ac.uk
> >>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
> >>
> >> _________________________________________________________________
> >> The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
> >> http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
>  		 	   		  
> _________________________________________________________________
> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. 
> http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

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


More information about the Xerte mailing list