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:345125
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm