8 Replies - 1849 Views - Last Post: 16 January 2012 - 06:48 AM

#1 danieldcc  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 32
  • Joined: 05-January 12

Cannot extend Sprite

Posted 15 January 2012 - 08:31 AM

man, I'm getting very frustrated. I have a lab due to create a class that extends Sprite. I started writing code and already run into problems. Why I cannot extend sprite? what is wrong?

import flash.display.Sprite;

public class SpinningBall extends Sprite
{

double cx, cy, speed;


public SpinningBall(double cx, double cy, double speed)
    {
        this.cx = cx;
        this.cy = cy;
        this.speed = speed;
        
    }
    
public void getFillColor()
    {
        
    }
    

}



Is This A Good Question/Topic? 0
  • +

Replies To: Cannot extend Sprite

#2 japanir  Icon User is offline

  • jaVanir
  • member icon

Reputation: 1010
  • View blog
  • Posts: 3,025
  • Joined: 20-August 09

Re: Cannot extend Sprite

Posted 15 January 2012 - 08:35 AM

What do you mean cannot extend Sprite? do you get any error messages?
I'd suggest that you check the Sprite constructor and see if you have to provide parameters.
call super in the first line of code of the derived class (SpinningBall) constructor, and pass it the appropriate parameters.
Was This Post Helpful? 0
  • +
  • -

#3 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Cannot extend Sprite

Posted 15 January 2012 - 08:38 AM

Do you have the right Sprite class? What you've imported is from the ActionScript 3.0 API. Or did you mean javax.microedition.lcdui.game.Sprite?
Was This Post Helpful? 0
  • +
  • -

#4 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2720
  • View blog
  • Posts: 11,448
  • Joined: 20-September 08

Re: Cannot extend Sprite

Posted 15 January 2012 - 08:58 AM

http://technojeeves....free/118-errors
Was This Post Helpful? 0
  • +
  • -

#5 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Cannot extend Sprite

Posted 15 January 2012 - 09:30 AM

View Postdanieldcc, on 15 January 2012 - 10:31 AM, said:

Why I cannot extend sprite? what is wrong?

For political or philosopical reasons or you have an error message ?
Was This Post Helpful? 0
  • +
  • -

#6 danieldcc  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 32
  • Joined: 05-January 12

Re: Cannot extend Sprite

Posted 15 January 2012 - 09:44 AM

View Postpbl, on 15 January 2012 - 09:30 AM, said:

View Postdanieldcc, on 15 January 2012 - 10:31 AM, said:

Why I cannot extend sprite? what is wrong?

For political or philosopical reasons or you have an error message ?



LOL, i get error message package.javax.microedition.lcdui.game does not exist when i try to import import javax.microedition.lcdui.game.Sprite;

and when try to import import flash.display.Sprite; then i get error messaga package flash.display does not exist
Was This Post Helpful? 0
  • +
  • -

#7 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2720
  • View blog
  • Posts: 11,448
  • Joined: 20-September 08

Re: Cannot extend Sprite

Posted 15 January 2012 - 10:24 AM

The jar files containing those classes, or the class files themselves, must be in the classpath in order to import and compile successfully
Was This Post Helpful? 0
  • +
  • -

#8 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10567
  • View blog
  • Posts: 39,113
  • Joined: 27-December 08

Re: Cannot extend Sprite

Posted 15 January 2012 - 03:01 PM

Moved to Mobile Development.

Do you have the Java ME platform setup? These are Java ME, not Java SE tools.

http://java.sun.com/...ge-summary.html
Was This Post Helpful? 0
  • +
  • -

#9 danieldcc  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 32
  • Joined: 05-January 12

Re: Cannot extend Sprite

Posted 16 January 2012 - 06:48 AM

Ok. So, Downloaded the Java ME and installed and still didn't work, but found this easy step by step instructions to make it work. I'm using Eclipse.

http://blogs.oracle....tegrate_java_me

Thanks for all the help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1