0 Replies Latest reply on Jan 8, 2008 5:07 PM by online-experiments

    code running backwards in commitProperties() ???

    online-experiments
      Very strange problem here. Following this example, I try to implement an UIComponent which shall hold a simple graph. For some bizarre (or not) reason, the code in my overridden commitProperties function is executed backwards?!
      When creating the component in an mxml file, the alerts are being shown in the following order:
      afterloops -> lastouter -> lastinner -> firstinner-> firstouter -> beforeloops -> aftersuper -> beforesuper

      What don't I understand here?

      /*** Implement the commitProperties() method. ***/
      override protected function commitProperties():void {
      Alert.show("beforesuper");
      super.commitProperties();
      Alert.show("aftersuper");
      var it:Iterator = new ArrayIterator( _data ); // iterates through data array
      var pit:Iterator = new ArrayIterator( _props ); // iterates through properties.
      var pts:Array = new Array(); // holds the points of one dataset
      var props:Array = new Array(); // holds the properties of one dataset
      var tmp:Array = new Array();

      Alert.show("beforeloops");
      while ( it.hasNext() ) { // iterate through datasets
      Alert.show("first outer");
      pts = it.next();
      var dit:Iterator = new ArrayIterator( pts ); // iterator for points
      if (pit.hasNext()) { // if only one prop is submitted this is valid for all datasets
      props = pit.next();
      }
      this.graphics.lineStyle( 1, 0xff3333 ); // TODO use properties here
      this.moveToArray(scalePt(dit.next(),props)); // move to starting point, TODO scale
      while (dit.hasNext()) {
      Alert.show("first inner");
      tmp = dit.next();
      this.lineToArray(scalePt(tmp,props)); // TODO scale
      Alert.show("last inner");
      }
      dit.reset();
      Alert.show("last outer");
      }
      it.reset();
      Alert.show("afterloops");

      invalidateDisplayList();
      }