commonjs - Titanium Importing a widget inside another widget controller -
in appcelerator titanium application building, there 2 widgets
- an imported widget vectorimage
- a custom widget staticboard, should rely on vectorimage widget.
but don't find right way import vectorimage module in staticboard widget controller (widget.js).
i've tried :
- var vectorimage = require('com.capnajax.vectorimage/widget');
- var vectorimage = require(wpath('../../com.capnajax.vectorimage/widget'));
and directly during widget creation :
var image = alloy.createcontroller('com.capnajax.vectorimage', { svg: wpath('chess_pieces/'+pieceimage+'.svg'), top: parseint(y+inset+cellssize*(7-rank)), left: parseint(x+inset+cellssize*file), width: cellssize, height: cellssize }); $.widget.add(image);
please, notice managed integrate in hard-coded way, in widget view (index.xml), e.g :
... <widget src="com.capnajax.vectorimage" svg="path.svg" /> ...
so it's not vectorimage widget blame.
what correct way use widget in widget.js ?
notice this post not solve problem.
try: js:
alloy.createwidget('com.capnajax.vectorimage' , { svg: wpath('chess_pieces/'+pieceimage+'.svg'), top: parseint(y+inset+cellssize*(7-rank)), left: parseint(x+inset+cellssize*file), width: cellssize, height: cellssize });
Comments
Post a Comment