Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Actionscript 3.0 - Class Composition Question!

Status
Not open for further replies.

wavematt

Programmer
Apr 16, 2008
9
0
0
US
I have recently started using Actionscript 3.0 and have made a point of using classes exclusively as opposed to putting code all over the timeline. I have encountered one problem though.

Let's say I'm making a flash website and I have a document class with two public vars: an instance of a Navigation class and an instance of a Page class (both of which I created). When a user clicks a button inside the instance of the Navigation class, that instance needs to tell the instance of the Page class to load some page.

I'm very used to Actionscript 2.0 and I've been assuming that since these two instances are children of the document class that the two would be able to tell each other to do something or alter some variables inside the other by use of "parent" or "root." But I keep getting an error like this: "Access of undefined property..."

So am I approaching this entirely correctly? Can someone offer some help on this topic?

All help is appreciated, if it would help better for me to show some code, I'll gladly do so. Thanks!
 
I actually figured out the answer to my problem today.

I am new to 100% OOP and was very used to structuring everything to work from the inside out so I had to change my ways and structure everything to work from the outside in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top