Skip to main content
Participant
April 19, 2012
Answered

1084:syntax error

  • April 19, 2012
  • 2 replies
  • 2959 views

I am getting  the following errors at the end  the three last curly brackets when executing my swf file :-

expecting identifier before rightparen

(ii) expecting rightbrace before end of program

(iii)  expecting rightbrace before end of program

Here is my as codes :-

package  rakesh_fla

{

import flash.display.*;

import flash.events.*;

import flash.media.*;

import flash.net.*;

import flash.text.*;

import flash.ui.*;

public var default_volume:Number;

public var sound_control:MovieClip;

public var percent:Number;

public var fm_bar_bg:MovieClip;

public var music_volume:SoundTransform;

public var loader_info:TextField;

public var rakesh_background:MovieClip;

public var rakesh_fullscreen:SimpleButton;

public var total_bytes:Number;

public var loaded_bytes:Number;

public var fm_bar:MovieClip;

public var bg_music:Sound;

public var music_channel:SoundChannel;

public dynamic public class MainTimeline extends MovieClip

{

public function MainTimeline()

{

super();

addFrameScript(0, frame1, 1, frame2);

return;

}// end function

public function switch_screen_mode(event:MouseEvent)

{

if (stage.displayState == StageDisplayState.NORMAL)

{

stage.displayState = StageDisplayState.FULL_SCREEN;

}

else

{

stage.displayState = StageDisplayState.NORMAL;

}

return;

}// end function

function frame2()

{

stop();

rakesh_fullscreen.visible = true;

sound_control.visible = true;

stage.addEventListener(Event.RESIZE, resize_listener);

stage.dispatchEvent(new Event(Event.RESIZE));

rakesh_fullscreen.addEventListener(MouseEvent.CLIC  K, switch_screen_mode);

default_volume = 0.5;

bg_music = new rakesh_music();

music_channel = bg_music.play(0, 10000);

music_volume = new SoundTransform();

music_volume.volume = default_volume;

music_channel.soundTransform = music_volume;

sound_control.stop();

sound_control.addEventListener(MouseEvent.CLICK, play_pause);

return;

}// end function

public function play_pause(event:MouseEvent) : void

{

music_volume.volume = default_volume;

if (event.target.currentFrame == 1)

{

music_volume.volume = 0;

}

music_channel.soundTransform = music_volume;

event.target.play();

return;

}// end function

public function goto_music(event:MouseEvent) : void

{

navigateToURL(new URLRequest("song"), "_blank");

return;

}// end function

public function load_progress(event:Event) : void

{

loaded_bytes = stage.loaderInfo.bytesLoaded;

total_bytes = stage.loaderInfo.bytesTotal;

if (total_bytes == 0)

{

total_bytes = 1;

}

percent = Math.round(loaded_bytes / total_bytes * 100);

fm_bar.scaleX = percent * 0.01;

loader_info.text = "Loading... " + percent + "%";

if (percent >= 100)

{

fm_bar.removeEventListener(Event.ENTER_FRAME, load_progress);

play();

}

return;

}// end function

function frame1()

{

stop();

stage.scaleMode = StageScaleMode.NO_SCALE;

stage.align = StageAlign.TOP_LEFT;

fm_bar.addEventListener(Event.ENTER_FRAME, load_progress);

return;

function resize_listener(event:Event) : void

{

rakesh_background.x = stage.stageWidth * 0.5;

rakesh_background.y = stage.stageHeight * 0.5;

rakesh_fullscreen.x = stage.stageWidth - 22;

rakesh_fullscreen.y = stage.stageHeight - 22;

sound_control.x = stage.stageWidth - 65;

sound_control.y = 20;

return;

}// end function

}

}

}

please  help

rakesh

This topic has been closed for replies.
Correct answer sinious

The errors I get don't show any missing braces, just missing functions. I moved the function you make inside the other frame1() function outside of that because there's no reason you should define a function inside another function, it will die at the end of the function and be invalid.

Here's the code:

http://pastebin.com/MTU4kQ2M

It's easier to paste this amount of code there with formatting and updatability.

edit:

Changed it, you had public declared twice in your class definition.

2 replies

sinious
Legend
April 19, 2012

Your programs appears to have the correct indentation when I import it into a code formatting utility (Flash Builder).

How about the lines of code you're getting errors on and printing those lines of code for us so we can take a look.

rakesh74Author
Participant
April 20, 2012

thanks for your  reply.

here  are the errors

expecting identifier before rightparen

(ii) expecting rightbrace before end of program

(iii)  expecting rightbrace before end of program

sinious
siniousCorrect answer
Legend
April 20, 2012

The errors I get don't show any missing braces, just missing functions. I moved the function you make inside the other frame1() function outside of that because there's no reason you should define a function inside another function, it will die at the end of the function and be invalid.

Here's the code:

http://pastebin.com/MTU4kQ2M

It's easier to paste this amount of code there with formatting and updatability.

edit:

Changed it, you had public declared twice in your class definition.

April 19, 2012

Looks like your frame1 function is missing a closing brace.