catonpub

Q: Brush size using the slider object

I am trying to set up a group of coloring pages.  I want to use the slider to change the brush sizes.  I have added the slider button and have set the parameters but they are not associated to the brush.  Can someone explain how to do this?  Thanks

OS X Mavericks (10.9.2), i just purchased my MAC

Posted on Apr 17, 2016 7:36 AM

Close

Q: Brush size using the slider object

  • All replies
  • Helpful answers

  • by spinaluc@,

    spinaluc@ spinaluc@ Jul 8, 2016 12:17 AM in response to catonpub
    Level 1 (4 points)
    Jul 8, 2016 12:17 AM in response to catonpub

    Hi catonpub,

    you can use a javascript code.

    1) name the Drawing object as "drawingView" (selecting it and changing its name in the inspector,

    first field called Outlet);

    2) select the slider and in the bottom of inspector, in the Interaction section, add an event as a "Did change value",

    choosing Execute Javascript;

    3) when the javascript page opens, select the text you will find and replace it with this:

     

    this.onControlValueChange = function (event) {

              // Code here for the "Did Change Value" event.

    var drawingView = this.viewController.outlets.drawingView;

        drawingView.brushSize = this.value;

     

    };

    4) in the properties of the slider (inspector) I set the Initial value to "5", as the default brush size in the Drawing object.

     

    Enjoy your widget and have a nice day!