Simple scripting:  On frame (45) go back to first frame..??

I am trying to do a simple script and I am having a huge brain fart.
when I get to frame 45 I want the play head to go back to frame 1.  I have the below code but I am getting errors.  Can someone point my head in the right direction?
<><><>
onFrame (45) {
    this.gotoAndPlay(1);
<><><>
One error says that "is expecting semi-colon before or after first brace.....
second possible error is "call to possible undefined method onFrame....
Need help.

If that is the first scene, the in the last frame (45) simply putting...
    gotoAndPlay(1);
should work.
If it is not the first scene, then you should label the first frame and use the label instead of the frame number...
    gotoAndPlay("firstFrameLabel");

Similar Messages

  • *Flash animation looping but going back to first frame {want to hold on last frame}

    I came across this article on looping animations = http://www.quip.net/blog/2006/flash/how-to-loop-three-times
    I'm a novice with flash and just trying to plug thru to get some ads up and running for the first time.
    Everything worked for me in the article...the one thing I wanted to do but haven't found an answer to is how to stop the animation on the last frame after looping is complete, instead of automatically going back to the first frame??
    What's the easiest/most effective way to do this?
    The stop script does not work...still goes back to first frame.
    For all my flash ads, I've imported an FLV video...so don't know if it's some function for flv's/video's that auto-rewinds to first frame...
    Thanks so much, really appreciate any insight on this.
    The sooner you can catch a minute to get back the better

    Ok...not working for me - prob. b/c I'm missing something again.
    What I did was...
    1)  Renamed the instace of replay button = "replay_btn".
    [not sure if that's correct...guessed b/c you reference it in the code]
    2)  I placed this in the action code on action layer on last keyframe =
    var loopNum:Number;
    loopNum++;
    if(loopNum%3==0){
    stop();
    your_replay_btn._visible=true;
    } else {
    your_replay_btn._visible=false;
    3) I placed this in action code on the replay layer on last keyframe =
    your_replay_btn.onRelease=function(){
    this.gotoAndPlay(1);
    What happens is the replay button still flashes at the end of each loop and the loops just continue...it doesn't stop at 3.
    I also get this error =
    Can you break down what I'm doing wrong and how to fix...need to get this out asap.
    I truly appreciate your help and time so far on this...big thanks kglad!

  • OnResize - coming back to first frame

    Hello,
    I´ve done a movie with two frames controled by onResize.
    It works fine in the first frame, but when I do a resize of the
    browser staying in the second frame the movie comes back to the
    first frame.
    If I use only one frame, the result is similar. The objects
    comes back to their initial state. So the resize of the browser is
    reloading the site. I´ve tested in IE, Mozilla and Eudora,
    obteining the same result.
    Any Idea?
    Thanks in advance :)

    Hi kglad,
    A lot of time without see you :)
    the code is:
    estado=1;
    Stage.align = "LT";
    Stage.scaleMode = "noScale";
    stageListener = new Object();
    stageListener.onResize = function() {
    if(estado==1){
    expandIt1();
    if(estado==2){
    expandIt2();
    Stage.addListener(stageListener);
    expandIt1 = function () {
    back._width = Stage.width;
    back._height = Stage.height;
    logo._x = (Stage.width / 2) - (logo._width / 2);
    logo._y = Stage.height / 2;
    sun._y = Stage.height;
    sun._height = Stage.height - 100;
    sun._width = sun._height;
    sun.x = Stage.width - sun._width / 2;
    menu._width = Stage.width - 58;
    expandIt2 = function () {
    back._width = Stage.width;
    back._height = Stage.height;
    sun._y = Stage.height;
    sun._height = Stage.height - 100;
    sun._width = sun._height;
    sun.x = Stage.width - sun._width / 2;
    menu._width = Stage.width - 58;
    expandIt1();
    the "estado" variable" defines what function perform...

  • How do I loop back from the first frame to the last frame?

    Hi there,
    I'm currently working on the framework for a product viewer.
    I have:
    a movie clip called 'viewer_mc' which contains the images take from different angles of the product. The actionscript generates a script on the last frame of this that returns it to frame 1.
    a button instance called 'autoplay_btn' which plays through the movie clip from whatever the current frame is, and stops on frame 1.
    a left and right button which serve to move the movie clip frame, to give the appearance that the product is rotating.
    I have succeeded in getting it to:
    have the movie clip play through once, return to frame 1 and stop.
    have the buttons return functions when held down, that move the frame in the movie clip using nextFrame and prevFrame commands. The right button successfully loops round to frame 1 and continues functioning to give the appearance of continual rotation.
    The last problem I am experiencing is getting the left button to act in the corresponding manner, going from the first frame to the last and continuing to function.
    Here is my actionscript so far:
    import flash.events.MouseEvent;
    var lastFrame:Number = viewer_mc.totalFrames;
    var thisFrame:Number = viewer_mc.currentFrame;
    var backFrame:Number = viewer_mc.currentFrame-1;
    1. This is the part that gets it to play through once before returning to the first frame. I think perhaps the problem I am experiencing is because of the 'viewer_mc.addFrameScript(lastFrame-1, toStart)' part i.e. although I'm holding the left button, its returning to this script and therefor getting bounced back immediately to the first frame. However, there is no flicker on the screen which you might expect if this were the case
    Note - as this is a generic product viewer which I can use as a template I am using lastFrame etc. as opposed to typing the value in
    function toStart (){
              viewer_mc.gotoAndStop(1);
    viewer_mc.addFrameScript(lastFrame-1, toStart);
    2. This is the functionality for the autoplay_btn that will play through a rotation / return the viewer to the initial (frontal) view of the product (frame 1).
    autoplay_btn.addEventListener(MouseEvent.MOUSE_DOWN, autoplay);
    function autoplay (ev:MouseEvent):void{
              var startFrame:Number = viewer_mc.currentFrame;
              viewer_mc.gotoAndPlay(startFrame);
    3. This is the functionality of the right button, which when held, moves the movie clip to the next frame via the 'rotateRight' function based on the 'nextFrame' command. It loops back round to the first frame due to the 'viewer_mc.addFrameScript(lastFrame-1, toStart)' script generated on the last frame of the movie clip, as is desired.
    right_btn.addEventListener(MouseEvent.MOUSE_DOWN, rightDown);
    function rightDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stoprightDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateRight); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stoprightDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateRight);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stoprightDown); //remove the listener for mouse up
    function rotateRight(e:Event):void {
        viewer_mc.nextFrame();
    4. This is the functionality of the left button, which when held, moves the movie clip to the prev frame via the 'rotateRight' function based on the 'prevFrame' command. And this is where the problem lies, as although it works for getting the movieclip back to frame 1, it does not loop round to the last frame and continue functioning, as is wanted.
    left_btn.addEventListener(MouseEvent.MOUSE_DOWN, leftDown);
    function leftDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stopleftDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateLeft); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stopleftDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateLeft);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stopleftDown); //remove the listener for mouse up
    I'd imagine it is probably my logic for this part that is really letting me down - I can do a similar function in actionscript 2, but am trying to learn actionscript 3 just to move with the times as it were, and struggling a bit. Still this is only a few days in!
    function rotateLeft(e:Event):void{
              if(thisFrame==1){
                        gotoAndStop(viewer_mc.totalFrames-1);
              } else{
              viewer_mc.prevFrame();
    Any help you can give me would be gratefully received. For an example of the effect I am trying to achieve with the autoplay button etc. I recommend:
    http://www.fender.com/basses/precision-bass/american-standard-precision-bass

    Thanks for getting back to me.
    Here's the code without my comments / explanations:
    import flash.events.MouseEvent;
    import flash.events.Event;
    var lastFrame:Number = viewer_mc.totalFrames;
    var thisFrame:Number = viewer_mc.currentFrame;
    var backFrame:Number = viewer_mc.currentFrame-1;
    function toStart (){
              viewer_mc.gotoAndStop(1);
    viewer_mc.addFrameScript(lastFrame-1, toStart);
    //last image of viewer_mc = first image of viewer_mc
    autoplay_btn.addEventListener(MouseEvent.MOUSE_DOWN, autoplay);
    function autoplay (ev:MouseEvent):void{
              var startFrame:Number = viewer_mc.currentFrame;
              viewer_mc.gotoAndPlay(startFrame);
    right_btn.addEventListener(MouseEvent.MOUSE_DOWN, rightDown);
    function rightDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stoprightDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateRight); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stoprightDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateRight);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stoprightDown); //remove the listener for mouse up
    function rotateRight(e:Event):void {
        viewer_mc.nextFrame();
    left_btn.addEventListener(MouseEvent.MOUSE_DOWN, leftDown);
    function leftDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stopleftDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateLeft);//while the mouse is down, run the tick function once every frame as per the project frame rate
    function stopleftDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateLeft);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stopleftDown); //remove the listener for mouse up
    function rotateLeft(e:Event):void{
              viewer_mc.prevFrame();
    The definition of the rotateLeft function is where the problem lies I think - I've taken out my poor attempts at doing the logic from the previous post. If I were to write it out long-hand the statement I want to write is: 'If you get to frame 1 and function rotateLeft is called go to the end of the movie clip'.
    The reason I have to use the viewer_mc.totalFrames-1 definition in the addFrameScript call is the addFrameScript function is 0 based i.e. if you want to call frame 1 of the movieclip you have to return a value of 0 in the addFrameScript (or such is my understanding of it anyway). As such, the last image in the movie clip will need to be the view obtained at 360 degree rotation, which is of course the same view as at 0 degree rotation. As a consequence, the last frame in the movie clip is superfluous for the user, but necessary for the overall effect to be achieved. And, in addition, to keep up the effect of a 360 degree view when the rotateLeft function is called it needs to skip that last frame to go to the lastFrame-1 (or totalframes-1), or in other words, the view of the image prior to completing the full 360 rotation.
    the variables thisFrame and lastFrame are defined at the very top of the script. Like you said they might need to be defined or called on again elsewhere.

  • Made preference changes, but still getting the Ram preview needs 2 or more frames to play back.

    I'm new to After Effects CS6 and am working on a very simple Kinetic Typography project. I don't have a lot of memory, but this is a really simple project, so I'm wondering if maybe I'm just not using the work area correctly. Every once in while I can get the project to RAM preview, but only for a few seconds. Most of the time I get the "Ram preview needs 2 or more frames to play back" error message. I have pasted my sytem info and setting info bleow. Thanks for any insight! 
    I have checked the Render Multiple Fames Simultaneously box and have set the seetings at:
    Here is the info when you click on details:
    Installed RAM: 4.00 GB
    Current RAM Usage: 0.00 GB
    Allowed RAM Usage: 2.50 GB
    Process ID
    Application Name
    Min Needed Memory
    Max Usable Memory
    Max Allowed Memory
    Current Memory
    Current Priority
    3081
    After Effects
    0.00
    0.00
    2.50
    0.00
    3 - Low
    System info:
    System Version: Mac OS X 10.6.8 (10K549)
    Model Name: MacBook Pro
      Model Identifier: MacBookPro8,2
      Processor Name: Intel Core i7
      Processor Speed: 2.2 GHz
      Number of Processors: 1
      Total Number of Cores: 4
      L2 Cache (per Core): 256 KB
      L3 Cache: 6 MB
      Memory: 4 GB

    What exact version of After Effects?
    Show a screenshot of your TImeline panel and Preview panel when the problem occurs.
    Make sure that we can see the details in your screenshot. Your current screenshot is unreadable because it's so small.

  • Simple scripting question

    OK, so I'm fairly sure this is a simple scripting issue, but I just cannot get my head around the scripting language.
    I am working on a DVD where the viewer has the option of watching the track once or having it loop continuously.
    There is not enough space on the disc to duplicate the track so that is not an option.
    Any help would e much appreciated.
    Tony

    This is a perfectly scenerio for Stories. It allows you to duplicate a title without increasing the space. Look in the manual and have a go at it. Come back if you have questions.

  • Error while executing a simple script....

    Hi,
    I am trying to run the following simple script in Oracle 8i:
    UPDATE
    vcad_ocorrencias
    set tipo_situa_solic = 'E', desc_obs_atendente = 'ACERTO DE BASE -
    18/10/2004'
    where cod_solicitacao = 7
    and tipo_situa_solic in ('N', 'P')
    and cod_contrato_Inter not in ( 2247,2295,2296,2297,2278,2269,2168)
    and dthora_geracao < '07/10/2004'
    order by cod_contrato_inter;
    And it is returning the following message error:
    ERRO na linha 8:
    ORA-00933: SQL command not properly ended
    Well this script was made by a developer and now I have to run it in production environment...
    Does someone know why it is failing?

    Get rid of your 'order by statement'.
    order by cod_contrato_inter;
    Also make certain that the 'NLS_DATE_FORMAT' is set to 'DD/MM/YYYY' or change
    and dthora_geracao < '07/10/2004'
    to
    and dthora_geracao < to_date('07/10/2004','DD/MM/YYYY')
    UPDATE
    vcad_ocorrencias
    set tipo_situa_solic = 'E',
    desc_obs_atendente = 'ACERTO DE BASE - 18/10/2004' -- not sure if it is a date column
    where cod_solicitacao = 7
    and tipo_situa_solic in ('N', 'P')
    and cod_contrato_Inter not in ( 2247,2295,2296,2297,2278,2269,2168)
    and dthora_geracao < to_date('07/10/2004','DD/MM/YYYY')

  • Could someone please sketch out this simple script for me?

    Could someone please sketch out a simple java script for me. I will have a document with one background
    layer and a layer set (group) called "Analyze" that consists of 63 adjustment layers. The layer names in that "Analyze" group(folder) will be
    "01" ...through "63" with 01 on the bottom and 63 at the top. Initially, all of the adjustment layers will be invisible and  the
    group will be closed (not expanded). I need a simple  script that will check for the first invisible layer in that group
    and make it visible without selecting that layer nor expanding the group. The script has to check
    for the first invisible layer every time it runs because other actions may have turned off a layer in the set.
    The point of this is so I can hotkey flipping on the layers one at a time without expanding the set or
    changing focus off the  background. It seems it should be a simple loop, but I just can't wrap  my head
    around all the objects (e.g. Layer as opposed to Layers  and  Artlayer as opposed to Artlayers)
    and the constants constants.
    for (i = 63; i>0; i--){                 /* I have found layer indexes 0 are the topmost layer */
      if( layerset[i] == INVISIBLE){
               layerset[i] = VISIBLE;
                  break;
    Could someone please write me a simple script that would do this?
    Edit I found this and its very close to what I need:
    var doc = app.activeDocument;
    for(var i = 0 ; i < doc.layers.length;i++){
      doc.layers[i].visible = (i % 2 == 0);
    From here : Function to show/hide layer with Photoshop script (JSX) - Stack Overflow
    In my case I would rewrite it to this
    for(var i = 62; i >=0; i--){
         if(  !doc.layers[i].visible){
              doc.layers[i].visible =TRUE;
              break;
    My problem is I just need  to traverse the layers in my layerset "Analyze"
    How do  I reference just those? Is there a doc.layersets["Analyze"].layers[i].visible = TRUE?
    Message was edited by: Shawn Laughlin To add more information

    Well this works:
    var doc = app.activeDocument;
    var analyze = doc.layerSets.getByName("Analyze").layers
    for(var i = 62 ; i >= 0; i --){
        if (!analyze[i].visible){
            analyze[i].visible =1;
            break;
    Hard to believe TRUE is not a constant in java.

  • Simple Script works on 10.6 but not 10.5.8

    Hi,
    Brand new to Applescript...I made a simple script (saved as an application) to rename Excel Sheet Tabs and it works on my MBP (10.6.2) however when I try sharing with other users (10.5.8), it fails to carry out properly. It opens a blank workbook rather than the "test.xls" workbook and won't go any further. Am thinking it might be due to:
    1) where the script and .xls file were originally created/saved?
    2) 10.6.2 vs. 10.5.8?
    3) method of sharing? Tried attaching to Mac OSX Server Wiki, NAS and e-mailing but still wouldn't work.
    here's the script-
    tell application "Microsoft Excel"
    try
    open workbook workbook file name "test.xls"
    activate object worksheet "names"
    set myRange to range "A2" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 3 to myName
    set myRange to range "A3" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 4 to myName
    set myRange to range "A4" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 5 to myName
    set myRange to range "A5" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 6 to myName
    set myRange to range "A6" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 7 to myName
    set myRange to range "A7" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 8 to myName
    set myRange to range "A8" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 9 to myName
    set myRange to range "A9" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 10 to myName
    set myRange to range "A10" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 11 to myName
    set myRange to range "A11" of worksheet "names"
    set myName to input box prompt "Please type a Student Name" title "Students"
    set value of myRange to myName
    set name of sheet 12 to myName
    end try
    end tell
    Any suggestions will be greatly appreciated! THANKS!

    more info:
    a co-worker with a MacBook (10.5.8) was able to download the script and .xls file from our server and it worked...
    An eMac (10.4.11) was not able to run the script.
    All machines are running 2008 Office for Mac

  • Button to frame | button going back to the main frame (please help)

    these are the codes, by clicking the "FCFS" button it will generate another frame and from that frame another button will be pressed "accept" and it will go to another frame....
    my problem is that i nid to put codes on the "back" button to go back to the main frame were it started... please help me... thnks
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Oscon extends JFrame
         private JButton fcfsB, priorityB, sjfB, rrB, exitB, creditsB;
         private fcfsButtonHandler fbHandler;
         private priorityButtonHandler pbHandler;
         private sjfButtonHandler sbHandler;
         private rrButtonHandler rbHandler;
         private exitButtonHandler ebHandler;
         private creditsButtonHandler cbHandler;     
         public Oscon()// main frame
              fcfsB = new JButton ("FCFS");
              fbHandler = new fcfsButtonHandler();
              fcfsB.addActionListener(fbHandler);
              priorityB = new JButton ("PRIORITY");
              pbHandler = new priorityButtonHandler();
              priorityB.addActionListener(pbHandler);
              sjfB = new JButton ("SJF");
              sbHandler = new sjfButtonHandler();
              sjfB.addActionListener(sbHandler);
              rrB = new JButton ("RR");
              rbHandler = new rrButtonHandler();
              rrB.addActionListener(rbHandler);
              exitB = new JButton ("EXIT");
              ebHandler = new exitButtonHandler();
              exitB.addActionListener(ebHandler);
              creditsB = new JButton ("CREDITS");
              cbHandler = new creditsButtonHandler();
              creditsB.addActionListener(cbHandler);
              setTitle("CPU SCHEDULING");
              Container pane =getContentPane ();     
              pane.setLayout(new GridLayout(2,3));
              pane.add(fcfsB);
              pane.add(priorityB);
              pane.add(sjfB);
              pane.add(rrB);
              pane.add(exitB);
              pane.add(creditsB);
              setSize(500,100);
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
         public class fcfsButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   JFrame frame = new JFrame("FCFCS setting");
         final JLabel FCFSProcessL, FCFSp1L,FCFSp2L,FCFSp3L,FCFSp4L, FCFSbt;
              final JTextField FCFSp1TF,FCFSp2TF,FCFSp3TF,FCFSp4TF;
                        FCFSProcessL = new JLabel("PROCESS", SwingConstants.CENTER);
                        FCFSp1L     = new JLabel("P1:", SwingConstants.CENTER);
                        FCFSp2L     = new JLabel("P2:", SwingConstants.CENTER);
                        FCFSp3L     = new JLabel("P3:", SwingConstants.CENTER);
                        FCFSp4L     = new JLabel("P4:", SwingConstants.CENTER);
                        FCFSbt      = new JLabel("BT:", SwingConstants.CENTER);
                        FCFSp1TF= new JTextField (10);
                        FCFSp2TF= new JTextField (10);
                        FCFSp3TF= new JTextField (10);
                        FCFSp4TF= new JTextField (10);
                        JButton     FCFSokB = new JButton ("Accept");
                        FCFSokB.addActionListener(new ActionListener() {   
                        public void actionPerformed(ActionEvent e)
                                  JFrame frame2 = new JFrame("FCFCS");
                                  frame2.setSize(500,500);
                                  frame2.setVisible(true);
                                  frame2.setDefaultCloseOperation(EXIT_ON_CLOSE);
                                  JButton     FCFSclearB = new JButton ("clear");
                                  FCFSclearB.addActionListener(new ActionListener() {   
                                  public void actionPerformed(ActionEvent e)
                                  FCFSp1TF.setText("");
                                  FCFSp2TF.setText("");
                                  FCFSp3TF.setText("");
                                  FCFSp4TF.setText("");
                        JButton     FCFSBackB = new JButton ("Back");
                        FCFSBackB.addActionListener(new ActionListener() {   
                        public void actionPerformed(ActionEvent e)
                                  setTitle("CPU SCHEDULING");
                                  frame.setLayout(new GridLayout(7,2));
                                  frame.add(FCFSProcessL);
                                  frame.add(FCFSbt);
                                  frame.add(FCFSp1L);
                                  frame.add(FCFSp1TF);
                                  frame.add(FCFSp2L);
                                  frame.add(FCFSp2TF);
                                  frame.add(FCFSp3L);
                                  frame.add(FCFSp3TF);
                                  frame.add(FCFSp4L);
                                  frame.add(FCFSp4TF);
                                  frame.add(FCFSokB);
                                  frame.add(FCFSclearB);
                                  frame.add(FCFSBackB);
                                  frame.setSize(200,250);
                                  frame.setVisible(true);
                                  frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
         public class priorityButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
         public class sjfButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   System.exit (0);          
         public class rrButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   System.exit (0);          
         public class exitButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   System.exit (0);          
         public class creditsButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   System.exit (0);          
              public static void main (String [] args)
              Oscon O = new Oscon();
    }

    please help me revise my program, im almost done, i just nid to set the progress bar that it will run according to the waiting time, or set the progress bar to run in order.. these are the variable names of the progress bar(current1, then current2, then current3 then current4).
    i looked it up on the site and i cant really understand it... i just did the part where i included the progress bar to the interface. ijust want the 4 progress bars to run after clicking the accept button.... Please help me!!! its for my project and i didnt slept last night just working on this... i just nid help sir... thnks...
    these are the codes i made:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JProgressBar;
    public class CPUSched
              public CPUSched()
              JFrame frame = new JFrame();
                   JProgressBar current1, current2, current3, current4;
                   Thread runner;
                   int num = 0;
              final JLabel ProcessL, p1L,p2L,p3L,p4L, bt, prioL, tqL, wtL, awtL, awtLA;
                   final JTextField p1TF,p2TF,p3TF,p4TF, prio1TF, prio2TF,prio3TF,prio4TF, tqTF ;
                   final JLabel      blank1, blank2, blank3, blank4, blank5, blank6, blank7, blank8, blank9, blank10, blank11,
                                       blank12, blank13, blank14, blank15;
                   final JLabel     blank16, blank17, blank18, blank19, blank20, blank21, blank22, blank23, blank24, blank25,
                                       blank26, blank27, blank28, blank29, blank30;
                   current1 = new JProgressBar(0, 2000);
                   current1.setValue(0);
         current1.setStringPainted(true);
                   current2 = new JProgressBar(0, 2000);
                   current2.setValue(0);
         current2.setStringPainted(true);
                   current3= new JProgressBar(0, 2000);
                   current3.setValue(0);
         current3.setStringPainted(true);
                   current4 = new JProgressBar(0, 2000);
                   current4.setValue(0);
         current4.setStringPainted(true);
                        ProcessL = new JLabel("PROCESS", SwingConstants.CENTER);
                        p1L     = new JLabel("P1:", SwingConstants.CENTER);
                        p2L     = new JLabel("P2:", SwingConstants.CENTER);
                        p3L     = new JLabel("P3:", SwingConstants.CENTER);
                        p4L     = new JLabel("P4:", SwingConstants.CENTER);
                        bt      = new JLabel("Burst Time:", SwingConstants.CENTER);
                        prioL= new JLabel("Priority (1-4):", SwingConstants.CENTER);
                        tqL= new JLabel("Time Quantum:", SwingConstants.CENTER);
                        wtL= new JLabel("Waiting time:", SwingConstants.CENTER);
                        awtL= new JLabel("Average Waiting time:");
                        awtLA= new JLabel("");
                        blank1= new JLabel("");
                        blank2= new JLabel("");
                        blank3= new JLabel("" ,SwingConstants.CENTER);
                        blank4= new JLabel("");
                        blank5= new JLabel("", SwingConstants.CENTER);
                        blank6= new JLabel("");
                        blank7= new JLabel("");
                        blank8= new JLabel("" ,SwingConstants.CENTER);
                        blank9= new JLabel("");
                        blank10= new JLabel("");
                        blank11= new JLabel("", SwingConstants.CENTER);
                        blank12= new JLabel("");
                        blank13= new JLabel("");
                        blank14= new JLabel("");
                        blank15= new JLabel("");
                        blank16= new JLabel("");
                        blank17= new JLabel("");
                        blank18= new JLabel("");
                        blank19= new JLabel("");
                        blank20= new JLabel("");
                        blank21= new JLabel("");
                        blank22= new JLabel("");
                        blank23= new JLabel("");
                        blank24= new JLabel("");
                        blank25= new JLabel("");
                        blank26= new JLabel("");
                        blank27= new JLabel("");
                        blank28= new JLabel("");
                        blank29= new JLabel("");
                        blank30= new JLabel("");
                        p1TF= new JTextField (2);
                        p2TF= new JTextField (2);
                        p3TF= new JTextField (2);
                        p4TF= new JTextField (2);
                        prio1TF= new JTextField (2);
                        prio2TF= new JTextField (2);
                        prio3TF= new JTextField (2);
                        prio4TF= new JTextField (2);
                        tqTF= new JTextField (2);
                             prio1TF.setEditable(false);
                             prio2TF.setEditable(false);
                             prio3TF.setEditable(false);
                             prio4TF.setEditable(false);
                             tqTF.setEditable(false);
                        JButton     okB = new JButton ("Accept");
                        okB.addActionListener(new ActionListener() {   
                        public void actionPerformed(ActionEvent e)
                             double iw=0, wtp1, wtp2, wtp3, wtp4;
                             double bt1, bt2, bt3, bt4;
                             double averageWT, sumWT;
                             bt1=Double.parseDouble(p1TF.getText());
                             bt2=Double.parseDouble(p2TF.getText());
                             bt3=Double.parseDouble(p3TF.getText());
                             bt4=Double.parseDouble(p4TF.getText());
                             wtp1 = iw;
                             wtp2 = wtp1+bt1;
                             wtp3 = wtp2+bt2;
                             wtp4 = wtp3+bt3;
                             sumWT = wtp1+wtp2+wtp3+wtp4;
                             averageWT = sumWT/4;
                             awtLA.setText(""+averageWT);
                             blank3.setText(""+wtp1);
                             blank5.setText(""+wtp2);
                             blank8.setText(""+wtp3);
                             blank11.setText(""+wtp4);
                        JButton     clearB = new JButton ("Clear");
                        clearB.addActionListener(new ActionListener() {   
                        public void actionPerformed(ActionEvent e)
                                  p1TF.setText("");
                                  p2TF.setText("");
                                  p3TF.setText("");
                                  p4TF.setText("");
                             awtLA.setText("");
                             blank3.setText("");
                             blank5.setText("");
                             blank8.setText("");
                             blank11.setText("");
                             frame.setTitle("First Come First Serve");
                                  frame.setLayout(new GridLayout(6,6));
                                  frame.add(ProcessL);
                                  frame.add(blank1);
                                  frame.add(wtL);
                                  frame.add(bt);
                                  frame.add(prioL);
                                  frame.add(tqL);
                                  frame.add(p1L);
                                  frame.add(current1);
                                  frame.add(blank3);                              
                                  frame.add(p1TF);
                                  frame.add(prio1TF);
                                  frame.add(tqTF);
                                  frame.add(p2L);
                                  frame.add(current2);
                                  frame.add(blank5);
                                  frame.add(p2TF);
                                  frame.add(prio2TF);
                                  frame.add(blank6);
                                  frame.add(p3L);
                                  frame.add(current3);
                                  frame.add(blank8);
                                  frame.add(p3TF);
                                  frame.add(prio3TF);
                                  frame.add(blank9);
                                  frame.add(p4L);
                                  frame.add(current4);
                                  frame.add(blank11);
                                  frame.add(p4TF);
                                  frame.add(prio4TF);
                                  frame.add(blank12);
                                  frame.add(blank13);
                                  frame.add(blank14);
                                  frame.add(okB);
                                  frame.add(clearB);
                                  frame.add(awtL);
                                  frame.add(awtLA);
                                  frame.setSize(800,200);
                                  frame.setVisible(true);
                                  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public static void main (String [] args)
              CPUSched O = new CPUSched();
    }

  • HOW TO : Writing simple scripts in SQL Developer??

    Here is a simple script I run in SQL*Plus...
    the first SQL prints the QCSID, the second script prompts for a SID which is the QCSID from the first SQL... once provided it gives me the output I want...
    I just cannot do this in SQL DEVELOPER..... or Can I?
    select distinct qcsid from v$px_session;
    select sid,serial#,qcsid,qcserial#,degree,req_degree from v$px_session
    where qcsid in (select qcsid from v$px_session where sid='&sid');

    Ganesh,
    Simple substitution and defines work in SQL Developer scripts.
    I think the problem with running your script is that the first query results are not displayed before the window asking for the '&sid' value. That is the output to the 'screen output' tab is buffered and not synchronized with additional pop up (or dialog) windows. Is that correct?
    Currently:
    You can use substitution variables in the f5 'Run Script' but no bind variables.
    You can use bind variables in the f9 'Execute Statement' but no substitution statements.
    You can use anonymous PLSQL blocks, and packaged functions and procedures, so you can store per session state in PLSQL packages.
    -Turloch

  • I need a simple script (Break Link To Style)

    Hi nice guys,
    Can someone please provide a simple script that will break the links to styles in all the paragraphs in a document.
    Thanks in advance
    Maria*
    *An non coder designer that simply is not capable of understanding javascript... (but I have tried!)

    Hi Maria,
    Jongware's post (http://forums.adobe.com/message/1890625#1890625) gave me a clue on how to do this.
    Give this a try:
    var i, j, myDoc = app.activeDocument,
              allStories = myDoc.stories,
              thisStory,
              thisPara;
    for (i = 1; i < allStories.length; i++) {
              thisStory = allStories[i];
              for (j = thisStory.paragraphs.length - 1; j >= 0; j--) {
                        thisPara = thisStory.paragraphs[j];
                        thisPara.applyParagraphStyle(myDoc.paragraphStyles[0], false)
    alert ("Job Done!");

  • Simple script in /usr/local/bin just won't start - SOLVED

    I put this really simple script for starting psi into my /usr/local/bin, set it a+xr and added /usr/local/bin to my path. However, I just can't start the damn thing.
    Here's the script itself (I really don't think there's something wrong with it, since if I type it in the shell it works fine):
    #!/bin/zsh/
    #start psi, never stop
    while true;
    do psi;
    done
    Here's my users $PATH:
    ─$ print $PATH
    /bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin:/usr/local/bin:/opt/kde/bin:/opt/mozilla/bin:/opt/qt/bin
    Here's the permissions of the script:
    $ ls -lah /usr/local/bin
    total 4.0K
    drwxr-xr-x 2 root root 80 Dec 15 03:52 ./
    drwxr-xr-x 10 root root 240 Dec 10 18:55 ../
    -rwxrwxr-x 1 kamagurka users 60 Dec 15 03:51 psi.start*
    And here's what happens when I try to execute it:
    $ psi.start
    zsh: command not found: psi.start
    So, I'm either missing something incredibly obvious, or something freaky's going on here. I hope it's the former.
    EDIT: I had no idea where to put this, so I put it into Desktop Env since I'm trying to start a graphical app, but feel free to move it.
    EDIT: Yea, I was being a little dense.

    smoon wrote:Not sure if that's the problem, but try removing the trailing / (slash) from your script's shebang.
    See, something really obvious. Stupid, even. You can see, I don't do a lot of scripting.

  • It only plays back at 6 frames per second

    I applied warp stabilizer, but it only plays back at 6 frames per second.
    There seems no obvious remedy.  Why is this a mystery?  
    Thanks anyone

    You're talking Swahili while the rest of the AE users are talking Chinese.  The result: lousy communication.  It comes from not knowing AE very well at all.  You don't yet know the arcane AE Lingo, so you can't even explain things in ways everyone understands.  Confusion ensues.
    Do EVERYONE -- including yourself -- a big favor.  Go here:
    Getting started with After Effects (CS4, CS5, CS5.5,  CS6, & CC)

  • Bring back the "blur" frame!

    I'd like to request that the Pages developers bring back the "blur" frame that was in the older version of Pages. The blur frame (partnered with the alpha tool) was super versatile for making layouts, and now it's gone...
    Using Pages 5.1 now.

    We are all just end-users like yourself here. To have Apple "hear" you you need to leave feedback for the Pages team using the link in the Pages menu.

Maybe you are looking for

  • Non static variable errors

    I have been working on this file for 4 days now and I can't get past these errors. Here's the whole project: package toysmanager; public class ToysManager { //Method ToysManager public ToysManager() { //Method main public static void main(String[] ar

  • Certain ondemand channels via Vision box using up ...

    His anyone else experienced this possible flaw with the ondemand service on the BT Vision system. I have found that programs watched via iplayer and any channel4 related content seem to deduct usage from my monthly broadband allowance. I have only re

  • Is there a way to restore an accidentally deleted activity log?

    I am soooo embarrassed.  I accidentally deleted the activity log of a phone number I wish to keep.  Is there anyway that I can have that activity restored or is it gone forever?? 

  • Bluetooth headset device embed with HP ProBook 4530s

    Hi there. I want to connect any bluetooth device with my HP ProBook 4530s on windows 7 64 bit.. What will be the proper way to do this? Which device should i buy to acomlish this task? Also, "Artheros" bluetooth drivers are properly installed on my l

  • Cant pair a wireless speaker

    I have a HP Pavilion notebook with windows 8.1 I want to pair with Sony sbsbtx300 wireless speaker with bluetooth. Is it possible? I can't get them to sync.