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

  • SEARCH
  • Home
  • 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 9024031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:54:25+00:00 2026-06-16T05:54:25+00:00

I tried a simple KineticJS example hosted on my own server, and I have

  • 0

I tried a simple KineticJS example hosted on my own server, and I have a problem placing the 4 handles at the 4 corners of the Image. The handle points will be at the wrong position, as shown in the screencap below. However the handles are position correctly in the jsfiddle!

jsfiddle: http://jsfiddle.net/NPB77/

enter image description here

I’m very new to KineticJS, will really appreciate if I can be pointed in the right direction, thank you!


Update

jsfiddle: http://jsfiddle.net/NPB77/1/

Solved by placing addAnchor within the imageObj.onload() function.

var imageObj = new Image();
imageObj.onload = function() {
    var thing = new Kinetic.Image({
        x: 0,
        y: 0,
        image: imageObj
    });

    addAnchor(thingGroup, 0, 0, "topLeft");
    addAnchor(thingGroup, imageObj.width, 0, "topRight");
    addAnchor(thingGroup, imageObj.width, imageObj.height, "bottomRight");
    addAnchor(thingGroup, 0, imageObj.height, "bottomLeft");

    thingGroup.add(thing);
    stage.draw();
};

imageObj.src = 'http://www.html5canvastutorials.com/demos/assets/darth-vader.jpg';

However, now when I drag the corner handles which is supposed to rescale the image, I get the error:

Uncaught TypeError: Cannot call method 'setPosition' of undefined 

What went wrong here? I dont understand why group.get(".topLeft") is not working, is this a scope problem?

  • 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-16T05:54:27+00:00Added an answer on June 16, 2026 at 5:54 am

    When you create thing in your initStage function give it an id that you can reference later.
    So it looks like this…

    var thing = new Kinetic.Image({
        x: 0,
        y: 0,
        image: imageObj,
        id: "thingImage"
    });
    

    ..then in your update function you can reference it like this…

    var image = group.get("#thingImage")[0];
    

    Here’s a working example…
    http://jsfiddle.net/NPB77/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently learning F# and have tried (an extremely) simple example of FizzBuzz.
i tried to do a simple ksoap2 tutorial. This is the link My Problem
I tried to do some simple gamma correction on an image. At first, I
I have tried to create a simple controller/model (based on the samples code of
I tried this simple JavaScript code: eval('{Topics:[toto,tata,titi]}') In the Chrome console, for example, this
I've tried the simple MVC example like this How to properly activate an MVC
For a GET request I've tried this simple method: NSString *urlAddress = @"http://example.com/"; NSURL
I have a very simple layout of a product Image and an unknown number
I tried simple stopwatch program from http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ChronometerDemo.html . The following error is coming R.layout.chronometer
I have a seemingly simple html construct: <div class=featured-image img-wrapper full-width> <a href=http://localhost/wordpress/?p=26> <img

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.