Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.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 YouTube ActionScript 3.0 API从onStateChange获取状态_Actionscript 3_Flash_Actionscript_Youtube Api - Fatal编程技术网

Actionscript 3 YouTube ActionScript 3.0 API从onStateChange获取状态

Actionscript 3 YouTube ActionScript 3.0 API从onStateChange获取状态,actionscript-3,flash,actionscript,youtube-api,Actionscript 3,Flash,Actionscript,Youtube Api,根据,onStateChange事件返回一个从-1到5的有符号整数,但是我在获取该整数时遇到问题 ActionScript 3.0代码: loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit); loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3&modestbranding=true")); function onL

根据,onStateChange事件返回一个从-1到5的有符号整数,但是我在获取该整数时遇到问题

ActionScript 3.0代码:

loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3&modestbranding=true"));

function onLoaderInit(event:Event):void{
    loader.content.addEventListener("onStateChange", onPlayerStateChange);
}

function onPlayerStateChange(event):void{
    trace(event);
}
此跟踪提供以下输出:

[Event type="onStateChange" bubbles=false cancelable=false eventPhase=2]
[Event type="onStateChange" bubbles=false cancelable=false eventPhase=2]
[Event type="onStateChange" bubbles=false cancelable=false eventPhase=2]
ActionScript代码运行良好,只是达到了我正在努力解决的状态值

我想要的唯一属性是
eventPhase
属性,但我知道它不是这样的,因为它每次都是相同的值(API声明返回的第一个状态是-1),而且它也是一个无符号整数


有人能告诉我如何获取所需的值吗?

从内存中,我想您可能需要
事件
对象的
数据
属性:

function onPlayerStateChange(event):void{
    trace(event.data);
}

如果没有,为了将来的参考,请在侦听器的主体中粘贴一个断点,然后可以直接检查事件对象的属性。跟踪将只显示字符串表示,这对复杂对象并不总是有用。

事件。数据确实是状态隐藏的地方-谢谢,非常感谢您提供了有关检查对象的知识。