Because in the second case your code means 'window.shop.opening()',
and perhaps you haven't 'shop' variable in the global scope. Don't do
like that. It's 21st century already ;)

Try:
shop.opening.bind(shop).periodical(1000); // `bind` is not needed
always, it depends on your code

in your case it works without `bind`

http://jsfiddle.net/65bcd/2/

http://mootools.net/docs/core/Types/Function#Function:periodical

On Wed, Feb 29, 2012 at 3:15 PM, hamburger <[email protected]> wrote:
> Hello, I have got one more question.
>
> I don't understand why I cant access to the function.
>
> to call the function like this: shop.opening(); //works
>
> and this do not:
> setInterval('shop.opening()', 1000); //not works
>
> why not?
>
>
> http://jsfiddle.net/65bcd/1/

Reply via email to