我有一个相机动作回调函数,在aframe中实现。但回调永远不会被调用。我正在注册这样的组件:
Function Increasing_Legend_Sort(mychart As Chart)
Dim Arr()
ReDim Arr(1 To mychart.FullSeriesCollection.Count)
'Assigning Series names to an array
For i = LBound(Arr) To UBound(Arr)
Arr(i) = mychart.FullSeriesCollection(i).Name
Next i
'Bubble-Sort (Sort the array in increasing order)
For r1 = LBound(Arr) To UBound(Arr)
rval = Arr(r1)
For r2 = LBound(Arr) To UBound(Arr)
If Arr(r2) > rval Then 'Change ">" to "<" to make it decreasing
Arr(r1) = Arr(r2)
Arr(r2) = rval
rval = Arr(r1)
End If
Next r2
Next r1
'Defining the PlotOrder
For i = LBound(Arr) To UBound(Arr)
mychart.FullSeriesCollection(Arr(i)).PlotOrder = i
Next i
End Function
,场景如下:
window.onload = function () {
AFRAME.registerComponent('listener', {
tick: function () {
console.log("TICK IS CALLED");
}
});
addMaze();
};
移动鼠标时,永远不会调用回调。如何确保正确调用它?
答案 0 :(得分:1)
在发生任何事情之前,应该注册该组件。
<head>
<script>
AFRAME.registerComponent('listener', {...});
</script>
</head>
<body>
<a-scene>
<!-- ... -->
</a-scene>
</body>