Copy link to clipboard
Copied
Hello, I am trying to write some simple code that checks to see if an object exists on the stage. But I'm not really sure how this is supposed to work. If I check if it's on the stage i get a conversion error. If I try to do a simple if exists statement it always returns true. I just want to check if an object exists on every frame, and if it exists, pull it's coordinates.
I attached a small piece of sample code. This should be simple but actionscript makes it so difficult...
https://drive.google.com/file/d/1fFEMDH80YPql0su2UOtnRkWgd4DbpZCP/view?usp=sharing
Copy link to clipboard
Copied
Hi.
You need to assign an instance name to your Movie Clip instance using the Properties panel.
Also, there's no need to export the Movie Clip to ActionScript if you're not gonna need to add it at runtime. And if you do need it to be exported for ActionScript, choose a different name for the class.
And to safely check if a instance exists on the display lists, just check for the instance itself and for the stage property.
if (yourInstance && yourInstance.stage)
// do something
As this is a duplicated question, I'm going to block the other discussion:
https://community.adobe.com/t5/animate-discussions/scanning-an-object/m-p/12649090#M350338
I hope this helps.
Regards,
JC
Copy link to clipboard
Copied
thank you, i was finally to get this working properly and pull the proper dimensions of the object.
Copy link to clipboard
Copied
You're welcome.