You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/05/27 10:05:13 UTC

[GitHub] [royale-asjs] raudjcholo opened a new issue #843: Binding problem with currentState using Crux

raudjcholo opened a new issue #843:
URL: https://github.com/apache/royale-asjs/issues/843


   I think there is a bug when we bind currentState with a model variable using Crux.
   
   Example:
   
   View:
   
   ```
   <?xml version="1.0" encoding="utf-8"?>
   <j:ApplicationResponsiveView xmlns:fx="http://ns.adobe.com/mxml/2009"
           xmlns:j="library://ns.apache.org/royale/jewel"
           xmlns:js="library://ns.apache.org/royale/basic"
           currentState="{securityModel.state}"
       >
       <fx:Script>
           <![CDATA[
   
               import com.iest.winplusweb.events.SecurityEvent;
               import com.iest.winplusweb.models.SecurityModel;
   
               [Bindable]
               [Inject(source="securityModel", required="true")]
               public var securityModel:SecurityModel;
   
               public function getTest():void
               {
                   var testEvent:SecurityEvent = new SecurityEvent(SecurityEvent.TEST_CURRENT_STATE);
                   dispatchEvent(testEvent);
               }
               ]]>
       </fx:Script>
   
        <j:states>
           <js:State name="start" />
           <js:State name="update" />
       </j:states>
   
       <j:beads>
           <js:SimpleStatesImpl/>
           <js:ViewDataBinding/>
       </j:beads>
   
      <j:VGroup width="400" gap="10">
               <j:HGroup>
                   <j:Button localId="btlanzar" text="Action" click="getTest()"/>
                   <j:TextInput localId="TDebug" width="100" text="{currentState == 'start' ? 'Start' : 'Update'}"/>
                   <j:Label localId="txtproc" width="100"/>
               </j:HGroup>
           </j:VGroup>
   
   </j:ApplicationResponsiveView>
   ```
   
   Model:
   
   ```
   [Bindable]
       public class SecurityModel extends Model
       {
   
          public var state:String = "start";
   
           private static var _instance:SecurityModel;
           public static function get instance():SecurityModel{
               return _instance || (_instance = new SecurityModel());
           }
           
               
           /**
            * Constructor.
            */
           public function SecurityModel()
           {
               super();
               if (_instance) {
                   trace('SecurityModel error');
                   throw new Error("singleton");
               }
               _instance = this;
           }        
      }
   ```
   
   Controller:
   ```
   public class SecurityController extends Controller {
   
           public function get model():SecurityModel {
               return _model as SecurityModel;
           }
   
           [Inject]
           public function setModel(value:SecurityModel):void {
               _model = value;
           }
   
           /**
            * Constructor.
            */
           public function SecurityController() {
               super();
           }
   
           /**
            *  @copy org.apache.royale.core.IBead#strand
            *
            *  @langversion 3.0
            *  @playerversion Flash 10.2
            *  @playerversion AIR 2.6
            *  @productversion Royale 0.9.4
            */
           override public function set strand(value:IStrand):void {
               super.strand = value;
           }
   
             [EventHandler(event = "SecurityEvent.TEST_CURRENT_STATE", scope="global")]
           public function testCurrentState():void{
               model.state = "update";
           }
      }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] carlosrovira closed issue #843: Binding problem with currentState using Crux

Posted by GitBox <gi...@apache.org>.
carlosrovira closed issue #843:
URL: https://github.com/apache/royale-asjs/issues/843


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [royale-asjs] carlosrovira commented on issue #843: Binding problem with currentState using Crux

Posted by GitBox <gi...@apache.org>.
carlosrovira commented on issue #843:
URL: https://github.com/apache/royale-asjs/issues/843#issuecomment-635401401


   Hi,
   
   I tried it and now is working.
   
   I guess this was solved just today by Greg in commit 20dd957edf8dedeb11e6422b576f5f17b910c825


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org