Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8889009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:09:23+00:00 2026-06-14T22:09:23+00:00

I want to call setter transform in the superclass SceneNode from the overriden setter

  • 0

I want to call setter “transform” in the superclass SceneNode from the overriden setter in the subclass Camera.

The classes look like this:

SceneNode:

function SceneNode(){
    this._transform = M4x4.I;
}

SceneNode.prototype.__defineSetter__("transform", 
    function(transform){
        this._transform = transform;
    }       
);

SceneNode.prototype.__defineGetter__("transform", 
    function(){
        return this._transform;
    }   
);

Camera:

function Camera(){

}

Camera.prototype = new SceneNode();
Camera.base = SceneNode.prototype;

Camera.prototype.__defineSetter__("transform",
    function(transform){
        Camera.base.transform.call(this, transform);
        this.updateViewMatrix();
    }       
);

Camera.prototype.__defineGetter__("transform", 
    function(){
        return this._transform;
    }   
);

This does not work because “Camera.base.transform” is not defined according to firefox. I used to call “Camera.base.setTransform.call(this, transform);” before, which worked, but since I learned about setters and getters, I tried to get rid of setXXX functions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:09:25+00:00Added an answer on June 14, 2026 at 10:09 pm

    Getters and setters hide the underlying function, so you need a way to bypass the property and obtain the setter directly. (It’s undefined because it’s actually accessing the return value of SceneNode.prototype‘s getter, which has no instance to get a value from.) The counterpart to __defineSetter__ is __lookupSetter__:

    Camera.prototype.__defineSetter__("transform",
        function(transform){
            Camera.base.__lookupSetter__("transform").call(this, transform);
            this.updateViewMatrix();
        }
    );
    

    But those methods are deprecated, so the correct (ECMAScript 5) way is to use Object.defineProperty and Object.getOwnPropertyDescriptor:

    Object.defineProperty(Camera.prototype, 'transform', {
        set: function(transform){
            Object.getOwnPropertyDescriptor(Camera.base, 'transform').set.call(this,
                    transform);
            this.updateViewMatrix();
        },
    
        get: function(){
            return this._transform;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call a method say success(message) of javascript from android activity. I
I want to call a function a number of times providing it with different
I want to call a function which is in another php class that I
I want to define operators for a class instance within a class function, like
If I set a Friend-level scope on a setter, like this... Public Class MyClass
I want to call a webservice using google closures, via jsonp since i am
I want to call a html page on click of a button in mvc.
i want to call the command prompt command using Process.Start and then using StandardOutput
I want to call a web service that requires an authentication cookie. I have
I want to call an existing commandlet with a dynamic number of parameters. So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.