Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Activate and deactivate GESTURE

Explorer ,
Nov 30, 2022 Nov 30, 2022

I have to symbols on the stage.  I want the each symbol to move only when visible.

 

is this possible in action script.

 

.fla example here:

https://we.tl/t-n4JGyEkV5q

 

thanks!

o

 

 

TOPICS
ActionScript , Code , How to
619
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2022 Nov 30, 2022

probably but how difficult that is depends on what causes a symbol to be visible.

 

it would be easiest if a symbol were made visible/not visible using actionscript.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2022 Dec 01, 2022

its visible using this:

hide_1.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void
{
strip1.visible = false;
strip2.visible = true;
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2022 Dec 01, 2022

you can use the interactive object mouseEnabled property:

 

hide_1.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void
{
strip1.visible = false;
strip2.visible = true;

stripF();
}

function stripF():void{

strip1.mouseEnabled=strip1.visible;

strip2.mouseEnabled=strip2.visible;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2022 Dec 01, 2022

i replaced the hide show button with this code but the swipe keeps affecting both symbols.

 

here is teh complete code i used originally, and a link for the .fla file

// buttons:

hide_1.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void
{
strip1.visible = false;
strip2.visible = true;
}


hide_2.addEventListener(MouseEvent.CLICK, fl_ClickToHide_2);

function fl_ClickToHide_2(event:MouseEvent):void
{
strip1.visible = true;
strip2.visible = false;
}


all.addEventListener(MouseEvent.CLICK, fl_ClickToHide_3);

function fl_ClickToHide_3(event:MouseEvent):void
{
strip1.visible = true;
strip2.visible = true;
}

 


// slide 1

Multitouch.inputMode = MultitouchInputMode.GESTURE;

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);

function fl_SwipeHandler(event:TransformGestureEvent):void
{
switch(event.offsetX)
{

case 1:
{

strip1.x += 90;

break;
}

case -1:
{

strip1.x -= 90;

break;
}
}


}

// slide 2

Multitouch.inputMode = MultitouchInputMode.GESTURE;

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler_2);

function fl_SwipeHandler_2(event:TransformGestureEvent):void
{
switch(event.offsetX)
{

case 1:
{

strip2.x += 90;

break;
}

case -1:
{

strip2.x -= 90;

break;
}
}

}

 

FILE: https://we.tl/t-n4JGyEkV5q

thanks!




Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2022 Dec 01, 2022

1. i don't see where you tried to use the code i suggested.

2. you'll need to hire me to fix your fla.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2022 Dec 01, 2022

hi, here is where i tryed to use the code:


// buttons:

hide_1.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void
{
strip1.visible = false;
strip2.visible = true;

stripF();
}

function stripF():void

{

strip1.mouseEnabled=strip1.visible;

strip2.mouseEnabled=strip2.visible;

}


//

hide_2.addEventListener(MouseEvent.CLICK, fl_ClickToHide_2);

function fl_ClickToHide_2(event:MouseEvent):void
{
strip1.visible = true;
strip2.visible = false;
}

 


all.addEventListener(MouseEvent.CLICK, fl_ClickToHide_3);

function fl_ClickToHide_3(event:MouseEvent):void
{
strip1.visible = true;
strip2.visible = true;
}

 

// slide

Multitouch.inputMode = MultitouchInputMode.GESTURE;

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler);

function fl_SwipeHandler(event:TransformGestureEvent):void
{
switch(event.offsetX)
{

case 1:
{

strip1.x += 90;

break;
}

case -1:
{

strip1.x -= 90;

break;
}
}


}

// slide 2

Multitouch.inputMode = MultitouchInputMode.GESTURE;

stage.addEventListener (TransformGestureEvent.GESTURE_SWIPE, fl_SwipeHandler_2);

function fl_SwipeHandler_2(event:TransformGestureEvent):void
{
switch(event.offsetX)
{

case 1:
{

strip2.x += 90;

break;
}

case -1:
{

strip2.x -= 90;

break;
}
}

}

 

thanks
o

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2022 Dec 01, 2022
LATEST

add it to your other buttons:

 

// buttons:

hide_1.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void
{
strip1.visible = false;
strip2.visible = true;

stripF();
}

function stripF():void

{

strip1.mouseEnabled=strip1.visible;

strip2.mouseEnabled=strip2.visible;

}


//

hide_2.addEventListener(MouseEvent.CLICK, fl_ClickToHide_2);

function fl_ClickToHide_2(event:MouseEvent):void
{
strip1.visible = true;
strip2.visible = false;

stripF();
}

 


all.addEventListener(MouseEvent.CLICK, fl_ClickToHide_3);

function fl_ClickToHide_3(event:MouseEvent):void
{
strip1.visible = true;
strip2.visible = true;

stripF();
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines