2 Replies Latest reply on Feb 8, 2010 7:45 AM by vivoices

    How to change state values from Script


      I did not find the information I need in the Doc available here:


      so . . .



      How do I change the value for x.video in action script?
      this["btn1"].x["video"] = 30;
      threw an error: #1056: "Cannot create property video on Number."



        <mx:State name="home" />

        <mx:State name="video" />

        <mx:State name="profile" />

        <mx:State name="contact" />


      <s:Button id="btn1"
        . . .
        x="0" y="5"
        x.contact="232" />
        • 1. Re: How to change state values from Script
          CoreyRLucier Adobe Employee

          The dot notation (e.g. x.video) is an MXML only XML syntax which the compiler turns into a SetProperty "override" for state 'video'. There is no equivalent Actionscript syntax, because for AS only classes you'd generally just override the currentState setter and manage the properties and style values you wish from AS based on the currentState.


          For your particular use case may I ask why you need to mix Actionscript with MXML stateful document logic?



          1 person found this helpful
          • 2. Re: How to change state values from Script
            vivoices Level 1

            I am building a dynamic menu setup that has to be recalculated when switching locales.


            I checked the relation between states and valuse in debug mode.

            I just push appropriate SetProperty objects into the overrides array of the given state and everything works as expected.

            When recalculating the object positions, I just "reset" the overrides array before repopulating it.


            Works fine.