How to create Custom shaped Buttons?

You must Login before you can answer or comment on any questions.

How to create custom shaped button, instead of normal rectangle button. I just want to create a button like start shape. Important thing is it should not fire event when we press out of the start border with in that frame.

It Should fire when user tap on the start shape only. Please check this image

![alt "Custom Shaped Button in Titanium"](http://content.screencast.com/users/wp7developer/folders/Default/media/95e0f4ad-3c83-4224-8e77-3d32dfe2128f/custom-button.png "Custom Shaped Button in Titanium")

— asked 12 months ago by Naga Harish Movva
1 Comment
  • Sorry here is the image http://content.screencast.com/users/wp7developer/folders/Default/media/95e0f4ad-3c83-4224-8e77-3d32dfe2128f/custom-button.png

    — commented 12 months ago by Naga Harish Movva

1 Answer

You can use an ImageView for this; add an event listener for the 'click' event, then use the x, y coordinates of the click event to determine whether the user clicked inside the star shape.

var iv = Ti.UI.createImageView ({ ... });
 
iv.addEventListener ('click', function (e) {
    Ti.API.debug ("x,y: " + e.x + ", " + e.y);
});

— answered 12 months ago by Jason Priebe
answer permalink
1 Comment
  • This is Nice Idea... But, I don't think it work... we need to write more conditions to check users tap... I created rhombus using animation and degree -45 something like that...

    — commented 12 months ago by Naga Harish Movva

Your Answer

Think you can help? Login to answer this question!