Internet Resource

Create dynamic button in actionscript

Though it is a very simple tip.May you guys already know how can we create dynamic button in flash as we create textfield dynamically using this MovieClip.createTextField(), In this article, it shows how to creat dynamical button in actionscript. No design tools will be used, it is just actionscript code. Ok, let’s see the following code, hope it is what you are looking for and will be helpful to you.

// paint
var G:Array = [[0, 0], [80, 0], [80, 20], [0, 20], [0, 0]];
for (i=0; i i == 0 ? btn.moveTo(G[i][0], G[i][1]) : btn.lineTo(G[i][0], G[i][1]);
// set button position
btn._x = (Stage.width/2)-btn._width/2;
btn._y = (Stage.height/2)-btn._height/2;
// button methon
btn.onRelease = function() {
getURL(, "_blank");