# Getting an overview over your loaded objects & OOP

**URL:** https://forum.kirupa.com/t/getting-an-overview-over-your-loaded-objects-oop/279503
**Category:** flash
**Created:** [January 15, 2009, 12:13pm UTC](https://forum.kirupa.com/t/getting-an-overview-over-your-loaded-objects-oop/279503 "2009-01-15T12:13:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![furyan\_be](https://avatars.discourse-cdn.com/v4/letter/f/3da27b/32.png) [@furyan\_be](https://forum.kirupa.com/u/furyan_be)
#### Post date: [January 15, 2009, 12:13pm UTC](https://forum.kirupa.com/t/getting-an-overview-over-your-loaded-objects-oop/279503/1 "2009-01-15T12:13:00Z")

</div>

Hello, in my school we are learning as3, and next semester we will be learning OOP.

The first semester I was already learning the concepts of AS3 by myself, because in the summer vacation I had picked up some books on as3 trying to get a head start when starting this course. (I still learned alot of from my tutors though). I then decided to program my end project of semester 1 object oriented. I asked my tutors if this was allowed and they replied “only if you handle and understand the concept of oop”. I thought I’d give it a shot.

Next week we will have to defend our code against our teachers, and explain how and why we handled some things.

Now I’m not sure if I took the wrong lane here, because I coded the whole project entirely based on the rules that I thought were the ones you had to oblige too. But in OOP you don’t have to follow a certain concept, like encapsulation, for it to work. For example, all the class variables I declared them as private and I typed there corresponding getters and setters. While I could easily have just made them public vars.  
I thought there was this main concept with a set of rules that you always had to stick by.

It will be hard to defend my code since I don’t really stand behind it.  
I chose OO for the flexibility and code clarity it delivers, but I think I handled it the wrong way.

About the loaded objects:

My project had a class Square wich represented a square on the board. I made a couple of sub classes with their additional set of properties. One of their properties was the background image wich loaded using a loader. When the image was loaded I would dispatch an event Loaded.  
In my main class GameMaster wich handled all the the rules, turns, players etc…  
I created a for loop and instantiated a new Square, and once it reached its last loop, I would listen for that squares loaded event.  
When the last square dispatched this event I would enable the “turn button” and the game would start, because then I knew the board would be visible.  
But I recently tested it on a slow connection, and the event got dispatched even though  
some other squares werent done loading yet.  
Do you guys how I could better handle this, like if I had many classes who all loaded their own content, how could I ensure that the Main class only starts when all the other classes have finished loading their loaders.
