Custom mask for Switch Overlay

(default mask)

I want to create my custom mask for the Switch Widget (that On-Off thingy). I am trying to create a square switch, rather than the default rounded edges. Yeah, I know how to create a mask, but where should I put the mask file and how can I apply it? I am using Texture Packer to create my spritesheet.

Pardon me for my poor english. Thanks in advance!

I don’t think the mask can go in the sprite sheet, if that is what you are essentially asking. Unless you want to put the mask file in a subdirectory (I don’t) then you would just putti in the same directory as your main.lua… The root directory. File IO: http://www.coronalabs.com/blog/2012/02/14/reading-and-writing-files-in-corona/Nothing wrong with your English.

Thanks for the response. Hmm so how can I use the mask file? Does the Corona automatically use it whenever she found the default filename? Which is “widget_theme_onOff_mask.png”, etc.

Have you seen this? http://docs.coronalabs.com/daily/api/library/widget/newSwitch.html

I haven’t used the switch control yet, so I’m not the best person to talk about it. But it looks like you would simply need to specify the spritesheet with the images that you need.

I don’t think you really want a mask… I think you want to tailor the whole set of images for your switch. Remember: A mask is used to hide certain parts of the display object - you’re not trying to do that; You’re trying to change the look of the switch as a whole.

If you do want to mask your switch, you could always put it into a display group and apply the mask to the group. I suppose you could even apply a mask to the switch object itself, as it will be a display object like any other.

I don’t think the mask can go in the sprite sheet, if that is what you are essentially asking. Unless you want to put the mask file in a subdirectory (I don’t) then you would just putti in the same directory as your main.lua… The root directory. File IO: http://www.coronalabs.com/blog/2012/02/14/reading-and-writing-files-in-corona/Nothing wrong with your English.

Thanks for the response. Hmm so how can I use the mask file? Does the Corona automatically use it whenever she found the default filename? Which is “widget_theme_onOff_mask.png”, etc.

Have you seen this? http://docs.coronalabs.com/daily/api/library/widget/newSwitch.html

I haven’t used the switch control yet, so I’m not the best person to talk about it. But it looks like you would simply need to specify the spritesheet with the images that you need.

I don’t think you really want a mask… I think you want to tailor the whole set of images for your switch. Remember: A mask is used to hide certain parts of the display object - you’re not trying to do that; You’re trying to change the look of the switch as a whole.

If you do want to mask your switch, you could always put it into a display group and apply the mask to the group. I suppose you could even apply a mask to the switch object itself, as it will be a display object like any other.