Copy link to clipboard
Copied
I have several symbols added dynamically into a blank symbol. I swap them on click events from buttons in a menu however I do not seem to be able to manipulate them after they have been added to the stage. I suppose it has to do with the fact the I need an instance name to use them.
Is the link name the same as an instance name? Probably not because I get the following error.
this.blank.colonialSymbol is undefined
So is there a way to add an instance name to these symbols so I can use them porperly?
var colonial = new lib.colonialSymbol();
//************** LOAD BUTTON ACTIONS *************************
this.addBtn.addEventListener("click", loadSymbol.bind(this));
function loadSymbol(){
this.blank.addChild(colonial);
this.blank.colinialSymbol.gotoAndStop("author1"); // symbol timeline - gives undefined
this.gotoAnStop('start'); // main timeline
}
Hi.
Use colonial.gotoAndStop("author1");
Copy link to clipboard
Copied
Well, in your code you misspelled colonialSymbol as "colinialSymbol". But you should be able to use "colonial" to control it, since that points to the newly created object.
Copy link to clipboard
Copied
Nope. I made a typo here but it was correct in the actual FLA.
So per your advice and to make sure, I changed it to colonial (which I had tried before BTW and I got the same error)
this.blank.colonial.gotoAndStop("author1");
in the console:
this.blank.colonial is undefined
Copy link to clipboard
Copied
Yes, this.blank.colonial is undefined because you never created any such thing. What you do create is local variable colonial in the first line. Try using that.
Copy link to clipboard
Copied
Makes sense! Thanks.
Copy link to clipboard
Copied
Hi.
Use colonial.gotoAndStop("author1");
Copy link to clipboard
Copied
Muita obrigada! This was it. I am forever grateful for your input!
Copy link to clipboard
Copied
De nada! I do appreciate your Brazilian Portuguese.
Copy link to clipboard
Copied
Love Brazil! Named my first daughter after my best Brazilian friend. Saudade dela!
Copy link to clipboard
Copied
I have another question.
Is it better to load instances from the library and use them as needed than putting everything on the main timeline? I know in design it is easier because you can make your main timeline transitions there once only rather than having a bunch of symbols and transitions.
But what about memory, file size, etc...
Copy link to clipboard
Copied
JoãoCésar wrote
Hi.
Use colonial.gotoAndStop("author1");
Yes, that's exactly what I said, twice.
Copy link to clipboard
Copied
Except I did not get it because I just thought you were talking about the misspelling! Thanks anyway.
Copy link to clipboard
Copied
That's why it's generally a good idea to read all the sentences, not just the first one.
Copy link to clipboard
Copied
Sorry I am French and I read all of it and still understood you were speaking of the typo. But thanks for answering the question. I am grateful to you as well.