Python 官方文档:入门教程 => 点击学习
1,这个getBound 在某些情况下非常实用.例如,聊天系统的聊天面板.做个这玩意的朋友,应该对着玩意都点熟悉.2,这里我用这玩意,实现了一个功能: 面板"LevelTitleMainPanel"的关闭策略,除了通过面板上的关闭按钮,还能
1,这个getBound 在某些情况下非常实用.例如,聊天系统的聊天面板.做个这玩意的朋友,应该对着玩意都点熟悉.
2,这里我用这玩意,实现了一个功能: 面板"LevelTitleMainPanel"的关闭策略,除了通过面板上的关闭按钮,还能在此面板的外部单击时,面板也能关闭.
"LevelTitleMainPanel"的部分代码:
override protected function onAddStage():void{
super.onAddStage();
listener(true);
}
override protected function onRemoveStage():void{
super.onRemoveStage();
listener(false);
}
private function listener( $isAdd : Boolean = true) : void{
if($isAdd){
close_btn.addEventListener(MouseEvent.CLICK,__onClickHandler);
stage.addEventListener(MouseEvent.CLICK,__onxClickHandler);
}else{
close_btn.removeEventListener(MouseEvent.CLICK,__onClickHandler);
stage.removeEventListener(MouseEvent.CLICK,__onxClickHandler);
}
}
private function __onClickHandler( $e : MouseEvent ) : void{
this.visible = false;
}
private function __onxClickHandler( $e : MouseEvent ) : void{
if(!this.visible) return;
trace("Ainy---LevelTitleMainPanel---事件处理!!!+++");
var $moX : Number = $e.stageX;
var $moY : Number = $e.stageY;
var $round : Rectangle = this.getBounds(stage);
if($moX < $round.x || $moX > ($round.x + $round.width)){
this.visible = false;
}else if($moY > ($round.y + $round.height)){
this.visible = false;
}
trace("StageX:::=>"+$moX+" StageY:::=>"+$moY);
trace("Myx:::=>"+$round.x+" MyY:::=>"+$round);
trace("MyWidth:::=>"+$round.width+" MyHeight:::=>"+$round.height);
}
其中"this.getBounds(stage)"表示 LevelTitleMainPanel 在 stage 中的位置及其宽长.
--结束END--
本文标题: AS3的getBounds方法
本文链接: https://www.lsjlt.com/news/186684.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0