Skip navigation


We know how to send a simple call from flash to 3dsMax now we wanna know how to receive and this call inside 3dsMax.
This is not the best way to do that but a good example to have a quick understand of how it works.

First we have to put inside the rollout that host the .swf an listener for all fscommand it’s exactly like the Click

Eventlistener inside Flash viewed in part 3.

on flashhosteur FSCommand cmd args do
(
flash_FSCommand cmd args
)–End Of flashhosteur FsCommand

This command call a function used to filter all fscommand and find the good function to call using a case of.

fn flash_FSCommand cmd args =
(
–format « flash_FSCommand -> % %\n » cmd args
case cmd of
(
« AnimateToggle »:
AnimateToggle args
)
)

Here the case of will read the command argument receive from the fscommand if this cmd correspond to one of the cases it will

read the line just after in our case call another function inside our script.

The fonction called is :

fn AnimateToggle args =
(
if (args == « true ») then
(
animButtonState = true
)
else
(
animButtonState = false
)
)

This function examine the arg value sent by the fscommand.
In simple english this function is doing this:

If fscommand called AnimeToggle, the fscommand send to this function an argument, if this argument is equal to true then turn the animate mode to on else turn it to false.

To toggle animate mode we can simply in the case of:

« AnimateToggle »:
max tool animmode

But the goal is to show you how to use function to call inside an fscommand call. This will be very usefull when making more complicated things.

Here is the final .ms code at this step:

try(destroyDialog flash3dsMax_Explain)catch()  –if opened
try(destroyDialog flash3dsMax_Explain)catch()

fn AnimateToggle args =
(
if (args == « true ») then
(
animButtonState = true
)
else
(
animButtonState = false
)
)

fn flash_FSCommand cmd args =
(
–format « flash_FSCommand -> % %\n » cmd args
case cmd of
(
« AnimateToggle »:
AnimateToggle args
)
)

rollout flash3dsMax_Explain « Flash / 3dsMax Explain »
(
activeXControl flashhosteur « {D27CDB6E-AE6D-11cf-96B8-444553540000} » pos:[0,0] width:500 height:500 releaseOnClose:true

local SwfFile = « C:\\Users\\eddy\\Desktop\\flash3dsMax_explain\\flash_explain_03.swf »

on flash3dsMax_Explain open do
(
try
(
— initialise activeX object
flashhosteur.movie = SwfFile
)
catch
(
— retry
flashhosteur.movie = SwfFile
)
)

on flashhosteur FSCommand cmd args do
(
flash_FSCommand cmd args
)–End Of flashhosteur FsCommand

)
createDialog flash3dsMax_Explain « Shockwave Flash Input Test » width:500 height:500

Publicités

2 Comments

  1. Dear Eddy…

    You did a real great job! Thank you for your help…
    I’m really interesting in this course!

    but, now I have a problem that need your help,
    I know « How to send command to 3ds Max from Flash »,
    But, I don’t know « How to send command/call function to Flash from 3ds Max »!!!???

    Would you please tell me, how to figure it out… ^ ^

    thanks, and best regards!

    Pan@Taiwan

    • Sorry i do not find time to finish this tutorial. hope i will do it soon.


Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s

%d blogueurs aiment cette page :