A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Finding my _y's and _x's

  1. #1
    Member
    Join Date
    Jan 2005
    Posts
    35

    Finding my _y's and _x's

    i have created this fields in a loop as you can see, i have set their _y pos to 20*i to make them fall undeneath one another now what i want to is set they _x and _y pos again to set them in the middle of the stage but i dont know how to do that because the fields are already set to 20*i does that make any sences its late sorry. Please help.....

    this is the code i used.
    text_width = 20;
    text_height = 20;
    numfields = 10;

    for(i = 0; i < numfields; i++){
    this.createTextFields("text"+i,i,60,20*i,text_widt h,text_height);
    this["text"+i].border = true;
    this["text"+i].text = "ok";
    format = new TextFormat();
    format.getTextFormat();
    format.setTextFormat(format);
    }

    pls help.....
    Post no bills

  2. #2
    Senior Member
    Join Date
    Oct 2004
    Location
    Rio de Janeiro, Brazil
    Posts
    344
    Hi, pal!

    Well, I copy-paste your code in a new Flash project and ran it... well, nothing happens! I mean that NOTHING really happens, no fields created. In fact, I didnt analized your code, just tested it.

    Anyway, to change the position of the new created fields, you should just use the _x property, this way:

    this["text"+i]._x = thenewposition;

    To center the field in the exact middle of your stage, you could do:

    thenewposition = (Stage.width)/2;
    this["text"+i]._x = thenewposition;

    Hope it helps!
    Last edited by yankmoura; 02-19-2005 at 10:40 AM.

  3. #3
    Member
    Join Date
    Jan 2005
    Posts
    35
    000PPS sorry i added a "s" to the command createTextField by mistake, here it is completed, but i dont think you code would work though....

    text_width = 20;
    text_height = 20;
    numfields = 10;

    for(i = 0; i < numfields; i++){
    this.createTextField("text"+i,i,60,20*i,text_width ,text_height);
    this["text"+i].border = true;
    this["text"+i].text = "ok";
    format = new TextFormat();
    format.getTextFormat();
    format.setTextFormat(format);
    }

    but i think i found a solution by creating an mc to hold the textfields and move the mc and not the fields themselves.....
    Post no bills

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center