XML Feeds

.

[javascript-dev] can't move fpic with Maxobj.rect, is there another way?

Dan dlehrich at gmail.com
Mon Oct 22 21:45:14 MDT 2007


I've been using Javascript to move objects successfully, but it doesn't seem to work on the fpic object.  See sample code below for an example of my problem.

Is there another way to move fpic objects through javascript?

Thanks
Dan

Save this as "fpic_move_test.js":

inlets = 1;
outlets = 1;

//// these functions look the same to me, but moving the fpic doesn't work.
////
//// is there a way to move an fpic object in javascript?

function move_myPanel(X, Y)
{
	/// get my panel object
	var myPanel = this.patcher.getnamed("myPanel");	

	/// move the 100x100 Panel
	myPanel.rect = [X, Y, X+100, Y+100];
}

function move_myFpic(X, Y)
{
	/// get my fpic object
	var myFpic = this.patcher.getnamed("myFpic");

	/// move my Fpic
	myFpic.rect = [X, Y, X+100, Y+100];
}

And then run this Max patch:

max v2;
#N vpatcher 178 288 821 782;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 92 178 100 196617 This doesn't:;
#P message 92 196 114 196617 move_myFpic 300 300;
#P message 43 128 120 196617 move_myPanel 285 200;
#P comment 433 132 117 196617 This is named "myFpic";
#P user fpic 439 172 102 52 DL_Player_Replace_Button_2.jpg 0 0 0 0. 0 0 0;
#P objectname myFpic;
#P newex 43 275 105 196617 js fpic_move_test.js;
#P user panel 290 163 100 100;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P objectname myPanel;
#P comment 279 136 117 196617 This is named "myPanel";
#P comment 453 148 100 196617 (load any pic);
#P comment 42 109 100 196617 This works:;
#P connect 7 0 4 0;
#P connect 8 0 4 0;
#P pop;



More information about the javascript-dev mailing list