Sprites and Symbols

Is it possible to set the backgroundImage properties of X and Y using code? I can see the value using getElement(“startBT”).BgY but cannot find a function in the help manual.

Had a play with symbols and can create these, but when I add an event handler in edit symbol mode it’s not there when I use the symbol?

Cheers

Hi,

The help manual only describes public functions which we tries to keep supporting when upgrading Saola Animate. There’s other functions you can use but they’re not ensured to work in later versions.

In version 2, most of element properties can be set using the following method:

theElement.setProperty(propertyName, propertyValue)

The background image position x, y property names are 'backgroundPositionX', 'backgroundPositionY' respectively. For example, to set background image position X of the image element image1 to 150px:

doc.getElement('image1').setProperty('backgroundPositionX', 150);

Regarding symbols, I’m not sure what do you mean. Can you please describe your issue in more details.

Regards

Thanks for the clarification.

The events problem as an example could be that I need a next scene button that will be used on various scenes. I create the design of button, add the event and then create the symbol.

The problem is that the symbol doesn’t have the event any more.

Maybe you confused symbols with symbol instances (a.k.a. symbol elements). Events added for elements inside a symbol will not appear in the Event Handlers window of the symbol element, but they still works when previewing or running output in the browser. To update those events, you must double-click the symbol element to enter symbol editing mode.

Yes confused. It works as expected. Thank you.