item showing up as null persistence
I have a rather hard situation trying to debug this below. When I trace currentNote it shows up as null. I am certain I have notes in the array, because if i leave off as Note
in the code below I get an error telling me it cannot convert Object to a Note. I think it has something to do with the persistenceManager and how it is converting the array to an Object when I save it, but I make sure to put as Array when getting it out of the Persistence Manager.
Been struggling with this for hours ![]()
var currentNote:Note;
pm = new PersistenceManager();
pm.load();
private function getRandomNote():void{
//This stored array holds up to 4 arrays -- multidemensional
var theSelectedNotesArray:Array = pm.getProperty("selectedNotesArr") as Array;
trace(theSelectedNotesArray);
var randomArray:int = Math.floor(Math.random()*theSelectedNotesArray.length);
currentNoteArray = theSelectedNotesArray[randomArray];
trace(currenNoteArray.length) // 52 which is correct
var randomIndex:int = Math.floor(Math.random()*currentNoteArray.length);
currentNote = currentNoteArray[randomIndex] as Note;
trace(currentNote);
}
