2 Replies Latest reply on May 16, 2006 5:54 AM by wandrer

    Why is this not working

    wandrer
      Hello all,

      I am working under Flash Pro 8, following code is not working, could somebody explain me why? (I am trying to call frame/label from combobox):

      var cbListener : Object = new Object();
      cbListener.change = function(evt_obj : Object) {
      gotoAndStop(paint_styl.getSelectedItem().data);
      };
      paint_styl.addEventListener("change", cbListener);

      Where as the following code works if published for Flash Player 6 (I don't want to do this as I want to use BitmapData which is not available for Flash Player 6)
        • 1. Why is this not working
          TimSymons Level 1
          There is an example of creating an event listener for a ComboBox in the Help docs in Flash 8 Pro. This is where I got this code:

          var cbListener:object = new Object();
          cbListener.change = function(evt_obj:object) {
          var item_obj:object = my_cb.selectedItem;
          var i:String;
          for (i in item_obj) {
          trace(i + ":\t" + item_obj[ i]);
          }
          trace("");
          };
          my_cb.addEventListener("change", cbListener);

          Comparing this to your code, I see that you should make the following changes:

          var cbListener : Object = new Object();
          cbListener.change = function(evt_obj : Object) {
          trace(paint_styl.selectedItem.data); // this is for debugging, just to make sure it has data.
          gotoAndStop(paint_styl.selectedItem.data);
          };
          paint_styl.addEventListener("change", cbListener);


          Tim
          • 2. Re: Why is this not working
            wandrer Level 1
            Hi Tim

            Tried this, does not work !!! While debugging, (Control>Debug Movie),
            The "cbListener" occurs on "_level 0" without any data. (Am I looking at the right place?) ----- Debugger/Variables tab

            That means cbListener occurs when the clip reaches the frame where ComboBox is placed. I think it should occur at
            _level 0.paint_styl ------ ComboBox "data" is found here.

            Any opinions?
            Pranay