flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Mclean <jus...@classsoftware.com>
Subject Re: [FlexJS] Setting background colour at run time fails
Date Tue, 14 Feb 2017 01:48:47 GMT
Hi,

> Do you need a getter if it just gets installed in ValuesManager?

I guess not just seems a little  inconsistent.

Anyway changing the code to this:

<?xml version="1.0" encoding="utf-8"?>
<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:js="library://ns.apache.org/flexjs/basic" xmlns:beads="org.apache.flex.html.beads.*">

   <js:beads>
       <js:ContainerDataBinding />
   </js:beads>

  <fx:Script><![CDATA[
      import org.apache.flex.core.ValuesManager;

      public function clicked():void {
          bg.backgroundColor = "red";
          updateBoxStyles();
      }

      public function updateBoxStyles():void {
          ValuesManager.valuesImpl["applyStyles"](box, bg);
      }
      ]]></fx:Script>

  <js:valuesImpl>
      <js:SimpleCSSValuesImpl/>
  </js:valuesImpl>

  <js:initialView>
      <js:View>
          <js:VContainer>
              <js:Container id="box" width="100" height="100">
                  <js:style>
                      <js:BindableCSSStyles id="bg" backgroundColor="grey" />
                  </js:style>
              </js:Container>

              <js:TextButton text="Click me" click="clicked()" />
          </js:VContainer>
      </js:View>
  </js:initialView>

</js:Application>

Finally makes it work.

Is there any reason why Container couldn’t have a reapplyStyles method that calls ValuesManager.valuesImp.applyStyles
passing this and this.style?

Thanks,
Justin


Mime
View raw message