views:

250

answers:

2
[Bindable] private var arr_activities:Array; 
var test: _Aktivitaet;
arr_activities = event.result as Array;
test = arr_activities.pop() as _Aktivitaet;

Why does test always stay null???

_Aktivitaet is a custom class:

package at.moschitz.topfive
{
  [RemoteClass(alias="Aktivitaet")]
  [Bindable]
  public dynamic class _Aktivitaet extends MyEntity
  {
    public var AktID:int;
    public var AktName:String;
    public var AktMindAlter:int;
    public var AktMaxAlter:int;
    public var AktKategorie:_AktKategorie;
    public var AktIsActive:Number;
  }
}

Thx Martin

+1  A: 

Either event.result is the empty array "[]", or the last value is not an _Aktivitaet. Check the method dispatching event is correct.

Simon Buchan
A: 

instead of

test = arr_activities.pop() as _Aktivitaet;

try this and see what errors you get:

test = _Aktivitaet(arr_activities.pop());

As Simon Buchnan said - If the array is empty or the last object in the Array is not an _Aktivitaet you will get a null value returned - if you cast instead using _Aktvitaet(arr_activities.pop()) flash will throw an Error that can help you debug your problem.

Reuben