Accessing instances of symbols via Actionscript 3 in Flash?

Taking forward Fahim Akhter's answer You can then loop to get the parent until the object is a movieclip var o:DisplayObject=objectsi; while(!(o. Parent is MovieClip)) { o=o. Parent; } var myMovieClip:MovieClip=o.

Parent This should give you a movie clip in myMovieClip and when you trace myMovieClip. Name you'll get what you are looking for This will also work for multiple level symbols (where 1 symbol contains another).

Taking forward Fahim Akhter's answer, You can then loop to get the parent until the object is a movieclip var o:DisplayObject=objectsi; while(!(o. Parent is MovieClip)) { o=o. Parent; } var myMovieClip:MovieClip=o.

Parent; This should give you a movie clip in myMovieClip and when you trace myMovieClip. Name, you'll get what you are looking for. This will also work for multiple level symbols (where 1 symbol contains another).

I just wrote my own answer, but your solution is more dynamic and re-usable than mine, so I will go ahead and accept yours as the answer. Thanks to Fahim Akhter and you, Pranav Hosangadi – JonathonG Nov 3 at 16:23 Pranav, there seems to be an issue with your code. Flash doesn't want to let me assign a DisplayObject to a MovieClip: var myMovieClip:MovieClip=o.

Parent; removing ":MovieClip" removes the error, but I'm not sure how good of a fix this is. – JonathonG Nov 3 at 17:12 1 Change that line to var myMovieClip:MovieClip=o. Parent as MovieClip; – Pranav Hosangadi Nov 4 at 8:12 Removing the :MovieClip just makes myMovieClip an untyped vaariable, so you can assign anything to it.

Same as myMovieClip:Object or myMovieClip:* – Pranav Hosangadi Nov 4 at 8:14.

Reminds me of a quotation "I do not have the solution to your problem, but I certainly admire the problem" If you try to trace(objectsi) you'll see the function getObjectsUnderPoint is returning a shape not the MovieClip, so you never get the name you are looking for.

Yes this is true (about the Shape vs. MovieClip thing). Have you any idea how I can get it to return a MovieClip instead of a shape? – JonathonG Nov 3 at 16:14 1 I just woke up seems like you've already solved it :) – Fahim Akhter Nov 4 at 6:35.

Fahim Akhter pointed out in a comment that I was tracing shapes, not objects. This led me to a more accurate google search than I had been able to craft thus far. The search led me to this forum thread: actionscript.org/forums/showthread.php3?... And in this particular post (number 6), the author pointed out that "It turns out that getObjectsUnderPoint returns an array of the simplest object- the child-est, if that makes any sense.

I was able to solve part of the problem by simply adding a . Parent to the end of my variable..." I appended . Parent to the object, and received the appropriate name: var pt:Point = new Point(e.

StageX, e. StageY); var objects:Array = stage. GetObjectsUnderPoint(pt); var action = 0; for(var i=0; i= 0 ){ action = 1; } if(objects.

IndexOf('right_box') >= 0 ){ action = 2; } This solves my problem, and hopefully leads us all to a better understanding of getObjectsUnderPoint.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions