0 Replies Latest reply on Jul 17, 2006 3:10 PM by JacsonPaz

    In Debug mode, ok, but out of debug, error!

      I extends a Tree component creating a function to data capture in HTTPService and auto-select Item in XMLList result.
      In debug mode, all vars show ok, and the function execute correctly, but run in normal mode, vars receive strange values testing with Alert.show() and function selecionaId() not work corretly

      CODE ==================
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Tree xmlns:mx=" http://www.adobe.com/2006/mxml" dataProvider="{sql.lastResult}" initialize="carregaMenu('2')" xmlns:ns1="*">
      import mx.controls.Alert;

      // set requestVars and send a HTTPService requisition
      public function carregaMenu(id:String):void{
      sql.request.idioma = id;
      sql.request.tabela = 'menus_site';
      sql.request.campo = 'nome';


      // on RESULT event of HTTPService, set a dataProvide of TREE extends
      // and call a function to set one ITEM in TREE list.
      private function resultado(evento:Event):void{
      this.dataProvider = evento.currentTarget.lastResult;


      //this function, find, select and set firstVisibleItem in agreement
      //of varId parameter.
      public function selecionaId(varId:String):void {
      var id:String = 'a';
      var idAntigo:String = 'b';

      if (varId == null){
      this.selectedIndex = -1;
      }else {
      this.selectedIndex = 0;
      this.expandChildrenOf(this.selectedItem, true);
      this.selectedIndex = 1;
      id = this.selectedItem.@id;
      while ((id != idAntigo) && (id != varId)){
      idAntigo = id;
      this.selectedIndex = this.selectedIndex + 1;
      this.firstVisibleItem = this.selectedItem;
      id = this.selectedItem.@id;
      if ((id == idAntigo) && (id != varId)){
      this.selectedIndex = -1;

      <mx:HTTPservice id="sql" url="../../flex.php?consulta=menus_site" method="POST" resultFormat="e4x" result="resultado(event)" />

      My questions:
      1 = this error does not happen due to synchronism?
      2 = how to know that the list/nodes/data of dataProvider completely was brought update and I can work with its data? exist any event?