将onSeekPoint怪事 [英] onSeekPoint weirdness
问题描述
我有投入数据生成模式的NetStream正确的......一切工作正常,我也得到将onSeekPoint()事件时,我像做了以下内容:
I have a NetStream which is put into data generation mode properly... everything works fine and I get onSeekPoint() events when I do something like the following:
示例1
public function setupStream() {
netStream.client = {};
netStream.client.onSeekPoint = this.onSeekPoint;
netStream.client.onMetaData = this.onMetaData;
}
public function onSeekPoint(... args) {...}
public function onMetaData(... args) {...}
然而,而是让这一切在父类,我需要创建一个新的类,它也有将onSeekPoint客户端。它不工作。奇怪的是,调用onMetaData回调做......这件事情是这样的:
However, instead of keeping it all in that parent class, I need to create a new class for the client which also has that onSeekPoint. It doesn't work. Strangely, the onMetaData callback does... it's something like this:
例2
package {
public class CustomClient {
public function CustomClient() {
}
public function onSeekPoint(... args) {...}
public function onMetaData(... args) {...}
}
}
public function setupStream() {
var myClient:CustomClient = new CustomClient();
netStream.client = CustomClient;
}
我想,也许有一些小问题,我missed-但真正吓到我了,是这完全正常工作......
I thought that maybe there's some small issue I missed- but what's really freaking me out, is that this fully works properly...
示例3
package {
public class CustomClient {
public function CustomClient() {
}
public function onSeekPoint(... args) {...}
public function onMetaData(... args) {...}
}
}
public function setupStream() {
var myClient:CustomClient = new CustomClient();
netStream.client = {};
netStream.client.onSeekPoint = myClient.onSeekPoint;
netStream.client.onMetaData = myClient.onMetaData
}
我猜,如果它不破不解决它可能适用于这里,但是我有点担心,让一些code我不明白去了,还怕它可能回来咬我,当我最不经意的时候;)
I guess "if it ain't broke don't fix it" might apply here, but I'm a little worried letting some code I don't understand go, and afraid it might come back to bite me when I least expect it ;)
我的问题是:
- 为什么不为seekPoints第二个例子中的工作?
- 确定,则─为什么的确实的元数据第二个例子中的工作?
- 为什么第三个例子解决一切?
- Why doesn't the second example work for seekPoints?
- Ok then- why does the second example work for metaData?
- Why does the third example fix everything?
修改:如果现在还不清楚,不同类是正确的在不同的文件,等他们只是合并在这里的例子,使其更容易消化
EDIT: In case it's unclear, the different classes are correctly in separate files, etc. They're just combined in the examples here to make it easier to digest
推荐答案
在第二个例子中,你有这样的:
In your second example you have this:
var myClient:CustomClient = new CustomClient();
netStream.client = CustomClient;
但它不应该是这样的:
But shouldn't it be something like this:
var myClient:CustomClient = new CustomClient();
netStream.client = myClient;
这篇关于将onSeekPoint怪事的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!