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
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.
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;
}
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;
}
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!
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.
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
Copy link to clipboard
Copied
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();
}