1、错误描述
此行的多个标记: -1118: 属于 static 类型 Object 的值的隐式强制指令的目标可能是非相关类型 Number。 -left
2、错误原因
/** * 刷新按钮函数 */ protected function refresh_clickHandler(event:MouseEvent):void { var hx:Number = hsb.left; var hy:Number = hsb.y; //var dx:Number = dataGrid.contentMouseX; //var dy:Number = dataGrid.contentMouseY; //Alert.show("hx:"+hx+"\n"+"hy: "+hy + "\n" + "dx: " + dx + "\n" + "dy: " + dy); Alert.show("hx:"+hx+"\n"+"hy: "+hy); }
<s:HScrollBar id="hsb" width="100%" viewport="{dataGrid}"/>
将hx由数字类型转换成Object
3、解决办法
/** * 刷新按钮函数 */ protected function refresh_clickHandler(event:MouseEvent):void { var hx:Object = hsb.left; var hy:Number = hsb.y; //var dx:Number = dataGrid.contentMouseX; //var dy:Number = dataGrid.contentMouseY; //Alert.show("hx:"+hx+"\n"+"hy: "+hy + "\n" + "dx: " + dx + "\n" + "dy: " + dy); Alert.show("hx:"+hx+"\n"+"hy: "+hy); }