Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I Buld a floorplan from data in table

Status
Not open for further replies.

KP7769

Programmer
Sep 2, 2002
5
US
I am trying to build a floor plan dynamically. My database can tell me what picture to use and where to put it(X and Y Coordinates) but I can't seem to find a way to make this happen in Flash. I am selling booths for an auction and need booth availability updated automatically by the data. So if a booth is sold the next refresh or load will show the booth as red. There can be hundreds of these booths. Here is what I want to the finsh product to look like. Each square is a booth and a separate jpg or gif.


Any help would be great. Thanks
 
this might give you a nudge in the right direction

for(i=0;i<totalboxes;i++){
_root.createEmptyMovieClip(i, 100+i);
// perhaps some sort of conditional statement here to control color of boxes drawn
_root.lineStyle(2, 0xCCCCCC, 100);
_root.beginFill(0xCC6633, 100);
//alter this for size of boxes and position on stage
_root.moveTo(-12, -12);
_root.lineTo(12, -12);
_root.lineTo(12, 12);
_root.lineTo(-12, 12);
_root.endFill(-12, -12);
_root._x=((130)+(i*35));
_root._y=20;
}
}

as i said this is not a full solution but hopefully will get you started
 
Thanks,
I think that will get me going. Just two questions. Does this code go in the onload and can I programmatically add a click event to each of these squares? I need to be able to send an email if a person clicks on a square to reserve it or buy it. I am not sure that Flash is the right program for this which is why I am asking all this before I start it. I beleive I can do all this in ASP but I already know it will be large. I am hoping Flash will be easier and faster performance.
Thanks again I really appreciate the information.
 
I have made an xml based plot system, hows this:



The main function:

Code:
// stop timeline
stop ();
// declare vars
var total = 5;
var count = 0;
// set clr function
function setClr (plot, clr) {
	_root[plot].pClr.setRGB(clr);
}
// load xml
var pXML = new XML();
pXML.onLoad = convertXML;
pXML.load(&quot;plots.xml&quot;);
function convertXML () {
	if (pXML.loaded) {
		for (var i = 0; i<pXML.childNodes[2].childNodes.length; i++) {
			state = pXML.childNodes[2].childNodes[i].attributes.state;
			if (state != null) {
				count++;
				if (state == &quot;sold&quot;) {
					clr = 0xff0000;
				} else if (state == &quot;res&quot;) {
					clr = 0x0000ff;
				} else {
					clr = 0xffffff;
				}
				setClr(&quot;plot&quot;+count, clr);
			}
		}
	} else {
		convertXML();
	}
}
Regards
David Byng
bd_logo.gif

davidbyng@hotmail.com
 
you can regard movieclips as buttons in mx so on release works with clips

adding this to my code above
_root.onRelease = function() {
geturl(mailto: etc etc );
}

all code goes on main timeline
 
oops..should be
_root.onRelease = function() {
geturl(mailto: etc etc );
}
 
Thansk so much Guys. It is starting to make sense now. I think I can get what I want from this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top