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

Reply via email to