Sign in to follow this  
Adam Procter

Mutiple graphics same name ?

Recommended Posts

This will draw me buttons for each of my nodes but when ever I click on the buttons and console.log (this.name)  I only ever get the last node_id ? Which seems odd

 

      for (i = 0; i < Object.keys(this.myNodes).length; i++) {
        for (j = 0; j < Object.keys(this.configPositions).length; j++) {
          if (this.configPositions[j].node_id == this.myNodes[i].node_id) {
            buttons.name = this.myNodes[i].node_id
            buttons.lineStyle(0)
            buttons.beginFill(0xcab6ff, 1)
            // x, y, radius
            buttons.drawCircle(
              this.configPositions[j].x_pos + this.configPositions[j].width,
              this.configPositions[j].y_pos +
                this.configPositions[j].height / 2,
              15
            )
            buttons.endFill()
            // names it the last one only?
          }
        }

 

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.