• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how to address a symbol that was added dynamically in ANCC HTML5?

LEGEND ,
Jul 25, 2018 Jul 25, 2018

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

}

Views

635

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 25, 2018 Jul 25, 2018

Hi.

Use colonial.gotoAndStop("author1");

Votes

Translate

Translate
LEGEND ,
Jul 25, 2018 Jul 25, 2018

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

Makes sense! Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

Hi.

Use colonial.gotoAndStop("author1");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

Muita obrigada! This was it. I am forever grateful for your input!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

De nada! I do appreciate your Brazilian Portuguese.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

Love Brazil! Named my first daughter after my best Brazilian friend. Saudade dela!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

JoãoCésar  wrote

Hi.

Use colonial.gotoAndStop("author1");

Yes, that's exactly what I said, twice.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

Except I did not get it because I just thought you were talking about the misspelling! Thanks anyway.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

That's why it's generally a good idea to read all the sentences, not just the first one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2018 Jul 25, 2018

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines