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

change symbol background color by code

Explorer ,
Nov 06, 2017 Nov 06, 2017

Copy link to clipboard

Copied

hello,

Is there a way to change symbol background color by code dynamically?

i have it working like this.

function changebackground(hotbutton){

switch (hotbutton){

case "  2":

exportRoot.hotbtn_3.shape_1.graphics.f("#00FFFF").s().p("AhSBTQgjgiAAgxQAAgvAjgjQAigjAwABQAwgBAjAjQAjAjgBAvQABAxgjAiQgjAjgwAAQgwAAgigjg");

exportRoot.hotbtn_2.shape_1.graphics.f("#FF9900").s().p("AhSBTQgjgiAAgxQAAgvAjgjQAigjAwABQAwgBAjAjQAjAjgBAvQABAxgjAiQgjAjgwAAQgwAAgigjg");

exportRoot.hotbtn_2a.shape_1.graphics.f("#FF9900").s().p("AhSBTQgjgiAAgxQAAgvAjgjQAigjAwABQAwgBAjAjQAjAjgBAvQABAxgjAiQgjAjgwAAQgwAAgigjg");

exportRoot.hotbtn_2b.shape_1.graphics.f("#FF9900").s().p("AhSBTQgjgiAAgxQAAgvAjgjQAigjAwABQAwgBAjAjQAjAjgBAvQABAxgjAiQgjAjgwAAQgwAAgigjg");

break;

case "  3":

exportRoot.hotbtn_2.shape_1.graphics.f("#00FFFF").s().p("AhSBTQgjgiAAgxQAAgvAjgjQAigjAwABQAwgBAjAjQAjAjgBAvQABAxgjAiQgjAjgwAAQgwAAgigjg");

exportRoot.hotbtn_2a.shape_1.graphics.f("#00FFFF").s().p("AhSBTQgjgiAAgxQAAgvAjgjQAigjAwABQAwgBAjAjQAjAjgBAvQABAxgjAiQgjAjgwAAQgwAAgigjg");

exportRoot.hotbtn_3.shape_1.graphics.f("#FF9900").s().p("AhSBTQgjgiAAgxQAAgvAjgjQAigjAwABQAwgBAjAjQAjAjgBAvQABAxgjAiQgjAjgwAAQgwAAgigjg");

break;

}

}

but I'm changing the back ground color by doing it hard coded. I don't want to do this for 10-15 symbols.

thanks

Views

1.8K

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 , Nov 06, 2017 Nov 06, 2017

yes, you can:

exportRoot['button string'][shape string']

Votes

Translate

Translate
Explorer ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

Thank you so much that is what i was looking for

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
Explorer ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

the syntax is what kills me the most

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 ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

is there an api that shows that?

eg, checking easeljs, i don't see a shape property of movieclips:

Screenshot - 11_8_2017 , 7_44_51 AM.png

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
Explorer ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

LATEST

i'm using html5/canvas so when you go look at the javascript adobe creates it like this.

exportRoot.mysymbol.shape_1.graphics.f("#FF9900").s().p("AhCBDQgcgcAAgnQAAgmAcgcQAcgcAmAAQAnAAAcAcQAcAcAAAmQAAAngcAcQgcAcgnAAQgmAAgcgcg")

i knew there was a fill property i was just not using it right

this was the way i was trying to look for because i didn't want that long string

exportRoot.mySymbol.shape.graphics._fill.style = "#FF9900"; //changes its color to blue.

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