[COLOR=#2F2928][FONT=verdana]Hi all,
I am new to flash and ActionScript.
I can create a **MovieClip** using the follwing process:
-
Select **rectangle tool from ToolsWindow **and draw a rectangle by dragging through mouse.
-
Then press F8 by selecting the drawn rectangle, select radio-button with “MovieClip” and click “OK”.
-
Now give the instance-name to this newly created Movieclip(say,myMovie). Now, we are able to use this MovieClip.
But, I don't like to use this process and I like to use ActionScript 3.0 code as a **sole** to create a custom-sized MovieClip(here, size depends on MovieClip's **"width & height"** properties) upon which I need to place as many no. of text-fields( say, "n")& "n" value is known dynamically upon requirement. Hence the MovieClip size must be increased/decreased as per our requirement depending on "n"(i.e., no. of TextFields.
And my code writte in “Actions” panefor changing the MovieClip’s size dynamically upon requirement looks like this:
myBtn.addEventListener(MouseEvent.CLICK,onSubmit);
function onSubmit(evnt:MouseEvent):void
{
var myClip:MovieClip=createMovieClip(0,0,100,100);
addChild(myClip);
myClip.visible=true; //optional
}
function createMovieClip(x:Number,y:Number,width:Number,height:Number):MovieClip
{
var result:MovieClip = new MovieClip();
result.x=x;
result.y=y;
result.width=width;
result.height=height;
addChild(result);
return result;
}
But, I am unable to achieve this through above code snippet.
Please, can anyone help me in this context? I think, its very easy for you people who are experienced and expertised in flash and ActionScript 3.0.
Thanks in advance....
Srihari.Ch
[/FONT][/COLOR]