clark Posted September 4, 2013 Share Posted September 4, 2013 Hey all, I am using Alamboley's excellent TypeScript port I am having a little trouble with scopes, it is more of a TypeScript help than pixi but wth! In this example that I made up (pseudo). A function is bound to the bunny? Hence this(bunny).alpha = 0;class Something{ constructor() { //.... // use the mousedown and touchstart bunny.mousedown = bunny.touchstart = function(data) { // store a refference to the data // The reason for this is because of multitouch // we want to track the movement of this particular touch this.data = data; this.alpha = 0.9; this.dragging = true; }; //..... }}How would I bind this function to the Something class? class Something{ constructor() { //.... // use the mousedown and touchstart bunny.mousedown = bunny.touchstart = ??? //..... } private onBunnyDown(data:PIXI.InteractionData): void { console.log("Hi"); }}Thanks! Quote Link to comment Share on other sites More sharing options...
clark Posted September 5, 2013 Author Share Posted September 5, 2013 I slept and awoke with this: bunny.touchend = bunny.mouseup = (event: PIXI.InteractionData) => { this.onBunnyUp(event);} Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.