Rick,
Is this how you want to source code to look on the page?
<script>
$.sound.play('soundTrack01.mp3[1]');
$.sound.play('soundTrack02.mp3[2]');
$.sound.play('soundTrack03.mp3[3]');
</script>
Here is the code that I used to render it.
<cfset myList = "soundTrack01.mp3,soundTrack02.mp3,soundTrack03.mp3">
<cfset listPosition = 1 />
<script>
<cfloop list="#myList#" index="listElement">
<cfoutput>
$.sound.play('#listElement#[#listPosition#]');
</cfoutput>
<cfset listPosition = listPosition + 1 />
</cfloop>
</script>
or like this
<script>
$.sound.play('soundTrack01.mp3');
$.sound.play('soundTrack02.mp3');
$.sound.play('soundTrack03.mp3');
</script>
Here is the code that I used to render it.
<cfset myList = "soundTrack01.mp3,soundTrack02.mp3,soundTrack03.mp3">
<cfset listPosition = 1 />
<script>
<cfloop list="#myList#" index="listElement">
<cfoutput>
$.sound.play('#listElement#');
</cfoutput>
<cfset listPosition = listPosition + 1 />
</cfloop>
</script>
~Dan
-----Original Message-----
From: Rick Faircloth
Sent: Wednesday, June 08, 2011 2:03 PM
To: cf-talk
Subject: RE: How to do this with CF and JS?
Hmmm... it didn't like that one either:
You have attempted to dereference a scalar variable
of type class java.lang.String as a structure with members.
The error occurred in E:\inetpub\webroot\html5css3\fadeImages3.cfm: line 20
18 : <cfloop list="myList" index="listElement">
19 :
20 : $.sound.play('#myList.name[listPosition]#');
21 : <cfset listPosition = listPosition + 1 />
22 : </cfloop>
-----Original Message-----
From: Drew Nathanson [mailto:[email protected]]
Sent: Wednesday, June 08, 2011 1:45 PM
To: cf-talk
Subject: Re: How to do this with CF and JS?
Rick,
Try this:
<cfset myList = "soundTrack01.mp3,soundTrack02.mp3,soundTrack03.mp3">
<cfset listPosition = 1 />
<cfoutput>
<script>
<cfloop list="myList" index="listElement">
$.sound.play('#myList.name[listPosition]#');
<cfset listPosition = listPosition + 1 />
</cfloop>
</script>
</cfoutput>
I believe your creating more than 1 script file maybe causing you issues.
This is my humble opinion.
Drew Nathanson
Technical Synergy, Inc.
>To be clearer, everything works fine, except for the fact
>that nothing loops. I get the first sound track, "soundTrack01.mp3",
>played once, and then everything stops.
>
>Re-writing the JS into the DOM with every iteration is the
>only other possibility I can think of which will allow the
>JS to be re-initialized with each loop.
>
>
>this doesn't work?
>
> </cfoutput>
>
>> </script>
>>
>> >
>> <cfset listPosition = listPosition + 1 />
>>
>> </cfloop>
>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345126
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm