On 02/02/2011 10:12, Wenzler, Thomas wrote:
Hi List, I just made a little experiment with this code...

function setMovieClipX(mc,desiredCoordX):Boolean
{
        var updated:Boolean=true;
        (desiredCoordX!=mc.x)?mc.x=desiredCoordX:updated=false;

"If the x posn isn't the right one move the movieclip, otherwise update the status"

        return updated;
}
trace(setMovieClipX(movieClip,286));

...and found to my utmost surprise that the trace command actually executed the 
function and updated the movieClip.x position instead of just tracing true or 
false.

It's just doing as you ask, isn't it?

If you check omit Trace in the Publish settings, movieClip remains at it's x 
Position.
Well, it would!
Wonder if this could be of any use or is a potential danger when using traces 
to debug?
Unless there's something I'm missing, everything is working as I would expect it to.

If you pass a function call as a parameter, the function is run. If the function includes code that will move a movieclip, the clip will move.

Regards
Thomas
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to