Copy link to clipboard
Copied
I have a movieclip that is added to the stage in the authoring environment. I gave it an instance name of myInstance.
When I trace the instance name, it gives me Instance12.
Why is that? How can I change the instance name that dropTarget.name returns without removing all my instances from the stage, instantiating them with actionscript, and renaming them then (with 250 instances that have to be in exact pixel locations that would be a huge inconvience bordering on the impossible, especially if I ever have to move even one of them.)
If the dropTarget is another movieclip assigned to a class, is there any way to use dropTarget to access a parameter from within that class? (i.e., dropTarget.myVariable the same way you might use myObject.myVariable)?
Does that make sense?
Thanks!!
1 Correct answer
lol.
you're welcome.
(and, thank you for being so conscientious about marking helpful/correct answers.)
Copy link to clipboard
Copied
instance names assigned in the properties panel cannot be changed by you and won't be changed by flash.
what you're seeing is the dropTarget is not what you think it is. the dropTarget is not myInstance but something that you failed to name and that flash named for you, instance12.
if the dropTarget were a member of Class1 which had a public variable (eg, var1), you could use:
Class1(whatever.dropTarget).var1
Copy link to clipboard
Copied
I tried this:
trace (GeoPuzzle(this.dropTarget).abbrev);
But I got this error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Shape@d25c061 to com.freerangeeggheads.puzzleography.GeoPuzzle.
at com.freerangeeggheads.puzzleography::GeoPiece/geoPieceEnd()[/Users/Amber/Documents/Apps/Puzzleography/Project/com/freerangeeggheads/puzzleography/GeoPiece.as:51]
When I trace this.dropTarget.parent.name I get the actual instance name of the movie clip on the stage.
Is there a tutorial or something that will explain this heirarchy to me? I don't even know what to google, and navigating Adobe's documenation is like trying to nail jello to a tree. 😕
Copy link to clipboard
Copied
Also, how do I assign something an instance name? I thought it was in the properties panel, but I've named everything that way, and tracing the parent name of the dropTarget gives me the proper instance name, which means the movie clip on the stage has created a child (??) that flash has named for me. Wow, I'm confused.
Copy link to clipboard
Copied
your dropTarget is a shape. it's the shape on your movieclip's timeline: use the dropTarget.parent.
trace (GeoPuzzle(this.dropTarget.parent).abbrev); // i'm not sure "this" is correct. it might be, though.
for objects not placed on-stage you can assign/change the name by using:
whateverobject.name="somename";
Copy link to clipboard
Copied
Oh, I see!
Edited: I'm an idiot, that totally worked.
Copy link to clipboard
Copied
Hm. Well, I can't remark that proper answer as the correct answer, I accidentally marked it "helpful." If you reply to this I'll mark that correct so the answer shows up.
THANK YOU!!!
Copy link to clipboard
Copied
lol.
you're welcome.
(and, thank you for being so conscientious about marking helpful/correct answers.)

