Change ui.newButton image defaultSrc

Hey guys,

I’m trying to set up a button system where I can update the image path (defaultSrc) of an ui.newButton on events.

Can anyone point me in the right direction of how to change the defaultSrc of this image file after it has been inserted into the group?

Thanks,

// red. [import]uid: 7143 topic_id: 2799 reply_id: 302799[/import]

Hi red,

not possible by default. When you analyse the UI module, you will see that it uses display objects. And the image of a display object can’t be changed. So you need to modify the UI module, so you can remove the old object and insert a new own. Should not be to diffcult.

Cheers
Michael [import]uid: 5712 topic_id: 2799 reply_id: 8376[/import]

Ahh ok then, thanks for the response. What is the best way to set up an image that you might want to change on the fly then?

// red. [import]uid: 7143 topic_id: 2799 reply_id: 8471[/import]

Look into the movieclip (former sprite) module. Or the UI module, it usages the same technic.
Basically a movieclip is a group with several images added to it. The one you need is visible. When you need a different one, that previous image will be made invisible and the one needed visible. [import]uid: 5712 topic_id: 2799 reply_id: 8480[/import]