suggestion

var engineManager;

as a convention, you should use lowercase variable names for instances, and uppercase names only for Constructors (things that you'll use the 'new' keyword for). Assuming Engine is a Class, I wont go into details about how ugly things can get if you forget the new and do something like...

var engineManager = Engine();  // <-- bad, bad, bad

...on accident. ;)

On Oct 27, 2008, at 1:04 PM, Oskar Krawczyk wrote:


DOH. Man, I feel stupid. God damn time shifts – I should be home
already, chilling.

Thanks CroNiX!

On Oct 27, 5:01 pm, CroNiX <[EMAIL PROTECTED]> wrote:
Try:
var EngineManager;

window.addEvent('domready', function() {
        EngineManager = new Engine();

});

You have to define it outside of domready.  You can instantiate it
within domready.

On Oct 27, 9:54 am, Oskar Krawczyk <[EMAIL PROTECTED]> wrote:

Hi folks,

I have a weird one. Basically I'm initializing a class inside
DomReady:

window.addEvent('domready', function() {
        var EngineManager = new Engine();

});

Right? Cool.

Afterwards I'd like to refer to a method by calling
EngineManager.slides() but after the whole page gets loaded so I do
this:

window.addEvent('load', function() {
        EngineManager.slides();

});

Right? Nope... That throws an error saying that "EngineManager is not
defined" which is odd since it's right there... defined ages ago.

Am I missing something or onDomReady and onLoad are two parallel
realities for themselves?

Best,
Oskar

Reply via email to