我想组合一个创建窗口和画架画布的 extjs 应用程序,但是当我尝试同时加载它们时,窗口完全搞砸了:(这是我的代码。与可移动窗口有冲突吗?我有把我的窗户放在一个容器里?我对这个东西很陌生,我已经用 extjs 修补了大约一个星期,只用了 2 天左右的画架 js。我只有一周.5 经验JS,所以如果我的问题看起来太菜鸟,我很抱歉。
var myImage;
var stage;
function init() {
stage = new createjs.Stage("demoCanvas");
myImage = new createjs.Bitmap('dbz.jpg');
stage.addChild(myImage);
stage.update();
myImage.addEventListener("click", function(){
var seed = new createjs.Bitmap("seed.jpg");
seed.alpha = 0.5;
stage.addChild(seed);
stage.update();
}); //end seed
} //end easel
var animals = Ext.create('Ext.data.Store', {
fields: ['itemId', 'name'],
data: [{
"itemId": 'mycat',
"name": "mycat"
}, {
'itemId' : 'mydog',
"name": "mydog"
}, {
'itemId' : 'sbBarGirls',
"name": "BarGirls-when-drunk"
}
]
}); //end animals.create
Ext.define('ryan', { // create better namespace company.project.class
extend: 'Ext.Window',
// config: {
itemId: 'ryanWindow',
bodyStyle:{"background-color":"green"},
title: 'Animal sanctuary, one animal per location ',
width: 300,
bodyPadding: 10,
test: 'mycat',
style: 'background-color: #Fdd;',
items: [{
itemId: 'button1',
xtype: 'button',
text: 'click the button',
handler: function(theButton){
Ext.Ajax.request({
url: 'stuff.txt',
method: 'GET',
success: function (result){
theButton.up('window').queryById('wildAnimal').setValue(result.responseText)
}
})
}
},{
itemId: 'wildAnimal',
xtype: 'textfield',
fieldLabel: 'animal:',
name: 'myanimal'
}, { //end text field
itemId: 'myCombo',
xtype: 'combo',
fieldLabel: 'choose your animal',
store: animals,
queryMode: 'local',
displayField: 'name',
listeners: {
'change': function(field, selectedValue) {
this.up('window').queryById('wildAnimal').setValue(selectedValue);
}
}
}// end combo
] //end items
//} // end config
}); //end define ryan
////////// object instantiation
Ext.onReady(function(){
var a = Ext.create('ryan', {
renderTo: Ext.getBody()
});
a.show();
var b = Ext.create('ryan', {
renderTo: Ext.getBody()
});
b.show();
});