Re: Changing an image depending on slider value in Javascript

Wednesday, February 1, 2012
Needs to be in an external JS file and then added to guiDesigner via
Project Properties > Script Manager

Jarrod

On 2/02/12 12:58 AM, chubby_blade@hotmail.com wrote:
> So am I adding this to an external JS file or straight into the GUI?
>
>
> On Feb 1, 12:16 am, Jarrod Bell<jar...@guilink.com> wrote:
>> Remember JavaScript equality testing needs double equals signs
>> eg. if (value == 2) {
>>
>> Jarrod
>>
>> On 1/02/12 4:13 AM, Terence wrote:
>>
>>
>>
>>> First of all you'll need to change your logic as when value<2, value<3, etc.
>>> conditions are met, it will also trigger actions for value<1. For each of
>>> your 12 images, you would want to set the value to be value =1,
>>> value=2,value=3, etc until value=12.
>>> Than use CF.setJoin to set the path for your image. Your function would
>>> probaly look something like this :
>>> onSliderChanged(join, value) {
>>> if (value = 1) { CF.setJoin("s1", *path for your first image here*); // set
>>> first image here } else if (value = 2) { CF.setJoin("s1", *path for your
>>> second image here*); // set second image here } and etc.
>>> -----Original Message-----
>>> From: commandfusion@googlegroups.com [mailto:commandfusion@googlegroups.com]
>>> On Behalf Of chubby_bl...@hotmail.com
>>> Sent: 01 February 2012 00:48
>>> To: CommandFusion
>>> Subject: Changing an image depending on slider value in Javascript
>>> Hi
>>> Florent originally gave me advice on this matter in the chat room, but I
>>> cant quite see how to get it to work.
>>> I have 12 images which show the different states of a slider and I want them
>>> to change depending on the slider value.
>>> I understand that first I need to watch the slider's join
>>> CF.watch(CF.JoinChangeEvent, "a1", onSliderChanged)
>>> Then add a function to get the image to change
>>> onSliderChanged(join, value) {if (value< 1) { /* set first image here */ }
>>> else if (value< 2) { /* set second image here */ }
>>> etc
>>> But I'm having trouble actually putting this into practice. Assuming my
>>> slider is on a1 and my image is on s1, how do I get it to change?
>>> I've tried loads of comibinations, but no joy so far :-(
>>> Thanks
>>> Rob
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "CommandFusion" group.
>>> To post to this group, send email to commandfusion@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> commandfusion+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/commandfusion?hl=en.- Hide quoted text -
>> - Show quoted text -

--
You received this message because you are subscribed to the Google Groups "CommandFusion" group.
To post to this group, send email to commandfusion@googlegroups.com.
To unsubscribe from this group, send email to commandfusion+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/commandfusion?hl=en.

0 comments:

Post a Comment