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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActionScript Multiple Movie Clip Problem...

Status
Not open for further replies.

RISTMO

Programmer
Nov 16, 2001
1,259
US
This is my movie -- it's all code. It's supposed to output a "block" of little blocks, as you can see if you uncomment the commented part and comment out the part right above it ... the problem is that when I paste this part of the script into the full movie, it doesn't work right.... If more info is needed, I'll paste the full movie, but this is the part that doesn't work. I'm assuming that someone who knows what they're doing will know what's wrong...

Code:
var nBlockBuilderX:Number = 0;
var nBlockBuilderY:Number = 0;
var nBlockWidth:Number = 35;
var nBlockHeight:Number = 13;
var aColors:Array = new Array("0xC0C0C0","0x339933","0x333399","0x993333");

function randRange(min:Number, max:Number):Number {
  var randomNum:Number = Math.round(Math.random()*(max-min))+min;
  return randomNum;
}

MovieClip.prototype.rectangle_1 = function(w, h, x, y) {
	this.moveTo(x, y);
	this.lineTo(x + w, y);
	this.lineTo(x + w, y + h);
	this.lineTo(x, y + h);
}

for(var j:Number=0;j<10;j++){
	for(var i:Number=0;i<10;i++){
		//---------------------------------------------------------------
		/*this.createEmptyMovieClip("clip" + i + j, this.getNextHighestDepth());
		Enum("clip" + i + j).lineStyle(1, aColors[randRange(0, aColors.length)], 100);
		Enum("clip" + i + j).beginFill(aColors[randRange(0, aColors.length)], 100);
		Enum("clip" + i + j).rectangle_1(nBlockWidth, nBlockHeight, nBlockBuilderX, nBlockBuilderY);
		Enum("clip" + i + j).endFill();
		nBlockBuilderX += nBlockWidth;
		Enum("clip" + i + j).onRelease = function():Void {
			trace("ouch!");
		};*/
		//---------------------------------------------------------------
		//Shows blocks but doesn't allow for movie to be controlled in full movie....
		/*var c0 = this.createEmptyMovieClip("clip" + i, this.getNextHighestDepth());
		c0.lineStyle(1, aColors[randRange(0, aColors.length)], 100);
		c0.beginFill(aColors[randRange(0, aColors.length)], 100);
		c0.rectangle_1(nBlockWidth, nBlockHeight, nBlockBuilderX, nBlockBuilderY);
		c0.endFill();
		nBlockBuilderX += nBlockWidth;
		c0.onRelease = function():Void {
			trace("ouch!");
		};*/
		//---------------------------------------------------------------
	}
	nBlockBuilderY += nBlockHeight;
	nBlockBuilderX = 0;
}

Thanks!
Rick

RISTMO Designs: Rockwall Web Design
Arab Church: Arabic Christian Resources
Genuine Autos: Kaufman Chevrolet & Pontiac Dealer
Rick Morgan's Official Website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top