0
votes

So basically, I have an Object in Flash that contains two text fields: "petName" and "description"

I've got a superclass, "Animal", with three subclasses: Piggy, Goat, and Puppy.

I've tried doing: (where "buddy" is an instance of "Puppy")

buddy.description.text = "Hello world.";

But I keep getting the error, "Access of undefined property petName through a reference with static type "puppy".

Can anyone help?

Thanks, -Liz :)

Here's my code:

----> Animal Class: http://pastebin.com/cTve8spB

----> Puppy Sub-Class: http://pastebin.com/VcPNDkAi

----> Main File: http://pastebin.com/nTsPM7ve

Basically, I have a text bubble, that has two text fields inside of it. One is the name, the other is the description. The name is "petName" and the description is "description"

Animal class extends BubbleBase (the base graphic for my speech bubble), and the Puppy class extends Animal... so I'm not sure why I'm not able to access the text fields. Thank you for your help!

1
You forgot to mention what puppy is.Bart
I added my code and a bit more of an explanation.Lindsay

1 Answers

0
votes

I think puppy is a class you have written. Just like Goat or Dog. And you are trying to call a non static function on the class.

example:

var mrSnible:Dog = new Dog();
mrSnible.description.text = "An hilarious dog"; //this works
Dog.desription.text = "this is going to return an error"; //this won't