ReferenceError: Error #1069: 在 flash.display.SimpleButton 上找不到属性 startDrag,且没有默认...

使用ActionScript 3.0编程时,刚开始不知道如何把库中的影片剪辑通过类的方式来处理。今天我自己做了一个文本框。

发了一个问题:

//鼠标停下
  public function pickup(event:MouseEvent):void {
   startingLocation=new Point();
   trace(event.target.name);
   if (event.target.name=="sw") {
    startingLocation.x=event.target.x;
    startingLocation.y=event.target.y;

    //trace("startingLocation.x"+startingLocation.x);
    //trace("button.x"+btndisagree.x);
    //开始拖动,给被拖动对象加上阴影
    event.target.startDrag();
    event.target.filters=[new DropShadowFilter()];
    setChildIndex(DisplayObject(event.target),numChildren-1);
   }//把被拖动的对象显示在最前面
   //
  }
  //鼠标移动
  public function place(event:MouseEvent):void {
   if (event.target.name=="sw") {
    event.target.stopDrag();
    event.target.filters=null;
    event.target.x=event.target.x;
    event.target.y=event.target.y;

    //按钮坐标跟随图片移动
    //btndisagree.x= event.target.x+360;
    //btndisagree.y= event.target.y+506;
   }
  }

我之所以使用红色表示,是因为不做判断会出现:

ReferenceError: Error #1069: 在 flash.display.SimpleButton 上找不到属性 startDrag,且没有默认

错误。当我们使用SimpleButton的时候,它可能确实没有startDrag属性,将其转为影片剪辑。。这是我最初的idea

后来发现时没有用的,因为设为影片剪辑后就会一直闪烁。

相信遇到这个问题的人大概是移动一个通过鼠标移动影片剪辑吧。

目前我的做法就是获得name,再你拖动对象的时候可能这个对象中存在多个按钮,文本提示等等。我们只需要sw.button或者sw.label就可获得了。当然sw就是拖到舞台中央的影片剪辑的实例化名字。

思路-->

   提示框移动  -->提示框中有很多按钮或者文本

                                                                 ---->但是移动中按下踢实况中SimpleButton事件 又不能触发提示框移动事件

                                                                           -->判断是否是移动框方才移动,否则不触发此事件。也就不会有starDrag的问题了

                                                                           

 

                                                                                             

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值