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!

Tough one: dynamically-generated reactive polygons 1

Status
Not open for further replies.

PaulPaulPaul

Programmer
Aug 28, 2003
3
CA
This is beyond my experience. Anybody has tips on how
to do this:

A movie will read an xml file containing cartesian coordinates defining polygons.

The movie has to draw the polygons. These polygons need to be more than simple shapes. I have to assign behaviours to them. Each polygon has to:
-store hidden values
-display text when mouse hovers above it
-call functions on click

Moreover, the polygons have to be bundled into groups. The aim is to hide or display a whole group of polygons all at once.

Thanks to all of you.

Paul
 
ok assuming you can pull in the xml and parse it sticking the coordinates into arrays then an adaptation of this will do the trick

this just draws 2 triangles assigns a rollover and an onrelease and gives each a property ( a number)

Code:
Xpoints = [200,300,400,200,20,30,40,20];
Ypoints = [200,100,200,200,20,10,20,20];
for(i=0;i<2;i++){
this.createEmptyMovieClip(&quot;clip&quot;+i,i*10);
	var newClip = eval(&quot;clip&quot; +i)
	with (newClip){
		_x = 100 + 100 * i;
		_y = 50 - 50 * i;
		loop = 1
		newClip.hiddenProp = 66 * i + 3;
		newClip.beginFill(0xffffff, 100);
		lineStyle (1, 0x0000FF, 100);
		moveTo (Xpoints[i*4], Ypoints[i*4]);
		for(a=1;a<4;a++){
		lineTo (Xpoints[a + i*4], Ypoints[a+i*4])};
		loop++;
		newClip.endFill()
		newClip.onRollOver = function(){ trace(this)}
	    newClip.onRelease = function(){ {trace(this.hiddenProp)}	   
		}
	}
}

 
Wow, thanks! I'm going to try that.

The actual requirements call for dynamically-generated (from XML) image maps with transparent reactive zones (the polygons).

The movie is basically empty. It loads a set of background jpegs (paths gotten from XML). Reactive zones are defined for each jpeg. The XML defines how many zones will be assigned to each image, what shape these zones will have, and where they will be placed.

On top of that, the zones have to change color, react to clicks by displaying a select box (also dynamically-generated from XML) and transmit data to the host html page...

But my main problem was what you helped me with. Thank you for getting me started.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top