Hi everyone - hope some kind and wise person can figure this one out !
I'm trying to optimize my code by using what I call 4 "BIG" functions lol - that is, functions that include many parameters(one of them has 9 and works OK).
Problem is that though I got three working fine, the 4th one just wont work.
I always ensure my functions are created on the mainstage. That way, I can easily invoke them by just typing into my code, for example,
_root.funcOne(x,y,z);
Purpose of function: if an object (mcA in which the function is invoked) hitTests another object (mcB) and mcB's variable zz is true, then mcA's variable Alert goes True, in which case mcA is deleted (mcA being a duplicated mc).
Below please find the original source code "behind" the problem function .... and right below that I have placed the actual function I created on the mainstage. Also, finally, I tyed in how I invoke that function. Problem is that the critical variable "alert" (parameter C) just wont go true. This function is invoked on 8 similar MC's, within onClipEvent(enterFrame), as are the other 3 which work fine.
ORIGINAL SOURCE CODE that existed in all 8 MC's prior to being replaced by the function:
if(this.hitTest(_root["e"+h]) && _root["e"+h].zz==true){alert=true};
if(this.hitTest(_root["d"+h]) && _root["d"+h].zz==true){alert=true};
if(this.hitTest(_root["c"+h]) && _root["c"+h].zz==true){alert=true};
if(this.hitTest(_root["b"+h]) && _root["b"+h].zz==true){alert=true};
if(this.hitTest(_root["a"+h]) && _root["a"+h].zz==true){alert=true};
FUNCTION:
function alertWatch(a,b,c){
if(a.hitTest(_root["e"+b]) && _root["e"+b].zz==true){c=true};
if(a.hitTest(_root["d"+b]) && _root["d"+b].zz==true){c=true};
if(a.hitTest(_root["c"+b]) && _root["c"+b].zz==true){c=true};
if(a.hitTest(_root["b"+b]) && _root["b"+b].zz==true){c=true};
if(a.hitTest(_root["a"+b]) && _root["a"+b].zz==true){c=true};
}
HOW ABOVE FUNCTION IS INVOKED:
_root.alertWatch(this,h,alert);
(h is a variable within each MC that corresponds to an
_x coordinate. All other 3 functions have this same
paramter.
Since the function is invoked in an "enterFrame" environment, it should be continuously running I presume.
Sorry this is long-winded. Any insights would be appreciated, thanx in advance !
I want to Learn !!
I'm trying to optimize my code by using what I call 4 "BIG" functions lol - that is, functions that include many parameters(one of them has 9 and works OK).
Problem is that though I got three working fine, the 4th one just wont work.
I always ensure my functions are created on the mainstage. That way, I can easily invoke them by just typing into my code, for example,
_root.funcOne(x,y,z);
Purpose of function: if an object (mcA in which the function is invoked) hitTests another object (mcB) and mcB's variable zz is true, then mcA's variable Alert goes True, in which case mcA is deleted (mcA being a duplicated mc).
Below please find the original source code "behind" the problem function .... and right below that I have placed the actual function I created on the mainstage. Also, finally, I tyed in how I invoke that function. Problem is that the critical variable "alert" (parameter C) just wont go true. This function is invoked on 8 similar MC's, within onClipEvent(enterFrame), as are the other 3 which work fine.
ORIGINAL SOURCE CODE that existed in all 8 MC's prior to being replaced by the function:
if(this.hitTest(_root["e"+h]) && _root["e"+h].zz==true){alert=true};
if(this.hitTest(_root["d"+h]) && _root["d"+h].zz==true){alert=true};
if(this.hitTest(_root["c"+h]) && _root["c"+h].zz==true){alert=true};
if(this.hitTest(_root["b"+h]) && _root["b"+h].zz==true){alert=true};
if(this.hitTest(_root["a"+h]) && _root["a"+h].zz==true){alert=true};
FUNCTION:
function alertWatch(a,b,c){
if(a.hitTest(_root["e"+b]) && _root["e"+b].zz==true){c=true};
if(a.hitTest(_root["d"+b]) && _root["d"+b].zz==true){c=true};
if(a.hitTest(_root["c"+b]) && _root["c"+b].zz==true){c=true};
if(a.hitTest(_root["b"+b]) && _root["b"+b].zz==true){c=true};
if(a.hitTest(_root["a"+b]) && _root["a"+b].zz==true){c=true};
}
HOW ABOVE FUNCTION IS INVOKED:
_root.alertWatch(this,h,alert);
(h is a variable within each MC that corresponds to an
_x coordinate. All other 3 functions have this same
paramter.
Since the function is invoked in an "enterFrame" environment, it should be continuously running I presume.
Sorry this is long-winded. Any insights would be appreciated, thanx in advance !
I want to Learn !!