Adding Javascript moo.fx to your component

From Joomla! Documentation

I received an error ("Call to undefined method JSite::getDocument()") when I tried the tutorial. To fix it, I changed the code from:

// make mainframe variable available
global $mainframe;	

// Load the moo.fx scripts
$document = & $mainframe->getDocument();

to this:

// Load the moo.fx scripts
$document = & JFactory::getDocument();

--Rlfielding 00:03, 1 October 2008 (EDT)