Skip navigation
Currently Being Moderated

Automatically resize two text bars borders to each other

Jul 19, 2012 9:51 AM

Tags: #problem #script #text #3.0 #action #actionscript #as3.0 #actionscript3 #function

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;

          }

}

 
Replies
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 19, 2012 12:17 PM   in reply to tropicanaclock

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

     

    MovieClip(parent.parent).textSelect

     

    and what is

     

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

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 19, 2012 12:42 PM   in reply to tropicanaclock

    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.

     
    |
    Mark as:
  • kglad
    72,235 posts
    Jul 21, 2002
    Currently Being Moderated
    Jul 19, 2012 4:29 PM   in reply to tropicanaclock

    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"].n ame,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;

              }

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points