For this article we are going to draw something with a little complexity to better compare the two languages. I have chosen a warning icon I made in Photoshop.
var phi = Math.tan((this.width/2) / this.height); var x = this.innerBorder / Math.cos(phi); var y = x / Math.tan(phi); var gamma = Math.sqrt(Math.abs(this.innerBorder*this.innerBorder-x*x));
var phi:Number = Math.tan((iconWidth/2) / iconHeight); var x:Number = innerBorder / Math.cos(phi); var y:Number = x / Math.tan(phi); var gamma:Number = Math.sqrt(Math.abs(innerBorder*innerBorder - x*x));
The code is similar in both languages, but two differences appear immediately and will be consistent throughout this article: