语法错误1083 actionscript 3

时间:2013-08-01 20:58:49

标签: flash actionscript

有人非常友好地帮助我创建了一个带有动作脚本3的flash的youtube播放器,但是当我测试电影时,它出现了错误1083,意外的右声道,这恰好是程序结束时的最后一个右支撑。如果我拿走那个右支撑,那么我会收到错误1083和1084(程序结束是意料之外的,并且在程序结束之前期待正确的行为。这是代码本身:

import flash.system.Security;

Security.allowDomain( '*' );
Security.allowInsecureDomain( '*' );

var vPlayer:Object;
var playerLoader:Loader;

function loadVideo():void
{
    playerLoader = new Loader();

    // next line loads a youtube player with no UI
    playerLoader.load( new URLRequest( 'http://www.youtube.com/apiplayer?version=3' ) );

    // wait for it to load
    playerLoader.contentLoaderInfo.addEventListener( Event.INIT, onLoaderInit );
}

function onLoaderInit( evt:Event ):void
{
    // 'vPlayer_container' is a movieclip on stage same size as video player you need.
    // add your youtube Loader, ( which is actually the player ), to vPlayer_container's display list.
    vPlayer_container.addChild(playerLoader);

    // set the vPlayer variable to be the loaded youtube player
    vPlayer = playerLoader.content;

    // wait for it to be ready
    vPlayer.addEventListener( 'onReady', onPlayerReady );
}

function onPlayerReady( evt:Event ):void
{
    vPlayer.removeEventListener( 'onReady', onPlayerReady );

    // set listener for onComplete and play/pause events
    vPlayer.addEventListener( 'onStateChange', onPlayerStateChange );

    // mute it on start if you want
    vPlayer.mute();

    // set size of video screen
    vPlayer.setSize( 392,220 );

    // now load your youtube video in your new youtube player
    // get this video number off the url to your youtube video
    vPlayer.loadVideoById( 'GEghz32qhiA', 0 );
}

function onPlayerStateChange( evt:Event ):void
{
    // if video is over
    if( Object(evt).data == 0 ) //do something when video is over
}

// other player commands available - you need to make your own buttons for these
// vPlayer.mute();
// vPlayer.unMute();
// vPlayer.pauseVideo();
// vPlayer.playVideo();

如果有人可以提供帮助,我们将不胜感激,谢谢!

1 个答案:

答案 0 :(得分:0)

if( Object(evt).data == 0 )

您没有对if声明做任何事情。这导致了问题。要么用它做一些事情要么删除它以消除错误。