kamcknig
August 22nd, 2008, 09:12 AM
Just asking opinions here, what does everyone think is better for OOP and what is more effecient to do?
To have each class control itself with an onEnterFrame event inside the class? e.g.
class A extends MovieClip
{
public function A()
{
this.onEnterFrame = whatever;
}
}
class B extends MovieClip
{
public function B()
{
this.onEnterFrame = whatever;
}
}
Or to have a main class, instantiate the subclasses, and then run update methods in those instances through a for loop in the main class? e.g.
class A extends MovieClip
{
public function A()
{
}
public function update()
{
//do stuff
}
}
class B extends MovieClip
{
public function B()
{
}
public function update()
{
//do stuff
}
}
class Main extends MovieClip()
{
public function Main()
{
//instantiate instances of A and B, and add them to some arrays for looping through
this.onEnterFrame = this.enterFrameHandler;
}
private function enterFrameHandler()
{
//loop through arrays of instances and run update() in them
}
}
To have each class control itself with an onEnterFrame event inside the class? e.g.
class A extends MovieClip
{
public function A()
{
this.onEnterFrame = whatever;
}
}
class B extends MovieClip
{
public function B()
{
this.onEnterFrame = whatever;
}
}
Or to have a main class, instantiate the subclasses, and then run update methods in those instances through a for loop in the main class? e.g.
class A extends MovieClip
{
public function A()
{
}
public function update()
{
//do stuff
}
}
class B extends MovieClip
{
public function B()
{
}
public function update()
{
//do stuff
}
}
class Main extends MovieClip()
{
public function Main()
{
//instantiate instances of A and B, and add them to some arrays for looping through
this.onEnterFrame = this.enterFrameHandler;
}
private function enterFrameHandler()
{
//loop through arrays of instances and run update() in them
}
}