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

Activate and deactivate GESTURE

Explorer ,
Nov 30, 2022 Nov 30, 2022

Copy link to clipboard

Copied

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

Views

521

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

its visible using this:

hide_1.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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;

}

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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!




Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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();
}

Votes

Translate

Translate

Report

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