1
[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

asked Apr 30, 2009 at 1:09

3 Answers 3

1

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

answered Apr 30, 2009 at 1:36

Comments

1

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.

answered Oct 1, 2009 at 9:44

Comments

0

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?

answered Sep 15, 2012 at 15:25

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.