Skip to main content
nicolekopp
Participating Frequently
August 7, 2023
Question

Mouseover for mobil devices?

  • August 7, 2023
  • 1 reply
  • 613 views

Hello,
I have created HTML5 file where on mouseover a window opens and on mouse exit the window closes. Is there any way to implement this feature for mobile devices as well? So that you go with your finger on the button and the same happens? Without clicking?

LG

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 7, 2023

that's not user friendly for mobiles.  it would be better to use a mousedown toggle.

nicolekopp
Participating Frequently
August 7, 2023

ok, thank you. Do you have an example how i change the button?

currently it is like this:


var _this = this;
var frameNumber;
/*
Durch Bewegen der Maus über die angegebene Symbolinstanz wird eine Funktion ausgeführt.
'3' gibt an, wie oft das Ereignis ausgelöst werden soll.
*/
/*stage.enableMouseOver(3);
_this.info_1.on('mouseover', function(){
/*
Verschiebt den Abspielkopf in der Zeitleiste zur angegebenen Bildnummer und setzt die Wiedergabe ab diesem Bild fort.
Kann in der Hauptzeitleiste oder in Movieclip-Zeitleisten verwendet werden.

_this.gotoAndPlay(411);
});*/

/* Mouse Over Event
Mousing over the symbol instance executes a function in which you can add your own custom code.

Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
The code will execute when the symbol instance is moused over.
frequency is the number of the times event should be triggered.
*/
var frequency = 1;
stage.enableMouseOver(frequency);
this.info_1.addEventListener("mouseover", fl_MouseOverHandler);

function fl_MouseOverHandler()
{
frameNumber = this.currentFrame;
// Start your custom code
// This example code displays the words "Moused over" in the Output panel.
_this.gotoAndPlay(411);
// End your custom code
}


/* Mouse Out Event
Mousing out of the symbol instance executes a function in which you can add your own custom code.

Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
The code will execute when the symbol instance is moused out of.
*/
//var frequency = 2;
stage.enableMouseOver(2);
this.info_1.addEventListener("mouseout", fl_MouseOutHandler);

function fl_MouseOutHandler()
{
if (frameNumber > 159)
{
_this.gotoAndPlay(275);
}
else{
_this.gotoAndPlay(159);
}
// Start your custom code
// This example code displays the words "Moused out" in the Output panel.
//_this.gotoAndPlay(frameNumber);
// End your custom code
}

 

 

kglad
Community Expert
Community Expert
August 8, 2023

this.info_1.addEventListener("mousedown", info_1F.bind(this));

 

function info_1F(){

if(!this.info_1.showwhatever){

// open window

} else {

// close window

}

this.info_1.showwhatever = !this.info_1.showwhatever;

}