canvas_addHitRegion question
Posted: 21 Oct 2014 18:29
I try to understand how canvas_addHitRegion(c, path, id) works. In the attachment I have two examples of this command. One is working, but it has no path. The other one is not working (red script) and has a path.
- what is the name of the path if one is present (other than the default path)?
- what is the identifier?
In the Hexapads example the path is set to 0, but the identifier to a mathematical expression. Can somebody shed some light on this matter? I'm completely in the dark.
What I want is very simple: a custom button with transparent corners. What I can do is to use the brown canvas as background and put the transparent canvas on top of it, problem solved. But I prefer to understand how the hit region works, and integrate it into one Canvas object.
Edit: alright, I found (rather by accident) a solution. When I put the HitRegion-line (still with 0 for path and id) into the 'draw' script I can do things inside the 'touch' script. It works. In the Hexapads template the id is declared (decl ...) before the HitRegion-line. Maybe one has to declare the identifier for a HitRegion? Yeah I admit I haven't quite understood how it works, but at least I've made a little step further with that problem solved.
Edit2: oh no, in the "touch"-script I was referencing "c" which was not declared (in that script). Of course the script will be in red. Silly mistake, sorry about that. Although obsolete now I don't delete this thread because there might be someone who can give me more insight into the nature of using the hit region, or I may add some tips later when I found them out.
- what is the name of the path if one is present (other than the default path)?
- what is the identifier?
In the Hexapads example the path is set to 0, but the identifier to a mathematical expression. Can somebody shed some light on this matter? I'm completely in the dark.
What I want is very simple: a custom button with transparent corners. What I can do is to use the brown canvas as background and put the transparent canvas on top of it, problem solved. But I prefer to understand how the hit region works, and integrate it into one Canvas object.
Edit: alright, I found (rather by accident) a solution. When I put the HitRegion-line (still with 0 for path and id) into the 'draw' script I can do things inside the 'touch' script. It works. In the Hexapads template the id is declared (decl ...) before the HitRegion-line. Maybe one has to declare the identifier for a HitRegion? Yeah I admit I haven't quite understood how it works, but at least I've made a little step further with that problem solved.
Edit2: oh no, in the "touch"-script I was referencing "c" which was not declared (in that script). Of course the script will be in red. Silly mistake, sorry about that. Although obsolete now I don't delete this thread because there might be someone who can give me more insight into the nature of using the hit region, or I may add some tips later when I found them out.