[Xerte] What is the correct way to set the
propertiesofscriptduplicated text Icons?
Julian Tenney
Julian.Tenney at nottingham.ac.uk
Tue Oct 6 10:30:47 BST 2009
Any chance you want to show what you're doing? It sounds interesting...
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Johnathan
Kemp
Sent: Tuesday, October 06, 2009 10:15 AM
To: Xerte discussion list
Subject: RE: [Xerte] What is the correct way to set the
propertiesofscriptduplicated text Icons?
Hello Julian,
Thanks for your help I have been able to solve my problems with this
now.
Kind regards
Johnathan
Johnathan Kemp
ICT Development Coordinator
Connexions Staffordshire
www.cxstaffs.co.uk <http://www.cxstaffs.co.uk/>
01785 355714
________________________________
From: Julian Tenney [mailto:Julian.Tenney at nottingham.ac.uk]
Sent: 05 October 2009 09:36
To: Xerte discussion list
Subject: RE: [Xerte] What is the correct way to set the properties
ofscriptduplicated text Icons?
Maybe:
- create an array, with objects in it, one for each key:
myArray = [{note:'C', x:25, y100}, ...etc]
Then duplicate the icons. Use the array to position them: so refernce
the array from the icon properties:
so for x:
myArray[icon.index()].x
etc.
Use a similar expression in the text icon to show the text:
{myArray[icon.index()].note}
________________________________
From: xerte-bounces at lists.nottingham.ac.uk on behalf of Johnathan Kemp
Sent: Mon 05/10/2009 09:23
To: Xerte discussion list
Subject: [Xerte] What is the correct way to set the properties of
scriptduplicated text Icons?
Hello Xerte Team,
I am trying to develop a Xerte project that will display the keyboard of
a button accordion, with the user able to select from a range of
keyboard sizes.
I have tried two different approaches to achieving this, both on the
same basic idea of having a page with a text Icon that is then
duplicated as many times as there are keys on the keyboard, by script at
run time.
Which ever method I use I have not been able to correctly change the
newly generated textIcon properties.
I am sure it must be something simple I am missing.
I need to be able to change the x and y properties to position the key,
To change its text to display the Note of the key,
to change its colour and its alpha property and to draw a circular
border around it.
I think once I can get the correct expression to change one property I
will be able to resolve everything else, because then the correct syntax
for accessing the icon, to get at its properties and methods will have
been identified.
Can you give me an example of how I should be setting the properties, so
that I can stop banging my head against the wall ? :-)
Method 1. By using duplicateIcon
Page
textIcon (id = protoKey)
script
I use the following in the script
=============================================================
allKeys = new Array();
allKeys[0]= protoKey.duplicateIcon(0);
allKeys[1]= protoKey.duplicateIcon(0);
// this is a test my intention will be to use a loop to create the
elements of the array
// that will repeat once for each key on the keyboard
// new icons are created but I cannot set the properties.
allKeys[0].clip()._y=100;
// this is shifting the whole project display, leaving a blank area 100
deep at the top of the project
============================================================
Method 2. By using duplicate
Page
script
textIcon (no ID)
I then use in the script
===============================================
// create the number of text icons - each text icon will eventually be a
key on the keyboard display
if (icon.attributes.built != "true"){
icon.nextSibling.duplicate(5);
icon.attributes.built = "true";
// the figure 5 is for testing to prove the concept, eventually it will
be set by the user in an earlier
// interaction when they select the keyboard size
// create an array of the text icons
allKeys = new Array();
allKeys = icon.parentNode.findChildNodes("type","text");
// I then want to be able to set properties for allKeys[0], allKeys[1]
etc.
================================================
Kind regards
Johnathan
Johnathan Kemp
ICT Development Coordinator
Connexions Staffordshire
www.cxstaffs.co.uk
01785 355714
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 at cxstaffs.co.uk
Connexions Staffordshire Limited is registered in England No.4355170
Registered office: Foregate House, 70 Foregate Street, Stafford,
Staffordshire, ST16 2PX
_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte
________________________________
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 at cxstaffs.co.uk
Connexions Staffordshire Limited is registered in England No.4355170
Registered office: Foregate House, 70 Foregate Street, Stafford,
Staffordshire, ST16 2PX
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20091006/1f3388f6/attachment.html
More information about the Xerte
mailing list