2014-04-03 119 views
0

我就遇到了这个问题,Flash将会返回我 1046:类型未找到或不是编译时常:mouseY的AS3的iOS滚动与影片剪辑

我试图滚动在一个影片剪辑单独的课程,我已放入一个容器 这是迄今为止不工作!

帮助将不胜感激!

PS我跟着这个教程http://forums.adobe.com/thread/892372

我的卷轴类:

package { 
import flash.events.MouseEvent; 
import flash.display.MovieClip; 
import flash.events.Event; 
import flash.geom.Point; 
import flash.ui.Mouse; 

public class Scrolling { 

    private var Touchscroll:Point = new Point; 
    private var completeTween:Boolean; 
    private var finalMouseY:int; 
    private var mc:MovieClip = IconSpawn.container; 
    private var currentY:mouseY = new mouseY; 

    public function Scrolling() { 
     // constructor code 
     mc.addEventListener(MouseEvent.MOUSE_DOWN,onDown1) 

    } 

    public function onDown1(evt:MouseEvent):void 
    { 
     completeTween = false; 
     //stage.addEventListener(MouseEvent.MOUSE_UP,onUp1); 

     MovieClip(evt.currentTarget).addEventListener(Event.ENTER_FRAME,tweenF); 
    } 

    public function tweenF(e:Event):void 
    { 
     //var mc:MovieClip = MovieClip(evt.currentTarget); 

     if(completeTween) 
     { 
      mc.y = .5*(mc.y + Math.min(800,finalMouseY)); 

      if(Math.abs(mc.y - Math.min(800, finalMouseY)) <1) 
      { 
       e.currentTarget.removeEventListener(Event.ENTER_FRAME,tweenF); 
      } 

     } 
     else 
     { 
      mc.y = .5*(mc.y + Math.min(800, mouseY)); 
     } 

    } 
    public function onUp1(evt:MouseEvent):void 
    { 
     completeTween = true; 
     finalMouseY = currentY; 
     stage.removeEventListener(MouseEvent.MOUSE_UP,onUP1); 
    } 

} 

}

编辑的代码:

package { 
import flash.events.MouseEvent; 
import flash.display.MovieClip; 
import flash.events.Event; 
import flash.geom.Point; 
import flash.ui.Mouse; 

public class Scrolling { 

private var Touchscroll:Point = new Point; 
private var completeTween:Boolean; 
private var startMouseY:int; 
private var finalMouseY:int; 
private var mc:MovieClip = IconSpawn.container; 
//private var CurrentY = mouseY 

public function Scrolling() { 
    // constructor code 
    mc.addEventListener(MouseEvent.MOUSE_DOWN,onDown1) 

} 

public function onDown1(evt:MouseEvent):void 
{ 
    startMouseY = mouseY; 
    completeTween = false; 
    stage.addEventListener(MouseEvent.MOUSE_UP,onUp1); 

    MovieClip(evt.currentTarget).addEventListener(Event.ENTER_FRAME,tweenF); 
} 

public function tweenF(e:Event):void 
{ 
    //var mc:MovieClip = MovieClip(evt.currentTarget); 

    if(completeTween) 
    { 
     mc.y = .5*(mc.y + Math.min(800,finalMouseY)); 

     if(Math.abs(mc.y - Math.min(800, finalMouseY)) <1) 
     { 
      e.currentTarget.removeEventListener(Event.ENTER_FRAME,tweenF); 
     } 

    } 
    else 
    { 
     mc.y = .5*(mc.y + Math.min(800, mouseY - startMouseY)); 
    } 

} 
public function onUp1(evt:MouseEvent):void 
{ 
    completeTween = true; 
    finalMouseY = mouseY - startMouseY; 
    stage.removeEventListener(MouseEvent.MOUSE_UP,onUP1); 
} 

} 
} 

回答

0

在你的第15行:private var currentY:mouseY = new mouseY;你已经采取了显示对象的公共属性并试图将其转换为i nto类。不要这样做!

只需将CurrentY声明为实例变量即可。在您的构造函数中或更高版本中,设置CurrentY = mouseY

+0

现在Flash只产生的ReferenceError:错误#1065:变量mouseY的不以滚动/ onUp1()和onDown1() 这里是我更新的代码 – josh

+0

我得到未定义的属性mouseY的,舞台和onUP1的访问定义。 在线25,27,48,55,56,56 – josh

+0

那么,看看你的代码:你有stage.addEventListener(MouseEvent.MOUSE_UP,onUp1);然后你有stage.removeEventListener(MouseEvent.MOUSE_UP,onUP1);你必须自己做一些这项工作,乔希! mouseY应该没有问题。请再检查一次。 – Craig