XML Feeds

.

[javascript-dev] Connect existing object to scripted one

Frans-Jan Wind fjw at ision.nl
Sun Jun 10 11:37:38 MDT 2007


Hello,

I'm trying to connect a existing named (thedata) receive object to a newly by js created unpack object. The script as it is crashes when uncommenting the declaration of "thedata". I just can't figure out how to address the existing object...

The patch:
max v2;
#N vpatcher 886 146 1486 546;
#P button 72 134 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 72 156 80 196617 js dataToGen.js;
#P newex 201 119 37 196617 r data;
#P objectname thedata;
#P connect 2 0 1 0;
#P pop;


The .js file "dataToGen.js"
inlets  = 1;
outlets  = 0;

var theunpack;
//var thedata = this.patcher.thedata;

function bang()
{
	if( theunpack )
	{
		this.patcher.remove( theunpack );
	}
	theunpack = this.patcher.newdefault( 200, 200, 'unpack', 0, 0);
	this.patcher.connect( thedata, 0, theunpack, 0 );
}

Any help is appreciated!
Frans-Jan


More information about the javascript-dev mailing list