Hello,I find that the "Insert target paths" tool on the Actions panel can't work correctly sometimes in Flash Professional CS3/CS4/CS5.
1.Create a movieclip in scene1 ,and its instance name is "mc1".
2.Create a embedded movieclip (instance name "mc2") in one of mc1's frames.Now the relationship is "scene1->mc1->mc2".
3.Now I'd like to place an action in the timeline of mc1,and I want to use this action to affect mc2.If I write the path by myself,the target path should be " this.mc2.stop(); " or just " mc2.stop();". And those are the correct paths.However if i use the "Insert target paths" tool on the Actions panel to get a relative path for mc2,the tool will give me code like "this.mc1.mc2" or "Object(this).mc1.mc2" in CS5.That is to say, this stupid tool give me a wrong relative path and make my action failed.Because the tool thinks that "this" refers to "_root" all the way only if the action code is on the frames of any timeline.
In fact,if you want to place actions in the movieclip timeline,the "Insert target paths" tool will surely give you a wrong relative path which maybe confuse "this" with the "_root".But If you choose "absolute paths" while using the tool,you wil get a corrent absolute path.And if you place actions on the movieclip itself instead of its timeline,you will get a correct relative path,too.
Have you experienced this problem?
Do you have any solutions?
Thanks for your help.
Just hit the same problem. mc1 plays, stops on its last frame and tells mc2 to play. Using relative target paths,
I get this error:
TypeError: Error #1010: A term is undefined and has no properties
If I use Absolute path
it works fine.
That would indicate that your setup is different from the original posting. In the original posting mc2 is placed within mc1. But in your case, if that line of code works, it indicates that mc2 is on the root timeline, not inside mc1.
Yes, mc1 and mc2 are both on the root timeline. The similar issue is that using a relative path does not work. Its been awhile since I used Flash and could do wonders with AS 2, but AS 3 is hard to get used to. (second nature to start typing _root...). I was told to avoid absolute paths and vars, and use events. What is the best way to have a movie clip play and then tell another (sibling) movie clip to play when it reaches a certain frame? When mc1 stops on frame x, the code below runs. The commented line is the one that does not work.
var fl_SecondsToCountDown:Number = 1;
var fl_CountDownTimerInstance:Timer = new Timer(1000, fl_SecondsToCountDown);
is not a correct relative path if it is coming from inside mc1. "this" refers to the current timeline, and that would be the timeline inside mc1.
Using "this" is very often unnecessary, especially in AS3. A correct relative path to mc2 would be "mc2" if you are in the tieline where mc2 lives, as in... mc2.play(); there is no need to use "this" at all.
As far as the orginal complaint of this posting goes, which refers to the using the Actions panel to define paths... the safest solution is to not use the automatic script tools provided in the Actions panel and learn how to code without Script Assist. I remember somewhere beyond a decade ago when I first started using Flash I tried using the Script Assist feature and was quickly frustrated with it... so we parted ways and I never looked back.
Just a little weird that the actions panel would give me a wrong relative path but a good absolute path. I no longer know how to code to a movie clip on the root from inside a movie clip.
Is there a hand coding alternative for "Object(root).mc2.play();" ?