• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Automatically resize two text bars borders to each other

New Here ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

Gotta another action script puzzle im trying to figure out.

My program has two rows of text, stacked on top of each other.

they adjust to each other, to match when text is entered so it stays a nice square.

the problem is I cant seem to get the text bars on top to resize to the text bars on bottom.

Worth mentioning, it works the other way around, the bottom text resizes to the top text.

any help would be apperciated.

//here is my code

addEventListener(Event.ENTER_FRAME,strehrows, false, 0, true);

function strehrows(event:Event)

{

          if (MovieClip(parent.parent).textSelect == textArray100["pair1"],false,0,true)

          {

                    textArray100["pair1"].autoSize = TextFieldAutoSize.LEFT;

                    textArray100["pair13"].autoSize = TextFieldAutoSize.NONE;

                    textArray100["pair13"].width = textArray100["pair1"].width;

          }else

          if (MovieClip(parent.parent).textSelect == textArray100["pair13"],false,0,true)

          {

                    textArray100["pair13"].autoSize = TextFieldAutoSize.RIGHT;

                    textArray100["pair1"].autoSize = TextFieldAutoSize.NONE;

                    textArray100["pair1"].width = textArray100["pair13"].width;

          }

}

TOPICS
ActionScript

Views

922

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 19, 2012 Jul 19, 2012

copy and paste the code you're using.  i can't debug code that's related but not the same as the code you use. 

also, use the trace() function to check the values that you're checking and copy and paste that output too. 

for example,

addEventListener(Event.ENTER_FRAME,strehrows, false, 0, true);

function strehrows(event:Event)

{

trace(MovieClip(parent.parent).textSelect.name,textArray100["pair1"].name,textArray100["pair13"].name);

          if (MovieClip(parent.parent).textSelect == textArray100["pai

...

Votes

Translate

Translate
Community Expert ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

if you're not seeing any error messages, what is:

MovieClip(parent.parent).textSelect

and what is

textArray100["pair1"],false,0,true

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

no errors.

Awnsers

Text select is a var on the main time line, that tells the current text bar you're on,

and textArray100["pair1"]  is one of the text fields



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

what's all that false,0,true stuff in your if-statement.  those look like event listener parameters, not something that belongs in an if-statement.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

Just experimenting, was getting some errors and screwed around. Lol

Okay I removed all that garbage.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

thats not what was messing with it though. I could use a push in the right direction

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 19, 2012 Jul 19, 2012

Copy link to clipboard

Copied

LATEST

copy and paste the code you're using.  i can't debug code that's related but not the same as the code you use. 

also, use the trace() function to check the values that you're checking and copy and paste that output too. 

for example,

addEventListener(Event.ENTER_FRAME,strehrows, false, 0, true);

function strehrows(event:Event)

{

trace(MovieClip(parent.parent).textSelect.name,textArray100["pair1"].name,textArray100["pair13"].name);

          if (MovieClip(parent.parent).textSelect == textArray100["pair1"])

          {

                    textArray100["pair1"].autoSize = TextFieldAutoSize.LEFT;

                    textArray100["pair13"].autoSize = TextFieldAutoSize.NONE;

                    textArray100["pair13"].width = textArray100["pair1"].width;

          }else

          if (MovieClip(parent.parent).textSelect == textArray100["pair13"],false,0,true)

          {

                    textArray100["pair13"].autoSize = TextFieldAutoSize.RIGHT;

                    textArray100["pair1"].autoSize = TextFieldAutoSize.NONE;

                    textArray100["pair1"].width = textArray100["pair13"].width;

          }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines