8 sides?

Great Scottish Terriors! How do I draw an octagon in Flash?

Powerful thanks!

D

What do you mean?

MovieClip.prototype.drawOctagon = function(r, x, y) {
	this.lineStyle(1, 0, 100);
	this.moveTo(x+r, y);
	for (var a = 45; a<=360; a += 45) {
		var toX = r*Math.cos(a*Math.PI/180);
		var toY = r*Math.sin(a*Math.PI/180);
		this.lineTo(toX+x, toY+y);
	}
};
this.createEmptyMovieClip("octagon", 0).drawOctagon(80, 100, 100);

like that? =)

Wow, that AS looks smooth! But it’s going to produce a 3-dimensional, right??? I’m just looking to draw a simple “stop sign”.

Thanks for the script though. I’ll put it in my bag of good things.

:slight_smile:

nope… it will draw a simple 2d octagon.

MovieClip.prototype.stopSign = function(r, x, y) {
	this.lineStyle(2, 0, 100);
	this.beginFill(0xFFCC00, 100);
	this.moveTo(r, 0);
	for (this.a = 0; this.a<=360; this.a += 45) {
		this.x = r*Math.cos(this.a*Math.PI/180);
		this.y = r*Math.sin(this.a*Math.PI/180);
		this.lineTo(this.x, this.y);
	}
	this.endFill();
	this.createTextField("myStop", 0, 0, 0, 0, 0);
	this.myFormat = new TextFormat("Verdana", 12, 0, 1, 0, 0, 0, 0, "left", 0, 0, 0, 0);
	this.myStop.setNewTextFormat(this.myFormat);
	this.myStop.text = "Stop";
	this.myStop.autoSize = true;
	this.myStop._x = -this.myStop._width/2;
	this.myStop._y = -this.myStop._height/2;
	this._x = x;
	this._y = y;
};
this.createEmptyMovieClip("myStopSign", 0).stopSign(40, 100, 100);

i’m bored… :stuck_out_tongue:

Sweet!

I’m no longer bored. :ub:

:stuck_out_tongue: :wink:

Cool, makes this look even better, cause this is what I was thinking:

  1. Make a square, turn it 45 degrees
  2. Make another square, plop it on top
  3. Select and remove the points
  4. That’ll be a trout slap for me :trout:

Hmmm.
I’ll stick to Paint, sorry guys…
(-:

  1. one more slap. :trout:

:stuck_out_tongue: j/k :wink:

Thunder …

Hmm, that ain’t lookin’ like no stop sign, bro. :crazy: Nice swimmer suit though. :sure:

D

What are you talking about? I think it does! Sure, it’s not as fancy, or neat, or cool, or…crap. Well, this is what I ment. Trout slap me if you feel the need; I’m okay with that…
(-:

Wow! Nice work. That’s definitely a STOP SIGN.

Nice touch with the word STOP in the middle. (-: Most authentic.

Thanks!

D

Thank You!!! Thank You!!!
Allright, I’ll stop now.