Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Actionscript 3.0将从url加载的图像旋转90度_Actionscript 3_Image_Rotation_Degrees - Fatal编程技术网

Actionscript 3 Actionscript 3.0将从url加载的图像旋转90度

Actionscript 3 Actionscript 3.0将从url加载的图像旋转90度,actionscript-3,image,rotation,degrees,Actionscript 3,Image,Rotation,Degrees,我收到一个错误,说“试图通过静态类型flash.display:Sprite.ssd.rotation(90)}的引用访问不可访问的方法旋转” 我只是想知道当我双击图像时如何将其旋转90度 var shootingstar:Loader = new Loader(); shootingstar.load(new URLRequest("http://i51.tinypic.com/m8jp7m.png")); shootingstar.contentLoaderInfo.addEventList

我收到一个错误,说“试图通过静态类型flash.display:Sprite.ssd.rotation(90)}的引用访问不可访问的方法旋转” 我只是想知道当我双击图像时如何将其旋转90度

var shootingstar:Loader = new Loader();
shootingstar.load(new URLRequest("http://i51.tinypic.com/m8jp7m.png"));
shootingstar.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadingComplete);
var ssd:Sprite = new Sprite();
 function onLoadingComplete(event:Event):void
 {
    ssd.addChild( event.currentTarget.loader.content );
    ssd.addEventListener(MouseEvent.MOUSE_DOWN, drag);
    ssd.addEventListener(MouseEvent.MOUSE_UP, drop);
    ssd.addEventListener(MouseEvent.DOUBLE_CLICK, rotate)
 ssd.height=180
 ssd.width=124
 }
 function drag(event:MouseEvent):void{
     ssd.startDrag()
  }
 function drop(event:MouseEvent):void{
  ssd.stopDrag()
 }
 function rotate():void{
     ssd.rotation(90)
 }

您是否尝试过
ssd.rotation=90

您是否尝试过ssd.rotation=90

错误表明旋转方法不可访问,即私有或受保护。因此,您不能像在代码循环(90)中那样直接调用它

相反,您应该使用旋转公共属性

    rotation = 90;
正如SuperPro指出的,您还应该从rotate方法中获得一个错误,该方法需要一个MouseeEvent参数。实际上

function rotate(event:MouseEvent):void
{
   ssd.rotation = 90;
}
最后,确保精灵的doubleClickEnabled属性设置为true

function onLoadingComplete(event:Event):void
{
   ssd.doubleClickEnabled = true;
   etc....

错误表明旋转方法不可访问,即私有或受保护。因此,您不能像在代码循环(90)中那样直接调用它

相反,您应该使用旋转公共属性

    rotation = 90;
正如SuperPro指出的,您还应该从rotate方法中获得一个错误,该方法需要一个MouseeEvent参数。实际上

function rotate(event:MouseEvent):void
{
   ssd.rotation = 90;
}
最后,确保精灵的doubleClickEnabled属性设置为true

function onLoadingComplete(event:Event):void
{
   ssd.doubleClickEnabled = true;
   etc....

是的,但没用。我在某个地方看到一篇文章,他们使用了括号SD.rotation=90应该是正确的。检查doc您的rotate()函数应定义为rotate(event:MouseEvent):void与其他鼠标事件处理程序一样,在函数中添加跟踪(“test”),并查看双击时是否看到输出。也许你的函数根本没有被调用?是的,但它不起作用。我在某个地方看到一篇文章,他们使用了括号SD.rotation=90应该是正确的。检查doc您的rotate()函数应定义为rotate(event:MouseEvent):void与其他鼠标事件处理程序一样,在函数中添加跟踪(“test”),并查看双击时是否看到输出。可能根本没有调用您的函数?sd.doubleClickEnabled=true;我需要双击enabledsd.doubleClickEnabled=true;我需要启用双击