I’ve made some apps for touch screen systems and I’ve never have any problem, then I’ll try to help but exist the case I’m complete wrong!!!
First, if you want to fire a mouseDown or any other Director handler in a behavior attached to a sprite just call it like any other user defined handler. For example you have a sprite on channel 1 with the on mouseDown handler and you want to fire that without any mouse click or other mouse method, just put on the message window or on a timeout object or any where you like this: sprite(1).mouseDown()
Ok it was simple but for flash sprites it couldn’t be so different just write the function on Flash and then call it, example: if sprite 1 is a flash asset with a function defined on Flash’s IDE named doSomeThing() then write on Director: sprite(1).doSomeThing()
Ok we keep it on simple, just go on: if you want fire some fixed flash event like “click”, “change” or any other Flash fixed event (like Flash components events) just attach to the Director´s Flash sprite a behavior with the flash function translated to director handler and activate that event on the property inspector like this:
put “a click happened”
put “some change”
You can call it even with no occurrence of that event, fire it wherever you want: sprite(1).click() or sprite(1).change()
If I remember well there was a problem with the Flash 8 assets events, simply doesn’t work but on recent Director’s updates it was fixed (I think). Just in case I put the code needed with that issue:
on beginSprite me
pFlashButton = sprite(me.spriteNum)
vFlashButtonEvent = pFlashButton .newObject("Object")
pFlashButton .setCallback(vFlashButtonEvent, "click", 0, 0)
on beginSprite me
pFlashDataGrid = sprite(me.spriteNum)
vFlashDataGridEvent = pFlashDataGrid.newObject("Object")
pFlashDataGrid.setCallback(vFlashDataGridEvent , "change", 0, 0)
This will detect those events and call your own on click or on change handlers on the same behavior
Then the last thing, how to know which sprite function fire with the touch of the screen if no mouse enter occurred first? Well you can use the_mouse.clickOn on a movie script mouseDown event or in the mouseDownScript to know which sprite was clicked and then call the sprite functions or handlers, just remember that the _mouse.clickOn property works only with active sprites (sprites with scripts attached on. You can attach a dummy behavior to do nothing in case no behavior present on the sprite)
There’re more solutions but they are more complex and could impact your application’s code design.
Really I hope this can help.
Have a nice coding!!!
Hi, i was interested in your comments. I've made a mouse controlled flipbook in inDesign and I'd like to make it a touchscreen book so the page turns, narration and video content can be activated by touch. Is it possible? It should be easy to bring the inDesign into Flash pro.
Had exactly the same issue a few years ago! Seems certain touch screens with certain settings have this issue (It didn't seem to happen with every touch screen!). From what i can gather it is as if the mouse focus is torn between the director file and the embedded flash file. So the first click is setting the focus to the flash file, the second is then working!
Anyway I'll save you the months of searching with this workaround that works for me!
Make sure the scrips below are moviescripts.
the mouseDownScript = "fixFlash" --Flash button focus fix
Hope this help you!