Please, someone tell me what's wrong in this code...

My MIDlet can't even start. So I think the problem is on GameCanvas class, 'couse is the only class I've changed before the game don't work. So I'll submit the code and you can see if find the error. Any sugestions will be apreciate.
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
public class GameCanvasClass extends GameCanvas implements Runnable {
   private boolean playing;  
   // TiledLayer.
   private TiledLayer tiledCenary;
   // Layer.
   private LayerManager layer1 = new LayerManager();
   // Sprites.
   private CharacterClass player;
   private CharacterClass[] enemy;
   // Game settings;
   public static int gameLevel = 0;
   public static int numLives = 3;
   public static int numEnemies = 0;
   public static final int NUMBER_LEVELS = 10;
   public static boolean[] doneBuildLevel;
   /** Creates a new instance of GameCanvasClass */
   public GameCanvasClass() throws Exception {
      super(true);
      for(int i = 0; i < 10; i++)
         doneBuildLevel[i] = false;   
      Image image = Image.createImage("/bear.PNG");
      player = new CharacterClass(image, 16, 16, 16, 16);
      System.out.println("Public constructor started.");
   public void start() throws Exception {
      playing = true;
      Thread t = new Thread(this);
      t.start();
      System.out.println("start() method of Thread is on.");
   public void run() {
        try {
           setupGameLevel(gameLevel);
        catch(Exception e) {
           e.printStackTrace();
      Graphics g = getGraphics();
      while(playing == true) {
         drawGameScreen(g);
         checkCollision(numEnemies);
         checkInput();
         moveEnemies(numEnemies);
         try {
            Thread.sleep(15);
         catch(InterruptedException ie) {
   public void stop() {
      playing = false;      
   private void setupGameLevel(int level) throws Exception {
      if( (level == 0) && (doneBuildLevel[level] == false) ) {
         // Building cenary for the first level.
         tiledCenary = TiledLayerClass.buildTiledCenary(gameLevel);
         // Append to the layer.
         layer1.append(tiledCenary);
         layer1.append(player);
         doneBuildLevel[level] = true;
         numEnemies = 4;   // Setup 4 enemies for the first level.
         for(int i = 0; i < numEnemies; i++) {
            Image imagem = Image.createImage("/enemy1.PNG");  
            enemy[i] = new CharacterClass(imagem, 16, 16, 160, 32);
            layer1.append(enemy);
/* TODO
Change manually positions of all enemies,
since they start at the same position.
private void checkInput() {
int keyState = getKeyStates();
if(((keyState & UP_PRESSED) != 0) && (player.getPosY() > 16)) {
player.setLastPosY(player.getPosY());
player.setPosY(player.getPosY() - 1);
if(((keyState & DOWN_PRESSED) != 0) && (player.getPosY() < 208)) {
player.setLastPosY(player.getPosY());
player.setPosY(player.getPosY() + 1);
if(((keyState & RIGHT_PRESSED) != 0) && (player.getPosX() < 208)) {
player.setLastPosX(player.getPosX());
player.setPosX(player.getPosX() + 1);
if(((keyState & LEFT_PRESSED) != 0) && (player.getPosX() > 16)) {
player.setLastPosX(player.getPosX());
player.setPosX(player.getPosX() - 1);
/* Check collision of player against cenary, enemies, itens. Also check collision of all enemies against cenary.
Method must receive the number of enemies on the current level. */
private void checkCollision(int numberEnemies) {
if(player.collidesWith(tiledCenary, true)) {
player.setPosX(player.getLastPosX());
player.setPosY(player.getLastPosY());
for(int i = 0; i < numberEnemies; i++)
if(enemy[i].collidesWith(tiledCenary, true)) {
enemy[i].setPosX(enemy[i].getLastPosX());
enemy[i].setPosY(enemy[i].getLastPosY());
private void moveEnemies(int numberEnemies) {
for(int i = 0; i < numberEnemies; i++) {
if(enemy[i].getPosX() < 208) {
enemy[i].setLastPosX(enemy[i].getPosX());
enemy[i].setPosX(enemy[i].getPosX() + 1);
if(enemy[i].getPosX() > 16) {
enemy[i].setLastPosX(enemy[i].getPosX());
enemy[i].setPosX(enemy[i].getPosX() - 1);
private void drawGameScreen(Graphics g) {
g.fillRect(0, 0, 256, 256);
player.setPosition(player.getPosX(), player.getPosY());
for(int i = 0; i < numEnemies; i++)
enemy[i].setPosition(enemy[i].getPosX(), enemy[i].getPosY());
layer1.setViewWindow(player.getPosX() - 32, player.getPosY() - 32, 128, 110);
layer1.paint(g, 0, 0);
g.setColor(0, 0, 0);
flushGraphics();

Hi,
One thing that stroke me when I read your code is that you never allocate arrays
replace
private CharacterClass[] enemy;by
private CharacterClass[] enemy = new CharacterClass[MAX_ENEMIES];and
public static boolean[] doneBuildLevel;by
public static boolean[] doneBuildLevel = new boolean[NUMBER_LEVELS];Hope that help,
Jack

Similar Messages

  • Please can someone tell me what's wrong in this code

    1var a=0;
    2function main(){
    3var inFolder = Folder.selectDialog("Please select folder to process");
    4//Save the Current Preferences
    5var startRulerUnits = preferences.rulerUnits;
    6preferences.rulerUnits = Units.PIXELS;
    7//Get all the files in the folder
    8var filelist=inFolder.getFiles()
    9n=filelist.length;
    10//Open each file
    11for(a=0; a<n; a++){
    12// The fileList is folders and files so open only files
    13if (fileList[a] instanceof File) {
    14open(fileList[i])
    15var docName = app.activeDocument.name;
    16app.activeDocument.flatten();
    17activedocument.save();
    18}
    19}
    20}
    21main();
    Says the error is "filelist is not recognized".    on line 14.   I thought I had fully defined 'filelist' on line8
    I thought filelist was a one-D array variable.
    Peterkal

    Also, in lines 8 and 9 you use a variable called "filelist" but in lines 13 and 14 you call it "fileList" (notice the capital-L).
    JavaScript is case-sensitive, so you must be consistent with your variable names throughout.

  • Can someone tell me what's wrong with this code....

    I apologize in advance for anyone who isn't a Steelers fan...
    import java.awt.*;
    import javax.swing.*;
    public class myJPanel extends JPanel
         public myJPanel()
              setBackground(Color.white);
         JLabel label1 = new JLabel();
         label1.setText("Ben Roethlisberger #7 Age 23");
         add(label1);
         JButton jb1;
         ImageIcon imageBen = new ImageIcon("Ben.JPG");
         jb1 = new JButton(imageBen);
         add(jb1);
         JLabel label3 = new JLabel();
         label3.setText(whatIsUp());
         add(label3);
         for(i=0;i<20;i++)
         String whatIsUp()
              int n = 0;
              double nn = 0;
              String b = "......";
              nn = (Math.random() * 6);
              n = (int)nn;
              if (n == 0)
                   b = "Ben Roethlisberger throws a touchdown pass to Hines Ward.";
                   JButton jb2;
              ImageIcon imageHines = new ImageIcon("Hines.jpg");
              jb2 = new JButton(imageHines);
              add(jb2);
              if (n == 1) b = "Ben Roethlisberger throws a touchdown pass to Antwaan Randle El.";
              if (n == 2) b = "Ben Roethlisberger throws a touchdown pass to Heath Miller.";
              if (n == 3) b = "Ben Roethlisberger throws a touchdown pass to Cedrick Wilson.";
              if (n == 4) b = "Ben Roethlisberger throws a touchdown pass to Jerame Tuman.";
              if (n == 5) b = "Ben Roethlisberger hands off to Jerome Bettis for a touchdown.";
              return b;
    Everything is ok if i take the for loop out, but for some reason everything just gets screwed up if I have that for loop in there. And these are the error messages I'm getting.
    'illegal start of type (line 21)' and '<identifier> expected (line 48)'
    Thanks in advance for your help...

    Hey I'm sorry but this is only my second week doing
    Java. Do you think you could explain that more or
    give me an example??
    Bad Version (like yours but simplified)
    public class Sample{
      public static void main(String args[]){
        for(int i=0;i<20;i++){
          String whatIsUp(){
             return "Doc";
          System.out.println(?);// I am not even sure how to write this voodoo part
    }Good Version
    public class Sample{
      public static void main(String args[]){
        for(int i=0;i<20;i++){
          String aString = whatIsUp();
          System.out.println(aString);
      String whatIsUp(){
        return "Doc";
    }

  • Can someone tell me what's wrong with this LOV query please?

    This query works fine..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = 'ADAM'
    But this one..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = apex_application.g_user
    Gives the following error.
    1 error has occurred
    * LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    Thanks very much,
    -Adam vonNieda

    Ya know, I still don't know what's wrong with this.
    declare
    l_val varchar2(100) := nvl(apex_application.g_user,'ADAM');
    begin
    return 'select filter_name display_value, filter_id return_value
    from otmgui_filter where username = '''|| l_val || '''';
    end;
    Gets the same error as above. All I'm trying to do is create a dropdown LOV which selects based on the apex_application.g_user.
    What am I missing here?
    Thanks,
    -Adam

  • Can someone tell me what's wrong with this method

    public boolean drop(int col, int piece) {
              if (isLegalMove(col)) {
                   for (int r = 0; r < getNumRows(); r++) {
                        if (mySpaces[r][col] == EMPTY) {
                             mySpaces[r][col] = piece;
                             return true;
              } else
                   return false;
         }it always asks that I need to return something, what should I do??

    public boolean drop(int col, int piece) {
        if (isLegalMove(col)) {
            for (int r = 0; r < getNumRows(); r++) {
              if (mySpaces[r][col] == EMPTY) {
                mySpaces[r][col] = piece;
                return true;
        } //else <--- remove the else
        return false;
    }

  • Could you tell me what is wrong with this code?

    import java.io.*;
    import java.lang.String;
    import java.util.*;
    import java.util.Properties;
    import java.io.InputStream;
    public class EStoreClient2 {
    private void insertTable (Vector value) {
         insertStmnt.setString(1, (String)value.get(0)
    public void static main (String args[]) {
         Vector argument = new Vector();
         if (args.length > 0) {
              for (int i=1; i < args.length; i++) {
                   argument.add(args);
                   System.out.println("<argument[]> = " + args[i]);
              EStoreClient2 estore = new EStoreClient2();
              if (args[0].equalsIgnoreCase("-insertitem"))
              estore.insertTable(argument);
    but it gives me
    EStoreClient2.java:18: Method get(int) not found in class
    java.util.Vector.
    insertStmnt.setString(1, (String)value.get(0));

    EStoreClient2.java:18: Method get(int) not found in
    class
    java.util.Vector.
    insertStmnt.setString(1,
    nsertStmnt.setString(1, (String)value.get(0));The method get(int) was introduced into the Vector class starting at JDK1.2. You must be using an earlier version of the JDK.

  • What is wrong with this code? on(release) gotoAndPlay("2")'{'

    Please could someone tell me what is wrong with this code - on(release)
    gotoAndPlay("2")'{'
    this is the error that comes up and i have tried changing it but it is not working
    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 2: '{' expected
         gotoAndPlay("2")'{'
    Total ActionScript Errors: 1 Reported Errors: 1
    Thanks

    If you have a frame labelled "2" then it should be:
    on (release) {
        this._parent.gotoAndPlay("2");
    or other wise just the following to go to frame 2:
    on (release) {
         this._parent.gotoAndPlay(2);
    You just had a missing curly bracket...

  • I can't figure out what's wrong with this code

    First i want this program to allow me to enter a number with the EasyReader class and depending on the number entered it will show that specific line of this peom:
    One two buckle your shoe
    Three four shut the door
    Five six pick up sticks
    Seven eight lay them straight
    Nine ten this is the end.
    The error message i got was an illegal start of expression. I can't figure out why it is giving me this error because i have if (n = 1) || (n = 2) statements. My code is:
    public class PoemSeventeen
    public static void main(String[] args)
    EasyReader console = new EasyReader();
    System.out.println("Enter a number for the poem (0 to quit): ");
    int n = console.readInt();
    if (n = 1) || (n = 2)
    System.out.println("One, two, buckle your shoe");
    else if (n = 3) || (n = 4)
    System.out.println("Three, four, shut the door");
    else if (n = 5) || (n = 6)
    System.out.println("Five, six, pick up sticks");
    else if (n = 7) || (n = 8)
    System.out.println("Seven, eight, lay them straight");
    else if (n = 9) || (n = 10)
    System.out.println("Nine, ten, this is the end");
    else if (n = 0)
    System.out.println("You may exit now");
    else
    System.out.println("Put in a number between 0 and 10");
    I messed around with a few other thing because i had some weird errors before but now i have narrowed it down to just this 1 error.
    The EasyReader class code:
    // package com.skylit.io;
    import java.io.*;
    * @author Gary Litvin
    * @version 1.2, 5/30/02
    * Written as part of
    * <i>Java Methods: An Introduction to Object-Oriented Programming</i>
    * (Skylight Publishing 2001, ISBN 0-9654853-7-4)
    * and
    * <i>Java Methods AB: Data Structures</i>
    * (Skylight Publishing 2003, ISBN 0-9654853-1-5)
    * EasyReader provides simple methods for reading the console and
    * for opening and reading text files. All exceptions are handled
    * inside the class and are hidden from the user.
    * <xmp>
    * Example:
    * =======
    * EasyReader console = new EasyReader();
    * System.out.print("Enter input file name: ");
    * String fileName = console.readLine();
    * EasyReader inFile = new EasyReader(fileName);
    * if (inFile.bad())
    * System.err.println("Can't open " + fileName);
    * System.exit(1);
    * String firstLine = inFile.readLine();
    * if (!inFile.eof()) // or: if (firstLine != null)
    * System.out.println("The first line is : " + firstLine);
    * System.out.print("Enter the maximum number of integers to read: ");
    * int maxCount = console.readInt();
    * int k, count = 0;
    * while (count < maxCount && !inFile.eof())
    * k = inFile.readInt();
    * if (!inFile.eof())
    * // process or store this number
    * count++;
    * inFile.close(); // optional
    * System.out.println(count + " numbers read");
    * </xmp>
    public class EasyReader
    protected String myFileName;
    protected BufferedReader myInFile;
    protected int myErrorFlags = 0;
    protected static final int OPENERROR = 0x0001;
    protected static final int CLOSEERROR = 0x0002;
    protected static final int READERROR = 0x0004;
    protected static final int EOF = 0x0100;
    * Constructor. Prepares console (System.in) for reading
    public EasyReader()
    myFileName = null;
    myErrorFlags = 0;
    myInFile = new BufferedReader(
    new InputStreamReader(System.in), 128);
    * Constructor. opens a file for reading
    * @param fileName the name or pathname of the file
    public EasyReader(String fileName)
    myFileName = fileName;
    myErrorFlags = 0;
    try
    myInFile = new BufferedReader(new FileReader(fileName), 1024);
    catch (FileNotFoundException e)
    myErrorFlags |= OPENERROR;
    myFileName = null;
    * Closes the file
    public void close()
    if (myFileName == null)
    return;
    try
    myInFile.close();
    catch (IOException e)
    System.err.println("Error closing " + myFileName + "\n");
    myErrorFlags |= CLOSEERROR;
    * Checks the status of the file
    * @return true if en error occurred opening or reading the file,
    * false otherwise
    public boolean bad()
    return myErrorFlags != 0;
    * Checks the EOF status of the file
    * @return true if EOF was encountered in the previous read
    * operation, false otherwise
    public boolean eof()
    return (myErrorFlags & EOF) != 0;
    private boolean ready() throws IOException
    return myFileName == null || myInFile.ready();
    * Reads the next character from a file (any character including
    * a space or a newline character).
    * @return character read or <code>null</code> character
    * (Unicode 0) if trying to read beyond the EOF
    public char readChar()
    char ch = '\u0000';
    try
    if (ready())
    ch = (char)myInFile.read();
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    if (ch == '\u0000')
    myErrorFlags |= EOF;
    return ch;
    * Reads from the current position in the file up to and including
    * the next newline character. The newline character is thrown away
    * @return the read string (excluding the newline character) or
    * null if trying to read beyond the EOF
    public String readLine()
    String s = null;
    try
    s = myInFile.readLine();
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    if (s == null)
    myErrorFlags |= EOF;
    return s;
    * Skips whitespace and reads the next word (a string of consecutive
    * non-whitespace characters (up to but excluding the next space,
    * newline, etc.)
    * @return the read string or null if trying to read beyond the EOF
    public String readWord()
    StringBuffer buffer = new StringBuffer(128);
    char ch = ' ';
    int count = 0;
    String s = null;
    try
    while (ready() && Character.isWhitespace(ch))
    ch = (char)myInFile.read();
    while (ready() && !Character.isWhitespace(ch))
    count++;
    buffer.append(ch);
    myInFile.mark(1);
    ch = (char)myInFile.read();
    if (count > 0)
    myInFile.reset();
    s = buffer.toString();
    else
    myErrorFlags |= EOF;
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    return s;
    * Reads the next integer (without validating its format)
    * @return the integer read or 0 if trying to read beyond the EOF
    public int readInt()
    String s = readWord();
    if (s != null)
    return Integer.parseInt(s);
    else
    return 0;
    * Reads the next double (without validating its format)
    * @return the number read or 0 if trying to read beyond the EOF
    public double readDouble()
    String s = readWord();
    if (s != null)
    return Double.parseDouble(s);
    // in Java 1, use: return Double.valueOf(s).doubleValue();
    else
    return 0.0;
    Can anybody please tell me what's wrong with this code? Thanks

    String[] message = {
        "One, two, buckle your shoe",
        "One, two, buckle your shoe",
        "Three, four, shut the door",
        "Three, four, shut the door",
        "Five, six, pick up sticks",
        "Five, six, pick up sticks",
        "Seven, eight, lay them straight",
        "Seven, eight, lay them straight",
        "Nine, ten, this is the end",
        "Nine, ten, this is the end"
    if(n>0)
        System.out.println(message[n]);
    else
        System.exit(0);

  • Whenever i try to login with my apple ID , it says this ID is not yet used on itunes. & because of this i can't even download apps. Please someone tell me what should i do ? ASAP.

    Whenever i try to login with my apple ID , it says this ID is not yet used on itunes. & because of this i can't even download apps. Please someone tell me what should i do ? ASAP.

    Read here:
    http://support.apple.com/kb/ht2589

  • What is wrong in this code..please

    first of all,i kindly request team please not kill me by giving suggestion using xml parser.......can u please tell how this handle in reading follwing lines....
    orderREF="1036578"><edm:OrderItem><edm:Order orderID="1036579"/> ineed to retoeve value 1036578 i use following code
    final String START6_TAG="orderREF=";
    final String END6_TAG=">";
    final String END7_TAG="/>";
    as per my observation,the follwing code need not work
    if(line.indexOf(START6_TAG)> -1 ) {
    //this code handle "orderREF=" in stands for order id
    if(line.indexOf(END7_TAG,line.indexOf(START6_TAG))>-1){ //because if we use line.indexOf(END7_TAG)it take only first indexof that..
    efound9=false;
    asper above line this code cannot excecute.but igo to loop and set flag efound9=false, what is wrong in this code for handling
    orderREF="1036578"/><edm:OrderItem><edm:Order orderID="1036579"/> this type of line that also comes in same program,here also we need output as 1036578.please tell me what i will do to hanndle these

    first of all,i kindly request team please not kill
    me by giving suggestion using xml parser.......can u
    please tell how this handle in reading follwing
    lines.... I don't understand why you are so opposed to an xml parser. You could have spent 3 hours learning how to use it and been done with this problem in the time you've spent trying to hack your way around it.
    jdom tutorials: http://www.jdom.org/downloads/docs.html
    dom4j tutorials: http://www.dom4j.org/cookbook.html

  • What's wrong with this code (in recursion there may be a problem )

    // ELEMENTS OF TWO VECTORS ARE COMPARED HERE
    // CHECK WHAT IS WRONG WITH THIS PGM
    // there may be a problem in recursion
    import java.util.*;
    class Test
    Vector phy,db;
    public static void main(String adf[])
         Vector pp1=new Vector();
         Vector dp1=new Vector();
         //adding elements to the vector
         pp1.add("1");
         pp1.add("a");
         pp1.add("b");
         pp1.add("h");
         pp1.add("c");
         dp1.add("q");
         dp1.add("c");
         dp1.add("h");
         dp1.add("w");
         dp1.add("t");
         printVector(dp1);
         printVector(pp1);
         check2Vectors(pp1,dp1);
    public static void printVector(Vector v1)
         System.out.println("Vector size "+v1.size());
         for(int i=0;i<v1.size();i++)
              System.out.println(v1.get(i).toString());
    public static void check2Vectors(Vector p,Vector d)
         System.out.println("p.size() "+p.size()+" d.size() "+d.size());
         printVector(p);
         printVector(d);
         for(int i=0;i<p.size();i++)
                   for(int j=0;j<d.size();j++)
                        System.out.println(" i= "+i+" j= "+j);
                        Object s1=p.elementAt(i);
                        Object s2=d.elementAt(j);
              System.out.println("Checking "+s1+" and "+s2);
                        if(s1.equals(s2))
    System.out.println("Equal and Removing "+s1+" and "+s2);
                             p.remove(i);
                             d.remove(j);
                             printVector(p);
                             printVector(d);                    
                        check2Vectors(p,d);
                   }//inner for
              }//outer for     
    if(p.size()==0||d.size()==0)
    System.out.println("Vector checking finished and both match");
    else
    System.out.println("Vector checking finished and both do not match");
    }//method
    }

    hi,
    but the upper limit is changing everytime you call the function recursively
    so there should not be any problem(i suppose)
    my intension is to get the unmatched elements of the two vectors
    suggest me changes and thanks in advancce
    ashok
    The problems comes from the fact that you remove
    elements for a Vector while iterating in a loop where
    the upper limit as been set to the initial size of the
    Vector.
    You should use so while loops with flexible stop
    conditions that would work when the size of the Vector
    changes.
    Finally: why don't you use Vector.equals() ?

  • Someone who is good with CSS-P tell me what is wrong with this?

    I'm doing a remake of my current site but this time I'm going
    to do it
    COMPLETLEY tabless and use CSS-P. So far I'm doing great but
    there is one
    thing I can't figure out for the life of me...
    http://verticalterrain.com/Templates/main.dwt
    Check out my template I'm building there and someone tell me
    why in god's
    name is the "About Us" button on a totally seperate line. If
    you view my
    source code there is no <br /> or anything like that.
    Anyone have any
    ideas?
    Best Regards,
    Chris Jumonville
    iMedia Web Design
    503.277.3553

    On Fri, 10 Nov 2006 11:48:55 +0100, A.Translator
    <[email protected]> wrote:
    >You are asking about CSS-P but only show your html.
    >Makes it hard to tell what is going on.
    The link is in the template!
    http://verticalterrain.com/style.css
    Steve
    steve at flyingtigerwebdesign dot com

  • Somebody tell me what is wrong with this statement

    CLEAR: V_NETPR.
    COMPUTE V_NETPR =  ZZ_LS_KUMU-NETWR / ZZ_LS_KUMU-BASMENG.
    ZZ_LS_KUMU-NETWR:       362000.00
    ZZ_LS_KUMU-BASMENG:      960000.000
    and the result is V_NETPR:            0.00
    Please let me know what should i do to get the value

    Hi Suresh,
    Hmm. I tried:
    *&      Form  any
    FORM any .
      DATA:
        netwr LIKE vbap-netwr VALUE '362000.00',
        basmeng LIKE vbap-kwmeng VALUE '960000.000',
        v_netpr TYPE netwr.
      v_netpr = netwr / basmeng.
      WRITE: v_netpr.
    ENDFORM.                    " any
    and I got
                    0,38
    [my pocket calculator says 0.3770833]
    with fiexd point arithmetic switched on - which is in fact switched off for SAPMV45A.
    The you get 0,00 - OOPS
    But without fixed-point arithmetics you can do like this:
    *&      Form  any
    FORM any .
      DATA:
        netwr LIKE vbap-netwr VALUE '362000.00',
        basmeng LIKE vbap-kwmeng VALUE '960000.000',
        v_netpr TYPE netwr,
        f type f.
      f = netwr * 10000 / basmeng.
      v_netpr = f.
      divide v_netpr by 10.
      WRITE: v_netpr.
    ENDFORM.                    " any
    and get 0,38 as expected.
    Regards,
    Clemens

  • FB4 doesn't tell me what's wrong with my code. Not even letting me trace().

    Attached is my code that run well but the problem is, I know there is something wrong with my code since the dropdown list isn't populated unlike the textarea. Doesn't even put anything on the output panel when i do trace()-ing.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/halo"
    creationComplete="application1_initializeHandler(event)">
    <s:layout>
    <s:BasicLayout/>
    </s:layout>
    <fx:Script>
    <![CDATA[
    import mx.events.FlexEvent;
    protected function application1_initializeHandler(event:FlexEvent):void
    var xml:XML;
    var xmlLoader:URLLoader = new URLLoader();
    xmlLoader.load(new URLRequest('data/places.xml'));
    xmlLoader.addEventListener(
    Event.COMPLETE,
    function (e:Event):void {
    xml = new XML(e.target.data);
    trace(xml.place[0].barangay.descendants().toXMLString());
    for each (var pro:Object in xml.places.place)
    dp.dataProvider.addItem({province:pro.province});
    ta.text = xml.place[0].barangay.descendants().toXMLString();
    ]]>
    </fx:Script>
    <s:DropDownList id="dp"
    labelField="province"
    width="197"
    x="10" y="10"/>
    <s:TextArea x="198" y="186" id="ta" editable="true"/>
    </s:Application>

    @jdesko:
    i tried both with or w/o the nightly builds, still i can't see anything on the output panel using trace and the above code doesn't trigger the Error Panel why the dropdown list isn't populated..
    @Jason: thanks. the prob was with my e4x expression but with the console output thingy, now i run in debug mode but got the error:
    C:\Windows\System32\Macromed\Flash\NPSWF32.dll
    Flash Builder cannot locate the required debugger version of Adobe Flash Player. You might need to install the debugger version of the Flash Player or reinstall Flash Builder.
    Do you want to try to debug with the current version?
    I thought FB4 has this already in the package. I'm wondering why it asks for like this.

  • What's wrong with this code (AS3)?

    I want to publish a live stream and, when a button is pressed, publish the same stream for vod.  I haven't been able to get an answer as to whether I can do this...my code is below.  Can someone please tell me if I can do this, or what may be wrong with my code?
    The live stream and playback works fine; but the recording doesn't start.  Also, I want other objects on the client, such as the current camera and audio information, and the aspect ratio being used.  I havent' been able to get these to show up (i.e., the incomingLbl and outgoingLbl do not show up).
    Thank you,
    Phillip A
    My code:
    package {
        import flash.display.MovieClip;
        import flash.net.NetConnection;
        import flash.events.NetStatusEvent; 
        import flash.events.MouseEvent;
        import flash.events.AsyncErrorEvent;
        import flash.net.NetStream;
        import flash.media.Video;
        import flash.media.Camera;
        import flash.media.Microphone;
        import fl.controls.Button;
        import fl.controls.Label;
        import fl.controls.TextArea;
        import fl.controls.CheckBox;
        public class vodcast1 extends MovieClip {
            private var nc:NetConnection;
            private var nc2:NetConnection;
            private var ns:NetStream;
            private var ns2:NetStream;
            private var nsPlayer:NetStream;
            private var vid:Video;
            private var vidPlayer:Video;
            private var cam:Camera;
            private var mic:Microphone;
            private var camr:Camera;
            private var micr:Microphone;
            private var clearBtn:Button;
            private var startRecordBtn:Button;
            private var outgoingLbl:Label;
            private var incomingLbl:Label;
            private var myMetadata:Object;
            private var outputWindow:TextArea;
            private var cb1:CheckBox;
            public function vodcast1(){
                setupUI();
                nc = new NetConnection();
                nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
                nc.connect("rtmp://localhost/publishLive");
                nc2 = new NetConnection();
                nc2.connect("rtmp://localhost/vod/videos");
                nc2.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus2);
            private function startRecordHandler(event:MouseEvent):void {
                publishRecordStream();
            private function onNetStatus(event:NetStatusEvent):void {
                trace(event.target + ": " + event.info.code);
                switch (event.info.code)
                    case "NetConnection.Connect.Success":
                        trace("Congratulations! you're connected to live");
                        publishCamera();
                        displayPublishingVideo();
                        displayPlaybackVideo();
                        break;
                    case "NetStream.Publish.Start":
            // NetStatus handler for Record stream       
            private function onNetStatus2(event:NetStatusEvent):void {
                trace(event.target + ": " + event.info.code);
                switch (event.info.code)
                    case "NetConnection.Connect.Success":
                        trace("Congratulations! you're connected to vod");                   
                        break;
                    case "NetConnection.Connect.Rejected":
                    case "NetConnection.Connect.Failed":
                    trace ("Oops! the connection was rejected");
                        break;
                    case "NetStream.Publish.Start":
                        sendMetadata();
                        break;
            private function asyncErrorHandler(event:AsyncErrorEvent):void {
                trace(event.text);
            private function sendMetadata():void {
                trace("sendMetaData() called")
                myMetadata = new Object();
                myMetadata.customProp = "Recording in progress";
                ns.send("@setDataFrame", "onMetaData", myMetadata);
            private function publishRecordStream():void {
                camr = Camera.getCamera();
                micr = Microphone.getMicrophone();
                ns2 = new NetStream(nc2);
                ns2.client = new Object();
                ns2.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus2);
                ns2.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
                ns2.attachCamera(camr);
                ns2.attachAudio(micr);
                ns2.publish("vodstream", "record");           
            private function publishCamera():void {
                cam = Camera.getCamera();
                mic = Microphone.getMicrophone();
                ns = new NetStream(nc);
                ns.client = this;
                ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
                ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
                ns.attachCamera(cam);
                ns.attachAudio(mic);
                ns.publish("livestream", "live");
            private function displayPublishingVideo():void {
                vid = new Video(cam.width, cam.height);
                vid.x = 10;
                vid.y = 30;
                vid.attachCamera(cam);
                addChild(vid); 
            private function displayPlaybackVideo():void {
                nsPlayer = new NetStream(nc);
                nsPlayer.client = this;
                nsPlayer.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
                nsPlayer.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
                nsPlayer.play("livestream");
                vidPlayer = new Video(cam.width, cam.height);
                vidPlayer.x = cam.width + 100;
                vidPlayer.y = 30;
                vidPlayer.attachNetStream(nsPlayer);
                addChild(vidPlayer);
            private function setupUI():void {
                outputWindow = new TextArea();
                outputWindow.move(250, 175);
                outputWindow.width = 200;
                outputWindow.height = 50;
                outgoingLbl = new Label();
                incomingLbl = new Label();
                outgoingLbl.width = 100;
                incomingLbl.width = 100;
                outgoingLbl.text = "Publishing Stream";
                incomingLbl.text = "Playback Stream";
                outgoingLbl.move(20, 200);
                incomingLbl.move(300, 200);
                outgoingLbl.condenseWhite = true;
                incomingLbl.condenseWhite = true;
                startRecordBtn = new Button();
                startRecordBtn.width = 150;
                startRecordBtn.move(250, 345);
                startRecordBtn.label = "Start Recording";
                startRecordBtn.addEventListener(MouseEvent.CLICK, startRecordHandler);
                //cb1 = new CheckBox();
                //cb1.label = "Record";
                //cb1.move(135,300);
                //cb1.addEventListener(MouseEvent.CLICK,publishRecordStream);
                //clearBtn = new Button();
    //            clearBtn.width = 100;
    //            clearBtn.move(135,345);
    //            clearBtn.label = "Clear Metadata";
    //            clearBtn.addEventListener(MouseEvent.CLICK, clearHandler);
                addChild(outgoingLbl);
                addChild(incomingLbl);
    //            addChild(clearBtn);
                addChild(startRecordBtn);
    //            addChild(cb1);
                addChild(outputWindow);
            public function onMetaData(info:Object):void {
                outputWindow.appendText(info.customProp);

    use event.currentTarget (and you don't need to repeatedly define the same function):
    var c:int;
    var buttonName:String;
    for (c = 1;c < 5;c++) {
         buttonNum = "button"+c;
         this[buttonNum].addEventListener(MouseEvent.MOUSE_DOWN, pressStepButton);
    function pressStepButton(event:MouseEvent) {          trace(event.currentTarget,event.currentTarget.name);     }

Maybe you are looking for

  • IPhone 5 Voice Control issues

    My Voice Control comes on uncontrollably, rings people without me asking it to and then the phone has what can only be described as a moment! Is my phone faulty or can I sort this manually?

  • Action recordable CS SDK panel

    Hello, I'm trying to set up a demo project where a CS SDK panel triggered script leaves a trace in the Actions palette (i.e. is recordable). I've been successfully building a regular, recordable script appearing in the Filter's menu following this pa

  • IPhone mute bell randomly flashing on and off.

    I have an iPhone 3gs and the mute bell picture keeps randomly flashing on and off the screen. Doesn't affect calls but is very annoying. Only been doing it since IOS 5.0.1 update. It doesn't have a set pattern but is doing it more and more each day.

  • Unable to find partner function for SPL screening

    Hi Guys We are trying out the SPL functionality for our Client, We are in the Preliminary stages and have just started the Intial Configuration The problem comes is the Document in ECC is getting blocked and is working as per functionality But when i

  • Flash isn't allowing a game to start

    I recently bought the game "Wik," and once I put in the CD and try to open it to install, I keep getting this error message saying "this program requires flash.ocx, which is no longer included in this version of windows." (I have Windows Vista.) So I