SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Lacking scope

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Feb 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lacking scope

    Hi all,

    I can't figure out why the alertDraggable function does have access to the this variable (refering to the object instance), and the onClick function (invoked from within the VE API) doesn't. I appreciate your advise.

    Code:
    ULAB.GeoCMS.Core.Shape = Class.extend({
        initialize: function(type, points) {
            this.veShape = new VEShape(type, points);
            this.locked = true;
            this.previousLocation = null;
            this.draggable = true;
            this.core = ULAB.GeoCMS.Core.Register.getEntry('core');
            this.map = core.getMap();
            this.map.AttachEvent("onclick", this.onClick);
        },
        alertDraggable: function() {
             alert(this.draggable); //true
        },
        onClick: function() {
             alert(this.draggable); //undefined
        });
    Note: the code uses the inheritance model as described at: http://twologic.com/projects/inheritance/

    Thanks in advance!
    Last edited by ulab; Feb 25, 2008 at 07:15.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •