The start of the day was really nice with the orange ball whose surface temperature known to be 5800K just shooting up in the sky. Was really nice to see him on the rise. So had my quick breakfast and was making my way to work.
Soon after i landed i opened flash and geared up to look at it for the rest of the day. Soon i remembered about sterday where my colleague had a problem using those absolute paths to refer the movieclips due to which the heads were rolling on the floor with our dealine coming to a deadend.
I am an actionscript developer who is basically against using all those absolute paths and am comfortable using relative paths.
But the problem right in front was due to the fact of utter laziness. Seems to be like the movieClip was emerging around 7-8 levels inside the stage. (like _level0.instance1.instance2.instance3.instance4.instance5.instance6.mc);.
here we had to make a function call that resides in the level0 but were unable to coz the movie that we are publishing is just one of the swfs that gets loaded in another swf. and this might change sometime in the future. As i had faced all these scenarios 2 years before itself the experience helped me and i decided on that fine day that i will never use any absolute scoping but only relative mapping at any cost.
Now here is what i did to solve this problem. The movieclip instance from where i needed to call the function was a subchild of order 7 in a main instance on the stage called "$holder". So if we need to access the stage's timeline variables or functions we need to probably call like this
As i said earlier it is my principle that i will not use the second method(absolute pathing method).
So would i use the first method >???? NO !
Better i will device a prototype such that i will be able to use it to handle all the similar problems.
The solution was like this. But before that i had laid a simple rule that the last parent MC i.e., on the stage timeline will have an instance name and no other subparents inside it will have .
cool ? let's get back to the prototype.
MovieClip.prototype.findTheParent = function(whoseNameIs:String):MovieClip
var mc:MovieClip = this;
while(mc._name != whoseNameIs)
mc = mc._parent;
So now coming to the part where this helped actual scenario being implemented, it was like using this way.....
instead of the below already above mentioned METHODS !@!!!!!!!
Hope this helps you all !. But sure it helped me!