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

Changing instance properties programmatically

New Here ,
Nov 03, 2020 Nov 03, 2020

Hi all,

I’m a lapsed js/as coder, dipping my toe back in with Adobe Animate.

I’ve put together a data viz scrounging bits of code from discussions around the web, but I’m banging my head trying to find what js library I’m drawing from, and how to access (address?) properties of AA library objects I’ve instantiated.

 

My code:

 

var _button = new lib._BlockRed();

// setting a means of identifying this on stage
stage["school" + num] = _button;
stage.addChildAt(_button,0);

// 'gotcha' being the elusive named instance
var gotcha = stage["school" + num];

gotcha.shape.graphics._fill.style = "#cc0000";

 

 

The above works to set a color, but I haven't been able to figure out how to change the size, set index or who knows what else I'll want to do to it. I settled on making a second keyframe to change the size and color, but I'd really like to find the api to access all shape.graphics properties.

 

createjs has a graphics.fill, but that's not it, right? 

 

My first post here so let me know if I've breached protocol.

Too, if I'm going about programmatically editing instances the wrong way, a nudge in the right direction would be greatly appreciated.

 

Thanks,

Sean

357
Translate
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 ,
Nov 03, 2020 Nov 03, 2020

You say you don't know what JS library to use, but then you namedrop CreateJS, which is exactly what Canvas uses, so I have no idea what you're asking.

Translate
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
New Here ,
Nov 03, 2020 Nov 03, 2020

Hi ClayUUID,

Thanks for the attention, I appreciate it.  

I didn't find a "changeColor" property in CreateJS (EaselJS specifically).

I was, however, able to change the color using "shape.graphics._fill". I don't know what api this belongs to.

This confused me; was CreateJS my go-to for editing instances or some other unknown library?

 

I called a few EaselJS properties (x, y, scale) and they do their thing (me: happy surprise, you: no duh).

I still don't see how to set color in CreateJS, or change index, but I'll dig some more. If I can't figure them out I'll come back with clearer questions.

 

I will ask if anyone knows where this shape.graphics._fill comes from, but leave it at that.

Thanks again. I appreciate your insight and speed. 

Sean

 

Translate
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 ,
Nov 03, 2020 Nov 03, 2020

I just told you, Canvas uses CreateJS. That's it. It doesn't use anything else.

Translate
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
New Here ,
Nov 04, 2020 Nov 04, 2020

I'm trying to manipulate Canvas elements.

There are plenty of libraries designed for this purpose.  

 

Translate
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 ,
Nov 04, 2020 Nov 04, 2020

All of Animate's canvas elements are managed by CreateJS, so if you want to manipulate them, you use CreateJS, not some other library.

Translate
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
New Here ,
Nov 05, 2020 Nov 05, 2020
LATEST

Ok, thanks.

Translate
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