[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
3 Answers 3
Either event.result is the empty array "[]", or the last value is not an _Aktivitaet. Check the method dispatching event is correct.
Comments
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.
Comments
you can use the "break point" functionality to check the variable's valule.\n your posted code is not complete for me to understand.\n where's the event come from? it's your custom Event Class's instance?\n what is the event's target?