2 Replies Latest reply on Nov 27, 2006 6:06 AM by Peter Lorent

    Code only working second time round

    phil ashby
      Hi all,

      got a weird one here and hoping someone can help me.

      Scenario is this...got some dynamically created textareas on the screen and details of each are stored in a datagrid. The user can select one from the datagrid (dg_elements) and then change certain params for it, namely xy coords, height, width, alpha background colour, border colour and border style. Each param is taken from various components on the stage, textinput, colorpickers, comboboxes etc

      I've a button called but_apply which has this listener...

      but_apply_lnr=new Object()
      // the instance name of the textarea is stored in dg_elements.selectedItem.element_name

      inst = eval(dg_elements.selectedItem.element_name)
      inst._x = Number(elex.text)+40
      inst._y = Number(eley.text)+90


      So, if I amend the x,y, height width or alpha and click but_apply then the textarea updates accordingly...however, if I change the borderstyle, bordercolour or background colour then these don't change...UNTIL I click it a second time when everything works!?

      So for example I could change the alpha and the width and the backgroundcolor and first time round the alpha and width will change, then second time around the bgcolour will update ?!

      Why!???? I thought an updateAfterEvent() may help, but it made no difference.

      Can anyone help please!

        • 1. Re: Code only working second time round
          phil ashby Level 1
          sorted it by replacing




          however, still doesn't anwer the question as to why it was working second time round?!
          • 2. Re: Code only working second time round
            Peter Lorent Level 2
            The UIObject Class is the base class for all V2 Components. It adds functionality but also hides the MovieClip Class by defining an API that is not tied to the timeline. As a result there are often two properties or methods - one from the MovieClip class and one from the UIObject Class that can be used.
            With the second click there apparantly is a reference to the normal text field (Text Area Component is a wrapper for the normal text field).