读书人

怎么定义坐标实现相对应的位置

发布时间: 2013-10-29 12:07:57 作者: rapoo

如何定义坐标,实现相对应的位置?
我在Application,自己写代码添加了一个PANEL,然后在PANEL中增加一个button,想这个button,靠右并离panel边界10个像素,设置了xy坐标,都么有用,总是靠左贴着panel的边边,请教一下,下面是我的代码:


this._qPanel.x=47;
this._qPanel.y=15;
this._qPanel.id="questionPanel";
this._qPanel.width=585;
this._qPanel.height=412;
this._qPanel.states=new Array("showQuestion");

this._app.addElement(_qPanel);




//x="493" y="335" label="确 定" id="answerBtn" click="answerBtn_clickHandler(event)"
var button:Button=new Button();
button.x=493;
button.y=335;
button.label="确 定";
button.id="answerBtn";
button.addEventListener(MouseEvent.CLICK,answerBtn_clickHandler);

this._qPanel.addElement(button);

[解决办法]
首先第一个问题
var button:Button=new Button();
button.x=493;
button.y=335;
button.top = 10;
button.left = 20;
button.label="确 定";
button.id="answerBtn";

二 控制button的状态要首先设置他的over,up,down等状态,然后才能在几种状态间切换;
[解决办法]
button.right = 10; 呢?

读书人网 >flex

热点推荐