mardi 16 décembre 2014

Draw a rect with sencha touch

I'd like a rect sprite.

I'm using sencha touch ver 2.4. Following the docs i created and used this class:


Code:



Ext.define('MyApp.MySprite', {
extend: 'Ext.Panel',
initialize:function(){
var c = new Ext.draw.Component({
items: [{
type: 'rect',
x: 50,
y: 50,
width: 50,
height: 50,
fillStyle: 'blue'
}]
});
this.add(c)
}
});

but I obtain Cannot read property 'Component' of undefined.
So i used Ext.create to build the rect:

Code:



Ext.define('MyApp.MySprite', {
extend: 'Ext.Panel',
initialize:function(){

var c = Ext.create('Ext.draw.Component',{
items: [{
type: 'rect',
x: 50,
y: 50,
width: 50,
height: 50,
fillStyle: 'blue'
}]
});
this.add(c)
}
});

but now I obtain this error:

Uncaught Error: [Ext.Loader] Failed loading synchronously via XHR: 'touch/src/draw/Component.js'; please verify that the file exists. XHR status code: 404

How I can build a class that represents a rect?






Draw a rect with sencha touch

Aucun commentaire:

Enregistrer un commentaire