Total Pageviews

Monday 25 May 2015

Equal Spacing between Dynamically created Textfields

private function createEqualSpacing(textfield : MovieClip, text : String, lastClip : MovieClip) : void
{
      (textfield.txt).text = text;
      (textfield.txt).multiline = true;
      (textfield.txt).width = 420;
      //Autosize textfield according to the text.
      (textfield.txt).autosize = TextFieldAutoSize.LEFT;
      (textfield.txt).border = true;

      if(lastClip != null)
      {
             textfield.y = lastClip.y + lastClip.height + 20;  //20 is fixed value space given between                                                                                                     //textfields.
      }
}


call the above function wherever required as below :

createEqualSpacing (mc1, xml.Text1, null);
createEqualSpacing (mc2, xml.Text2, mc2);
createEqualSpacing (mc3, xml.Text3, mc2);

No comments:

Post a Comment

Microsoft Logo using flexbox and Reactjs

 <!DOCTYPE html> <html> <head>     <script src="https://unpkg.com/react@18/umd/react.development.js" crossori...