|
-
localToGlobal method
Hello, people!
First off, I'm rather green when it comes to programming in actionscript so please forgive me any embarrassing mistakes in my code - trust me Im trying hard to get it done correctly.
So, I'm having this problem that haunts me for 3 days now. I guess I can honestly admit now that I just dont know how to use this method properly.
My stage contains two movie clips where each of them got another movie clip inside:
forth.forths
codes.codess
My goal is to hitTest "forths" and "codess".
Apparently I cant just hitTest these two normally so its where "localToGlobal" is supposed to do the trick.
Just as shown in various tutorials, I added code to the frame in the main stage:
Code:
var point:Object = {x:codes.codess._x, y:codes.codess._y};
codes.localToGlobal(point);
What it is supposed to do is to create a point with "codess" local coordinates that later are converted into global coordinates (of the _root stage)
So, afterwards I went to the "forths" MC and scripted it with:
Code:
onClipEvent(load) {
if(hitTest(point.x, point.y)==true) {
stop();
}
}
Thats it, its still not detecting any collision between these two. I've changed this code several times, added "_root" at the beggining of patchs to make sure it goes correctly to the main stage (even tho it wasnt done in tutorials).
Hopefully someone here will be able to help me and point out that nasty mistake I made, so I can learn from it and improve my "skills".
For any help attempts - thanks !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|