Date: Thu, 18 May 1995 09:13:10 -0700 From: Alex Zavatone <azavatone@MACROMEDIA.COM> Subject: Tip: passing variables to and from Miaws.Hi folks, I'm back after a long crunch period.
I'm currently working on throwing data throughput measurement into the memmon miaw. The purpose of this is to show you the speed at which data is loaded in when cast members are loaded off disk/cd/the net/whatever. If you burn a cd with the memmon you can measure the performance of your product off disk and get real numbers. Yeah.
THE PROBLEM IS: Getting info from the stage into the miaw is not as easy as one would hope. Doing an operation like:
set total = total + the size of cast temp <in a miaw gets the size of the cast in the miaw, not the stage. A solution does exist that is a bit obscure. The method here is to look for an empty castmember on the stage with findempty(cast 1). Then copy to clipboard a script castmember with the handler you want to be executed from the stage. The last line before the end of the handler returns the desired value. Then you call the handler from the movie in a window like this:
tell the stage to GetCastSize(currentCast) set total = total + the resultAt the end of the process, when all the casts have been grabbed:
tell the stage to set the scripttext of script "xxx" = "" -- (the script pasted in from the miaw) tell the stage to set the name of cast the number of cast "xxx" = ""This removes the script from the main movie. Originally, I was against making a self modifying movie but there seem to be few side effects. Setting the dirty bit of the stage movie is one and not pasting in duplicate cast names is the other. Unfortunately, a simpler case where you simply:
tell the stage to set x = 2 put the resultdoes not work. Here, the result is for success or failure of the set. 1 will be returned.
Oh and don't forget that globals are shared between the stage and all miaws. And credit goes to Jason Yeamon from our tech support for the innovative use of findempty.
Hope this helps
Alex Zavatone
Director Engineering
Macromedia