ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 11th, 2005, 08:13 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
Work with me on this please. (arrays and loops)

OK, I am trying to create a 100 by 100 area with images for each space..... they will start out as a plain square if no one has clicked on them yet, then as the user clicks on each, that image will change from a square to a squre with an x in it? Simple enough

When they login I want it to be a new 'day' with a fresh start, so I set all the square as 'new' (square with no x)...

This is how far i've gotten

Then as they click each box, they turn to x's.. how can i go about doing this? I am new to cf and this is my first attempt at an array..
here is what i have so far.. please tell me if there is a better way to do this.

Code:
<!--Creating 'Map' if one does not already exist-->
<cfif NOT structkeyexists(session, "Map")>
<cfset arrMap = arraynew(1)/>
<cfloop index="Counter" From="1" To="100">
<cfset arrMap[#counter#] = "New"/>
<cfif variables.arrMap[#counter#] EQ 'New'>
<cfoutput>
<a href="nextpage.cfm?area=#counter#">
<img src="/map/image1.gif"></a>
<cfelse>
<a href="nextpage.cfm?area=#counter#">
<img src="/map/image2.gif"></a>
</cfoutput>
</cfif>
<cfif counter is '100'>
<cfset session.Map = 'Created'>
</cfif>
</cfloop>
</cfif>

Reply With Quote
  #2  
Old June 12th, 2005, 01:18 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,655 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 13 h 29 m 8 sec
Reputation Power: 53
Sorry, I'm not following what you are trying to do. You want to create an array of 100 elements, where each one of those elements has 100 elements (kind of like an Excel spreadsheet with 100 rows and 100 columns)? That's a two-dimensional array, that you'd create with "<cfset myArray = arrayNew(2) />".
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old June 12th, 2005, 05:45 AM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
Hi can you give me a little bit more help/example?
I attached a pic of what I mean. I just want it to show 100 by 100 squares that user can click on.. then once they click on it, i want that square to have an x on it.

Quote:
Originally Posted by kiteless
Sorry, I'm not following what you are trying to do. You want to create an array of 100 elements, where each one of those elements has 100 elements (kind of like an Excel spreadsheet with 100 rows and 100 columns)? That's a two-dimensional array, that you'd create with "<cfset myArray = arrayNew(2) />".
Attached Images
File Type: gif pic.gif (217.0 KB, 247 views)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Work with me on this please. (arrays and loops)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway