<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML dir=ltr><HEAD><TITLE>[Xerte] What is the correct way to set the properties of scriptduplicated text Icons?</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16825" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=123231109-05102009><FONT face=Arial
color=#0000ff size=2>Hello Julian,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=123231109-05102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=123231109-05102009><FONT face=Arial
color=#0000ff size=2>Thanks for your help I have been able to solve my problems
with this now.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=123231109-05102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=123231109-05102009><FONT face=Arial
color=#0000ff size=2>Kind regards</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=123231109-05102009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=123231109-05102009><FONT face=Arial
color=#0000ff size=2>Johnathan</FONT></SPAN></DIV><FONT size=+0><SPAN
class=123231109-05102009><SPAN lang=EN-GB>
<DIV dir=ltr align=left>
<P><FONT face=Arial><FONT size=2><FONT color=#0000ff><SPAN
class=123231109-05102009></SPAN></FONT></FONT></FONT></SPAN></SPAN></FONT><FONT
face=Arial size=2>Johnathan Kemp<BR>ICT Development Coordinator<BR>Connexions
Staffordshire<BR></FONT><A href="http://www.cxstaffs.co.uk/"><FONT face=Arial
size=2>www.cxstaffs.co.uk</FONT></A><BR><FONT face=Arial size=2>01785
355714<BR></P></FONT></DIV>
<P> </P>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Julian Tenney
[mailto:Julian.Tenney@nottingham.ac.uk] <BR><B>Sent:</B> 05 October 2009
09:36<BR><B>To:</B> Xerte discussion list<BR><B>Subject:</B> RE: [Xerte] What is
the correct way to set the properties ofscriptduplicated text
Icons?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV id=idOWAReplyText93806 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Maybe:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>- create an array, with objects in it, one
for each key:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>myArray = [{note:'C', x:25, y100},
...etc]</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Then duplicate the icons. Use the array to
position them: so refernce the array from the icon properties:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>so for x:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>myArray[icon.index()].x</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>etc.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial size=2>Use a similar expression in the text icon
to show the text:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial
size=2>{myArray[icon.index()].note}</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 Johnathan Kemp<BR><B>Sent:</B> Mon 05/10/2009 09:23<BR><B>To:</B>
Xerte discussion list<BR><B>Subject:</B> [Xerte] What is the correct way to set
the properties of scriptduplicated text Icons?<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>Hello Xerte Team,<BR><BR>I am trying to develop a Xerte project
that will display the keyboard of<BR>a button accordion, with the user able to
select from a range of<BR>keyboard sizes.<BR><BR>I have tried two different
approaches to achieving this, both on the<BR>same basic idea of having a page
with a text Icon that is then<BR>duplicated as many times as there are keys on
the keyboard, by script at<BR>run time.<BR><BR>Which ever method I use I have
not been able to correctly change the<BR>newly generated textIcon
properties.<BR>I am sure it must be something simple I am missing.<BR><BR>I need
to be able to change the x and y properties to position the key,<BR>To change
its text to display the Note of the key,<BR>to change its colour and its alpha
property and to draw a circular<BR>border around it.<BR><BR>I think once I can
get the correct expression to change one property I<BR>will be able to resolve
everything else, because then the correct syntax<BR>for accessing the icon, to
get at its properties and methods will have<BR>been identified.<BR><BR>Can you
give me an example of how I should be setting the properties, so<BR>that I can
stop banging my head against the wall ? :-)<BR><BR>Method 1. By using
duplicateIcon<BR>Page<BR> textIcon (id
= protoKey)<BR> script<BR><BR><BR>I
use the following in the
script<BR>=============================================================<BR>allKeys
= new Array();<BR>allKeys[0]= protoKey.duplicateIcon(0);<BR>allKeys[1]=
protoKey.duplicateIcon(0);<BR>// this is a test my intention will be to use a
loop to create the<BR>elements of the array<BR>// that will repeat once for each
key on the keyboard<BR>// new icons are created but I cannot set the
properties.<BR><BR>allKeys[0].clip()._y=100;<BR>// this is shifting the whole
project display, leaving a blank area 100<BR>deep at the top of the
project<BR>============================================================<BR><BR>Method
2. By using duplicate<BR>Page<BR>
script<BR> textIcon (no ID)<BR><BR>I
then use in the script<BR>===============================================<BR>//
create the number of text icons - each text icon will eventually be a<BR>key on
the keyboard display<BR>if (icon.attributes.built != "true"){<BR><BR>
icon.nextSibling.duplicate(5);<BR> icon.attributes.built = "true";<BR>//
the figure 5 is for testing to prove the concept, eventually it will<BR>be set
by the user in an earlier<BR>// interaction when they select the keyboard
size<BR><BR>// create an array of the text icons<BR>allKeys = new
Array();<BR>allKeys = icon.parentNode.findChildNodes("type","text");<BR><BR>// I
then want to be able to set properties for allKeys[0],
allKeys[1]<BR>etc.<BR>================================================<BR><BR><BR>Kind
regards<BR><BR>Johnathan<BR><BR><BR>Johnathan Kemp<BR>ICT Development
Coordinator<BR>Connexions Staffordshire<BR>www.cxstaffs.co.uk<BR>01785
355714<BR><BR>This email and any files transmitted with it are confidential and
are intended solely for the use of the individual(s) or entity(s) to whom they
are addressed. All messages are monitored for virus, high risk files and
inappropriate content. As a result users should be aware that this mail maybe
accessed, read and the right is reserved to reject, return, remove attachments
or delete if considered to be inappropriate or unsuitable. Liability cannot be
accepted for any loss or damage arising from this email (or any attachments) or
from scripts or any virus transmitted.<BR><BR><BR><BR>This communication
represents the originator's personal views and opinions, which do not
necessarily reflect those of Connexions Staffordshire. If you are not the
original recipient or the person responsible for delivering the email to the
intended recipient, be advised that you have received this email in error, and
that any use, dissemination, forwarding, printing, or copying of this email is
strictly prohibited. If you received this email in error, please immediately
reply to the sender or notify
postmaster@cxstaffs.co.uk<BR><BR><BR><BR><BR><BR>Connexions Staffordshire
Limited is registered in England No.4355170<BR><BR>Registered office: Foregate
House, 70 Foregate Street, Stafford, Staffordshire, ST16
2PX<BR><BR>_______________________________________________<BR>Xerte mailing
list<BR>Xerte@lists.nottingham.ac.uk<BR><A
href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</A><BR></FONT></P></DIV><div align=\"center\" style=\"font-family:verdana; font-size:10px;\"><hr width=\"100%\">This email and any files transmitted with it are confidential and are intended solely for the use of the individual(s) or entity(s) to whom they are addressed. All messages are monitored for virus, high risk files and inappropriate content. As a result users should be aware that this mail maybe accessed, read and the right is reserved to reject, return, remove attachments or delete if considered to be inappropriate or unsuitable. Liability cannot be accepted for any loss or damage arising from this email (or any attachments) or from scripts or any virus transmitted.
This communication represents the originator's personal views and opinions, which do not necessarily reflect those of Connexions Staffordshire. If you are not the original recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error, and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you received this email in error, please immediately reply to the sender or notify postmaster@cxstaffs.co.uk
Connexions Staffordshire Limited is registered in England No.4355170
Registered office: Foregate House, 70 Foregate Street, Stafford, Staffordshire, ST16 2PX</div></body></HTML>