does anyone know why getter methods are invoked twice when called 
using
bracket notation?  i've created a simple mxml test and observed the 
following:
 - when the button "Test Dot Notation" is clicked there are two 
popups; one which says "Returned object: hello" and another that
says "This should show once. (count: x)"
 - when the button "Test Bracket Notation" is clicked there are 
_three_ popups; one which says "Returned object: hello", another 
that says "This should show once. (count: x)", and the third which 
says "This should show once. (count: x+1)".

i would expect the "Bracket Notation" button to produce just two 
popups, similar to what the "Dot Notation" button does.

thanks,
marty

----- start mxml -----
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
  <mx:Script>      
      var counter:Number = 0;

      function testDotNotation()
      { 
          mx.controls.Alert.show("Returned object: " + this.hello );
      }
      
      function testBracketNotation()
      {
          mx.controls.Alert.show("Returned object: " + this
["hello"] );
      }
      
      function get hello():String
      {
          mx.controls.Alert.show("This should show once. (count: " + 
getNextCount() + ")");
          return "hello";
      }
            
      function getNextCount():Number
      {
          return counter++;
      }      
  </mx:Script>
        
  <mx:Canvas width="550" height="400">
    <mx:VBox>
      <mx:Button label="Test Dot Notation " click="testDotNotation
()"/>
      <mx:Button label="Test Bracket Notation " 
click="testBracketNotation()"/>
    </mx:VBox>
  </mx:Canvas>  
</mx:Application>
-----  end  mxml -----




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to