Skip to main content
Participant
August 10, 2023
Question

I'm new to as3, I work on v20

  • August 10, 2023
  • 2 replies
  • 93 views
var posX:int = 0.0
var posW:int = 2223.2
var escenarioW:int = 800
var avance:int = 10
var direccion:int = 0
var posicion1:Point = new Point(0,0);
var posicion2:Point = new Point(0,0);
var distancia:Number = Point.distance(posicion1, posicion2); 
 
der.addEventListener(MouseEvent.MOUSE_OVER, fnDerecha)
izq.addEventListener(MouseEvent.MOUSE_OVER, fnIzquierda)
 
der.addEventListener(MouseEvent.MOUSE_OUT, fnCero)
izq.addEventListener(MouseEvent.MOUSE_OUT, fnCero)
 
function fnCero(e:MouseEvent):void{
 
direccion = 0
}
 
 
function fnDerecha(e:MouseEvent):void{
 
direccion = 1
 
 
}
function fnIzquierda(e:MouseEvent):void{
 
direccion = 2
 
}
 
stage.addEventListener(Event.ENTER_FRAME, fnFrecuente)
function fnFrecuente(e:Event):void{
 
if(direccion==1){
panorama.x+=10
panorama.x=distancia
//trace(stage.mouseX);
trace(distancia);
 
}else if (direccion==2){
panorama.x-=avance
}
 
}
 
Hi, I'm working on this code. I'm very new. Can someone help me? I need a code for vertical scrolling.
 
 
    This topic has been closed for replies.

    2 replies

    kglad
    Community Expert
    Community Expert
    August 11, 2023

    that code is for horizontal scrolling.  are you trying to adapt it to vertical scrolling?

    Community Expert
    August 11, 2023

    @kglad what do you think?