flex/actionscript assignment failing?

Posted by user346713 on Stack Overflow See other posts from Stack Overflow or by user346713
Published on 2010-05-21T03:37:02Z Indexed on 2010/05/21 3:40 UTC
Read the original article Hit count: 242

I'm seeing something weird in my actionscript code

I have two classes foo and bar, bar extends foo. In a model class I have a foo member variable, I assign an bar object to the foo variable. But after the assignment the foo variable is null.

[Bindable] public var f:foo;
public function someFunc(arr:ArrayCollection):void  {  
  if(arr.length > 0) {
    var tempBar:bar = arr.getItemAt(0) as bar;
    if(tempBar != null) {
      tempBar.someProp++;
      f = tempBar;
      // f is now null
    }
  }
}

Any ideas on what I could be doing wrong?

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript