Sie sind nicht angemeldet.

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

1

Dienstag, 11. Oktober 2016, 06:34

Setting hotspot attribute creates the object???

Quellcode

1
2
3
trace("1: startX = ",get(hotspot[startX]));  => null
set(hotspot[startX].visible, true);
trace("2: startX = ",get(hotspot[startX])); => [object][object]

Apparently if you try to set an attribute of a non-existent object (hotspot), rather than failing the hotspot gets created with default values. I understand that you can create a simple variable (which is an object) by setting its value without declaring the variable first. But is this really intended behavior for hotspots etc?

2

Dienstag, 11. Oktober 2016, 10:58

Hi,

yes, this is intended and correct.

The 'plugin' and 'hotspot' arrays are predefined have an predefined 'type/class' for new elements.

But for creating the display object itself, it's necessary to call also addplugin/addhotspot.

Best regards,
Klaus

Scott Witte

Fortgeschrittener

  • »Scott Witte« ist der Autor dieses Themas

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

3

Dienstag, 11. Oktober 2016, 16:36

OK. It seems the workaround (for my purposes) is to first test if the hotspot/plugin exists before defining an attribute if I don't want to "accidentally" create the object.

Thanks