skjc
September 16th, 2005, 11:53 AM
If I create a class and set up one property which is a variable initiated at the start of the class but not within a function or a constructor and I reference the property from the .fla in a for loop as:
Book is the class and myBook is the new object.
myBook:Book = new Book(); // (fla script).
for(var prop in myBook) {
trace(prop);
}
the .AS contains
Class Book
{
var myProp:Number = 0;
function Book() {
}
}
The trace does not return anything. However when I include myProp (the class variable) in a function (other than Book function) and call that function from the .fla then the trace works and I can see myProp.
I would be grateful if someone could explain: Do I need to include Class variables in called functions (methods of the Class) in order for them to be properties of the Class?
thanks in advance
Book is the class and myBook is the new object.
myBook:Book = new Book(); // (fla script).
for(var prop in myBook) {
trace(prop);
}
the .AS contains
Class Book
{
var myProp:Number = 0;
function Book() {
}
}
The trace does not return anything. However when I include myProp (the class variable) in a function (other than Book function) and call that function from the .fla then the trace works and I can see myProp.
I would be grateful if someone could explain: Do I need to include Class variables in called functions (methods of the Class) in order for them to be properties of the Class?
thanks in advance