[Xerte] use of isFunc and passing of parameters

Julian Tenney Julian.Tenney at nottingham.ac.uk
Tue Apr 20 10:46:16 BST 2010


With respect to args.

There is only one args: _level0.engine.args[0]. If you pass a function
containing args to a new function, args will be replaced with args.

I would always get args in the first line of the funciton

myVar = args[n]

and then call any new functions passing myVar.

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



Isn't navToPage an internal Xerte function?

Just wondering if there is danger in naming a custom function by the
same name as an internal Xerte one.


----------------------------------------
> 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=PI
D28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
 		 	   		  
_________________________________________________________________
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=PI
D28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4___________________________
____________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte


More information about the Xerte mailing list