Any Component functionality

Hi all,

I’m trying to understand how Any Component works. I’m trying to make a slider that moves a sprite along the X axis.

I tried this code which gets an error that a String is given when a Sprite??? is expected or something like that. The disconnected code below works but I don’t want to have to list that for every sprite in the list. What am I missing? I though Any Component was supposed to work to avoid a lot of excess code. Is there a way to use it in a way that says do this action for whichever sprite is visible or enabled? Thanks!


The Any component blocks are for when you really need to have multiple components in play at the same time.
If you can reuse the same component with different images or visibility values at different times, that works well.

If you need to distinguish one Sprite from among a bunch of other Sprites, save its component block ina global variable and use the global variable with the Any blocks.

Here are some sample projects to examine ...!msg/mitappinventortest/ck_CIVWObhw/vUr6nBcDAwAJ


I think you rissue is probably your “global trashList”. The thing is that the /name/ of a sprite is different than the sprite itself.

Initializing your trashList like this should work:
Where the “ImageSprite[X]” blocks are the blocks for your image sprites. They live at the bottom of the component’s flyout.
Screenshot from 2020-05-11 09-23-45

I hope that helps!