send data from max/msp to flash

Jun 5, 2006 at 8:11pm

send data from max/msp to flash

hello, i want to send data from a max patch to an flash.swf. therefor i downloaded the flashserver 1.1. when i press a button in the swf i can recieve data in my max patch. but now i want that the button in my swf changes his colour when i change a parameter in the patch. the question is where i have to write down this code? i put it in the “action”-frame where all my other code for the recieving is.

function onMaxData(doc)
{
argv = []; // create a new array
doc = doc.substr(0, doc.length – 1); // chop off ‘;’ at the end
argv = doc.split(” “); // split at spaces and convert to array
argc = argv.length; // get number of elements in array
for(i = 0; i < argc; i++) // loop through all arguments
{
msg += “argument “+ i +” is “+ argv[i];
}
clip = argv[0]; // get name of MovieClip
frame = argv[1]; // get the frame number
_root[clip].gotoAndPlay(frame);
}

an what i have to do in the max patch. i have to connect a broadcast (send) tool with the flashserver an wirte down “broadcast taste_01_01 4″ (taste_01_01 = is the name of my movieclip / 4 is the frame of the movieclip)

it dosent work at the moment. has anyone an idea. do i have to wirte any code in my movieclip? is it correct to put all the code in a several action frame?

thanx
christian

#26306
Jun 6, 2006 at 3:50pm

Am 05.06.2006 um 22:11 schrieb royal8:

>
> hello, i want to send data from a max patch to an flash.swf.
> therefor i downloaded the flashserver 1.1. when i press a button in
> the swf i can recieve data in my max patch. but now i want that the
> button in my swf changes his colour when i change a parameter in
> the patch. the question is where i have to write down this code? i
> put it in the “action”-frame where all my other code for the
> recieving is.

That’s the correct place for it. There is just one onMaxData()
function and that’s exactly the place where you have to put all the
code that controlls Flash.

>
> function onMaxData(doc)
> {
> argv = []; // create a new array
> doc = doc.substr(0, doc.length – 1); // chop off ‘;’ at the end
> argv = doc.split(” “); // split at spaces and convert to array
> argc = argv.length; // get number of elements in array
> for(i = 0; i < argc; i++) // loop through all arguments
> {
> msg += “argument “+ i +” is “+ argv[i];
> }
> clip = argv[0]; // get name of MovieClip
> frame = argv[1]; // get the frame number
> _root[clip].gotoAndPlay(frame);
> }
>
> an what i have to do in the max patch. i have to connect a
> broadcast (send) tool with the flashserver an wirte down “broadcast
> taste_01_01 4″ (taste_01_01 = is the name of my movieclip / 4 is
> the frame of the movieclip)

Yes, with the above code and a movieclip named ‘taste_01_01′ you
would use a ‘broadcast taste_01_01 4′ to make it jump (and play) to
frame 4.

>
> it dosent work at the moment. has anyone an idea. do i have to
> wirte any code in my movieclip?

Nothing flasherver / Max related, but probably a Stop() or GotoAndStop
() somewhere.

> is it correct to put all the code in a several action frame?

I usually use one layer that just has the action scripting inside.
This ‘frame’ should cover the full lengt of the flash movie and you
should never jump back top the first frame in your movie or Flash
would connect to Max again.

Olaf

#78404

You must be logged in to reply to this topic.