generic function to place a component on the stage in ActionScript-3.0
hi all,
new flash , actionscript 3.0.i learning actionscript 3.0.
requirement/need as3 code placing type of component(viz., button, checkbox, combobox, listbox, radiobutton, slider, scrollbar,label,textfield, etc.,) on stage desired width,height, x , y parameters(values) mention in "properties" tab of properties window in flash. hence, need is, (say)a generic actionscript 3.0 method/function, places of components present in "components panel" onto stage.
i.e., per idea, function prototype or signature may this:
function addcomponent(int <width>, int <height>, int <xpos>, int <ypos>)
plzzz... can me in context.... general query think so. i.e., basic programmer's task defining function requirement. think, if want add button onto stage @ 100,100 pixel position , button component's width , height 50,50 respectively, (i.e., button.x=button.y=100 && button.width=button.height=50).
so, button must placed @ 100,100, then, sample code looks this:
button <btn_instance> = new button(); //creates button instance
<btn_instance>.addcomponent(50,50,100,100);// properties of button.
i hope me.
thanks in advance..
srihari.ch
(ottomh) have function similar to:
function placecomponent( container:displayobjectcontainer, component:uicomponent, w:int, h:int, xpos:int, ypos:int ):void
{
container.addchild( component );
component.move( xpos, ypos );
component.setsize( w, h );
}
called with:
var b:button = new button();
placecomponent( this, b, 100, 20, 200, 200 );
you alost there
More discussions in ActionScript 3
adobe
Comments
Post a Comment