|
Post by brucewilli1 on May 5, 2016 10:34:46 GMT
Hallo to all, creating my memory project i cant solve a problem.
How can i detect the mousclick on an object at the stage.
The script: var K1a = document.getElementById("Karte1a"); // Karte1a is the object on the stage K1a.addEventListener("click", doSomething, false); function doSomething(e) { alert("Na endlich"); }
occurs an error - unknown scriptfunction
I need a little help .... or a nice tutorial ... i added the hippani-file "Memory006" before, please take a look
thanks
|
|
|
Post by leorod on May 6, 2016 12:22:58 GMT
Hi. We can not use the DOM functions to access objects created in Animator. We need to use Animator own properties and functions. Animator is, among other things, a RAD (Rapid Application Development). To script a click you just have to put your code in the "On Click" property of the target object. Look at the documentation: www.hippani.com/?S=AnimatorHelpThere is a lot of information and tutorials. You can also download smaples from the Showcase: www.hippani.com/?S=AnimatorGallery
|
|
|
Post by leorod on May 6, 2016 13:43:10 GMT
Ok, I took a look at your "Memory006" file. The card objects in your game are made as "Drawings". Drawing objects doesn't have the "On Click" property, it means, they don't catch mouse clicks You have several options: converting the Drawings in the Stage to Buttons or using "Hot Spots" over the Drawings. A third option is using Timelines and inside the Timeline placing the Drawing and a Hot Spot. In case you like buttons you have to do the folowwing. First you have to convert each Drawing to a Image. In the Library right click a Drawing (or click the ellipsis) and choose "Convert to Image" from the dropdown menĂº. Then you have to create a Button, select "Fill Type" as Image and then choose the corresponding Image. Finally you have to replace all Drawing objects in the Stage for the new created Buttons and set their Script IDs. Also, for each button you have to write its On Click property.
PS for Hippani It would be nice if we could use Drawings as Fill Type and Icon Type in Buttons.
|
|
|
Post by brucewilli1 on May 7, 2016 14:04:13 GMT
Thanks a lot. I will try.
|
|