• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

ActionScript 3 syntax error 1083

Community Beginner ,
Oct 26, 2017 Oct 26, 2017

Copy link to clipboard

Copied

Thanks  in advance for your help!

Someone very kindly helped me out on creating a youtube player for flash with ActionScript 3, however when I test the movie it comes up with error 1083, unexpected rightbrace, which happens to be the last right brace at the end of the program. If I take away that right brace, I then receive both errors 1083 and 1084 (end of program is unexpected and expecting rightbrace before end of program. Here's the code itself:

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
}

TOPICS
ActionScript

Views

502

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 27, 2017 Oct 27, 2017

Copy link to clipboard

Copied

LATEST

Your last function, onPlayerStateChange, you are starting an ā€œifā€ conditional statement, but you never finish it. You need to add a pair of curly braces, ā€œ{}ā€ at the end of the if statement even if you have nothing inside them. Hereā€™s the Actionscript reference: Adobe ActionScript 3.0 * Conditionals

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines