Copy link to clipboard
Copied
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
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:
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.
Copy link to clipboard
Copied
Looks like your frame1 function is missing a closing brace.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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:
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.
Copy link to clipboard
Copied
thanks.
you are genius man
Copy link to clipboard
Copied
Glad you got your issue resolved ![]()
Copy link to clipboard
Copied
Hi Sinious
Actually i am getting a sound problem with my sound. The sound is not working.
can i email you my fla, and actionscript please.
Can't attach files on abode.
By the way what is your email address.
Please help me.
Thanks/regards
rakesh
Copy link to clipboard
Copied
Send me a priv msg plz
Copy link to clipboard
Copied
i have sent u private msg
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more