Hi jan,

I only added a click event to an element in the function, not the
function itself :

createPopup: function(){
    .
    .
    .
    this.boxClose = new Element('div', {
          'class': 'boxClose'
    }).inject(this.boxContainer).addEvent('click',
this.hidePopup.bind(this));
    .
    .
    .
},

With this i add a click event to the div element but is this not the
right way ?

On 25 Okt., 13:54, Jan Kassens <[EMAIL PROTECTED]> wrote:
> you probably added the function myFunc as an event listener or as an  
> periodical/delayed function. In those cases you need to bind the  
> function to the instance, (when inside the class .bind(this) the  
> function)
>
> jan
>
> On Oct 25, 2008, at 13:19, websam wrote:
>
>
>
>
>
>
>
> > Hi there,
>
> > I have created a class with som default options :
>
> > var myClass = new Class({
> >        Implements: [Options, Events],
>
> >        options: {
> >                width: 600,
> >                height: 400
> >        },
>
> >        initialize: function(options){
> >                this.setOptions(options);
> >        },
>
> >        myFunc: function(){
> >                this.myDiv = new Element('div', {
> >                        styles: {
> >                                'width': this.options.width + 'px',
> >                                'height': this.options.height + 'px'
> >                        }
> >                });
> >        }
> > });
>
> > This is just an example but when i do this.options.width/
> > this.options.height on the new element, without setting the options
> > when i call the class, the width/height is undefined. What am i doing
> > wrong here ?
>
> --
> my blog:http://blog.kassens.net- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

Reply via email to