1 Reply Latest reply on Dec 15, 2006 4:27 AM by blemmo

    Function Parameters Not Enforced

      This is the most annoying thing I find about Flash. When you call any function and pass through incorrect parameters Flash does not pick you up on it.

      For example I was tyring to remove a movieclip using this._scope.removeMovieClip("projectsMediaContainer_mc"). Obviously this should have been this._scope.projectsMediaContainer_mc.removeMovieClip(). But Flash did not pick up on the fact that removeMovieClip accepts no parameters. Instead it just behaved unpredictably and cost me a heap of wasted time.

      I think it should throw some sort of compile/runtime error. Is there a way to do some sort of "strict" development where this kind of stuff is enforced? Do other people find this as well?
        • 1. Re: Function Parameters Not Enforced
          blemmo Level 1
          Well on the other hand it allows you things like:

          function drawMC(mc:MovieClip){
          if (mc == undefined) mc = _root;

          and then drawMC( ) or drawMC(someMC).

          But I agree, it's a bit ambiguous sometimes. I think the Actionscript 3 compiler is far more strict in such things, don't know if it checks for parameters though. The AS 2 compiler doesn't support the strict development you're talking about, even the var typing isn't really strict. I guess AS 3 is more like that.