all groups > flash actionscript > april 2004 >
You're in the

flash actionscript

group:

Dynamic Box Size


Dynamic Box Size Rich232
4/7/2004 9:57:15 PM
flash actionscript:
I have 2 input fields (x,y) where people can type in numbers based on the size
of their room. (i.e 3m by 3m). How do I script a square box that is drawn
automatically when they submit based on the scale that they have typed in.
(Flash MX)

Thanks

Rich.

Re: Dynamic Box Size Jack.
4/7/2004 10:56:40 PM
use the drawing API, something like -

btn.onPress = function(){
scaleF = 50;
num1 = Number(in1.text)*scaleF;
num2 = Number(in2.text)*scaleF;
rectangle = [num1,num2,200,50];

createEmptyMovieClip("clip",1);
clip._x = rectangle[2];
clip._y = rectangle[3];
clip.lineStyle(2,0x000000,100);
clip.beginFill(0x543211);
clip.lineTo(rectangle[0],0);
clip.lineTo(rectangle[0],rectangle[1]);
clip.lineTo(0,rectangle[1]);
clip.lineTo(0,0);
clip.endFill();

colOver = {ra:250,ga:150,ba:0,aa:80};
colOut = {ra:100,ga:100,ba:100,aa:100};
col=new Color(clip);
clip.onRollOver=function(){ col.setTransform(colOver); };
clip.onRollOut =function(){ col.setTransform(colOut); };
};

hth
AddThis Social Bookmark Button