Forums > Javascript

scrolloffset(array,get) problem

July 20, 2009 | 4:31 pm

Hi,
I’m trying to write a js object that will return the scroll offset of a patch when banged. It seems pretty straight forward to use the scrolloffset(array,get) method to return these values, but I am receiving an error: ReferenceError: get is not defined, line 8

I’ve looked in the reference and it was not entirely clear on this method.

Any help would be great. My code is listed below.
Thanks in advance,
Chris

inlets= 1;
outlets= 2;

p= this.patcher;
var offset;

function bang()
{
    p.scrolloffset(offset, get);
    outlet(0,offset[0]);
    outlet(1,offset[1]);
}

July 20, 2009 | 7:11 pm

Scrolloffset is a property of the patcher object rather than a function. Try replacing the first line in your "bang" function with the line below and it shouldn’t cause an error.

lh

offset = this.patcher.scrolloffset;

July 20, 2009 | 7:31 pm

Thanks for your help, although it still is not outputting the scroll offset of the window… and I’m not sure why. Here is the current code. Any thoughts?

Thanks,
Chris

inlets= 1;
outlets= 2;

p= this.patcher;
var offset;

function bang()
{
    offset = this.patcher.scrolloffset;
    outlet(0,offset[0]);
    outlet(1,offset[1]);

}

July 29, 2009 | 6:32 pm

Hi Nicolas,

The scrolloffset is what we want, but it is currently not working. Apparently a lot of the JS stuff needs to be re-written and Cycling 74 hasn’t gotten around to it. I alerted them of the problem so hopefully it will be fixed soon.

I too am waiting on these fixes to finish up a program I’ve been working on it.

Best,
Chris


January 16, 2012 | 3:50 am

it still doesn’t work ):


October 11, 2012 | 8:35 pm

I’m on Max6.0.7 and I’m also getting 0 and 1 on the scrollbaroffset property. It seems to be broken still. Anybody found a workaround to get scroll position on a patcher (or bpatcher)?


January 14, 2013 | 3:12 pm

My problem was the opposite,
I found this solution, accessing to the wind properties:

inlets = 1;

function bang()
{
this.patcher.wind.scrollto (X, Y);
}


Viewing 7 posts - 1 through 7 (of 7 total)