Problem with jeash.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with jeash.

Felipe
I am trying to work on a simple object oriented jeash project, I have the Main.hx and a MyObj.hx

on Main.hx I try to use MyObj:

var obj:MyObj;

public function new()
{
super();
obj = new MyObj();
}

And this keeps giving me this error: 

src/Main.hx:27: characters 15-16 : Unexpected ;

I don't understand why is it unexpected ; 

I hope someone can help me.

Thanks!

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with jeash.

rammserker
Where is the error? What's the line 27?

Max
0 1 0 | 0 0 1 | 1 1 1



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with jeash.

rammserker
What I mean is that where is placed the error? If your code is in the form:

[Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]

class Main extends [some-other-class]
{

var obj : MyObj;

public function new () {
   super ();
   obj = new MyObj ();
} // new ()

} // class Main

[Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]

it's ok. I don't see any error. That's why I ask what's the line 27 (Where the error is located). That error is very common if you don't close the before line properly, with an ";"

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with jeash.

Felipe
Line 27 has this:

var obj:miObjs;

this is Main.hx :

package ;

import jeash.display.Bitmap;
import jeash.display.BitmapData;
import jeash.display.Sprite;
import jeash.geom.Point;
import jeash.geom.Rectangle;
import jeash.Lib;
import jeash.utils.Timer;
import jeash.events.TimerEvent;

/**
 * ...
 * @author Felipe Alfonso
 */

class Main extends Sprite
{
private var canvas:BitmapData;
private var b:Bitmap;
private var bg:BitmapData;
private var cRect:Rectangle;
private var cPoint:Point;
private var _timer:Timer;
var obj:miObjs;
public function new()
{
super();
canvas = new BitmapData(640, 480, false, 0x5a5a5a);
bg = new BitmapData(640, 480, false, 0x5a5a5a);
cRect = new Rectangle(0, 0, 640, 480);
cPoint = new Point(0, 0);
b = new Bitmap(canvas);
obj = new miObjs();
addChild(b);
_timer = new Timer(33);
_timer.addEventListener(TimerEvent.TIMER, loop);
_timer.start();
}
public function loop(e:TimerEvent)
{
canvas.lock();
canvas.copyPixels(bg, cRect, cPoint);
render();
canvas.unlock();
}
public function render()
{
obj.loop();
canvas.copyPixels(obj.bd, obj.rect, obj.point);
}
static function main() 
{
Lib.current.addChild(new Main());
}
}

2011/9/13 Maximiliano Fernández <[hidden email]>
What I mean is that where is placed the error? If your code is in the form:

[Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]

class Main extends [some-other-class]
{

var obj : MyObj;

public function new () {
   super ();
   obj = new MyObj ();
} // new ()

} // class Main

[Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]

it's ok. I don't see any error. That's why I ask what's the line 27 (Where the error is located). That error is very common if you don't close the before line properly, with an ";"

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with jeash.

Jan_Flanders


On Wed, Sep 14, 2011 at 4:14 PM, Felipe <[hidden email]> wrote:
Line 27 has this:

var obj:miObjs;
obj = new miObjs();

Type identifiers need to start with upper case: http://haxe.org/ref/basic?lang=en

Jan

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with jeash.

clemos
In reply to this post by Felipe
Hi

AFAIK all haXe types should begin with an uppercase letter, so I guess
the compiler is not happy with this "miObjs" type.
The error message is not very clear though.

Cheers,
Clément

On Wed, Sep 14, 2011 at 4:14 PM, Felipe <[hidden email]> wrote:

> Line 27 has this:
> var obj:miObjs;
> this is Main.hx :
> package ;
> import jeash.display.Bitmap;
> import jeash.display.BitmapData;
> import jeash.display.Sprite;
> import jeash.geom.Point;
> import jeash.geom.Rectangle;
> import jeash.Lib;
> import jeash.utils.Timer;
> import jeash.events.TimerEvent;
> /**
>  * ...
>  * @author Felipe Alfonso
>  */
> class Main extends Sprite
> {
> private var canvas:BitmapData;
> private var b:Bitmap;
> private var bg:BitmapData;
> private var cRect:Rectangle;
> private var cPoint:Point;
> private var _timer:Timer;
> var obj:miObjs;
> public function new()
> {
> super();
> canvas = new BitmapData(640, 480, false, 0x5a5a5a);
> bg = new BitmapData(640, 480, false, 0x5a5a5a);
> cRect = new Rectangle(0, 0, 640, 480);
> cPoint = new Point(0, 0);
> b = new Bitmap(canvas);
> obj = new miObjs();
> addChild(b);
> _timer = new Timer(33);
> _timer.addEventListener(TimerEvent.TIMER, loop);
> _timer.start();
> }
> public function loop(e:TimerEvent)
> {
> canvas.lock();
> canvas.copyPixels(bg, cRect, cPoint);
> render();
> canvas.unlock();
> }
> public function render()
> {
> obj.loop();
> canvas.copyPixels(obj.bd, obj.rect, obj.point);
> }
> static function main()
> {
> Lib.current.addChild(new Main());
> }
> }
> 2011/9/13 Maximiliano Fernández <[hidden email]>
>>
>> What I mean is that where is placed the error? If your code is in the
>> form:
>>
>> [Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]
>>
>> class Main extends [some-other-class]
>> {
>> var obj : MyObj;
>>
>> public function new () {
>>    super ();
>>    obj = new MyObj ();
>> } // new ()
>>
>> } // class Main
>>
>> [Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]
>>
>> it's ok. I don't see any error. That's why I ask what's the line 27 (Where
>> the error is located). That error is very common if you don't close the
>> before line properly, with an ";"
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with jeash.

Viktor Hesselbom-2
In reply to this post by Felipe
What is miObjs? As far as I know a class name has to start with a capital letter.

2011/9/14 Felipe <[hidden email]>
Line 27 has this:

var obj:miObjs;

this is Main.hx :

package ;

import jeash.display.Bitmap;
import jeash.display.BitmapData;
import jeash.display.Sprite;
import jeash.geom.Point;
import jeash.geom.Rectangle;
import jeash.Lib;
import jeash.utils.Timer;
import jeash.events.TimerEvent;

/**
 * ...
 * @author Felipe Alfonso
 */

class Main extends Sprite
{
private var canvas:BitmapData;
private var b:Bitmap;
private var bg:BitmapData;
private var cRect:Rectangle;
private var cPoint:Point;
private var _timer:Timer;
var obj:miObjs;
public function new()
{
super();
canvas = new BitmapData(640, 480, false, 0x5a5a5a);
bg = new BitmapData(640, 480, false, 0x5a5a5a);
cRect = new Rectangle(0, 0, 640, 480);
cPoint = new Point(0, 0);
b = new Bitmap(canvas);
obj = new miObjs();
addChild(b);
_timer = new Timer(33);
_timer.addEventListener(TimerEvent.TIMER, loop);
_timer.start();
}
public function loop(e:TimerEvent)
{
canvas.lock();
canvas.copyPixels(bg, cRect, cPoint);
render();
canvas.unlock();
}
public function render()
{
obj.loop();
canvas.copyPixels(obj.bd, obj.rect, obj.point);
}
static function main() 
{
Lib.current.addChild(new Main());
}
}

2011/9/13 Maximiliano Fernández <[hidden email]>
What I mean is that where is placed the error? If your code is in the form:

[Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]

class Main extends [some-other-class]
{

var obj : MyObj;

public function new () {
   super ();
   obj = new MyObj ();
} // new ()

} // class Main

[Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]

it's ok. I don't see any error. That's why I ask what's the line 27 (Where the error is located). That error is very common if you don't close the before line properly, with an ";"

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with jeash.

Felipe
Exactly it was that my class didn't start with a capital letter.
Thanks a lot!


On Wed, Sep 14, 2011 at 11:28 AM, Viktor Hesselbom <[hidden email]> wrote:
What is miObjs? As far as I know a class name has to start with a capital letter.


2011/9/14 Felipe <[hidden email]>
Line 27 has this:

var obj:miObjs;

this is Main.hx :

package ;

import jeash.display.Bitmap;
import jeash.display.BitmapData;
import jeash.display.Sprite;
import jeash.geom.Point;
import jeash.geom.Rectangle;
import jeash.Lib;
import jeash.utils.Timer;
import jeash.events.TimerEvent;

/**
 * ...
 * @author Felipe Alfonso
 */

class Main extends Sprite
{
private var canvas:BitmapData;
private var b:Bitmap;
private var bg:BitmapData;
private var cRect:Rectangle;
private var cPoint:Point;
private var _timer:Timer;
var obj:miObjs;
public function new()
{
super();
canvas = new BitmapData(640, 480, false, 0x5a5a5a);
bg = new BitmapData(640, 480, false, 0x5a5a5a);
cRect = new Rectangle(0, 0, 640, 480);
cPoint = new Point(0, 0);
b = new Bitmap(canvas);
obj = new miObjs();
addChild(b);
_timer = new Timer(33);
_timer.addEventListener(TimerEvent.TIMER, loop);
_timer.start();
}
public function loop(e:TimerEvent)
{
canvas.lock();
canvas.copyPixels(bg, cRect, cPoint);
render();
canvas.unlock();
}
public function render()
{
obj.loop();
canvas.copyPixels(obj.bd, obj.rect, obj.point);
}
static function main() 
{
Lib.current.addChild(new Main());
}
}

2011/9/13 Maximiliano Fernández <[hidden email]>
What I mean is that where is placed the error? If your code is in the form:

[Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]

class Main extends [some-other-class]
{

var obj : MyObj;

public function new () {
   super ();
   obj = new MyObj ();
} // new ()

} // class Main

[Main.hx>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]

it's ok. I don't see any error. That's why I ask what's the line 27 (Where the error is located). That error is very common if you don't close the before line properly, with an ";"

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Problem with jeash.

rammserker
Hehe, if you see your first snippet of code, you wrote the class name starting with uppercase. That's the classic "I worked >12 hours in this sh!7, and a f*ck!n6 unknown error arrise right now!!" LOL xD

Max
0 1 0 | 0 0 1 | 1 1 1



--
haXe - an open source web programming language
http://haxe.org