am I passing and handeling vectors wrong?
So I have the code of two classes (I can't post any actual code as its way too long - even broken up But I can give you a sample of simmilar aspects)
public class ClassA
{
private var objectString:Vector.<String>; // create a new vector to hold items - this will be passed
private var cb:ClassB = new ClassB();
public function populateVector():void
{
objectString.push("hello");
cb.passVector(objectString); //curently contains "hello."
}
}
public class ClassB
{
private var objectContainer:Vector.<String>; //to conain the passed array.
public function getVector(vectorObject:Vector.<String>):void
{
objectContainer = vectorObject; //get the vector passed in and assign its contents to this vector.
}
public function passVector():Vector.<String>
{
return objectContainer; //return the vector to now pass to another class ClassC
}
}
public class ClassC
{
private var getVector:Vector.<String>;
private var cb:ClassB = new ClassB();
public function ClassC()
{
getVector = cb.passVector();
trace(getVector) //In theory - show me hello
}
}
Yes I have an understanding of vectors so pointing me to the documentation may be worthless. As I have read it hundred times. I would not be posting here if I didnt. How ever I may have missed something.
Upon debugging this I see that Class A has a vector that now contains one element -> "hello." When I pass that vector on Object container is null. Whats worse is now I return a null vector list and pass on a null vector list and trace should in theory show me null.
Why is this happening? In java this is how I would pass vectors and arrays around and I believe some one showed me this is how you do it in actionscript.
Apparently I am wrong in AS. How do I pass vectors around?
If my code contains spelling mistakes or syntax errors I appoligize as I typed this here.
