📄 tabcomment.mxml
字号:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas
xmlns:mx="http://www.adobe.com/2006/mxml"
width="686"
height="60"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
creationComplete="handleCreationComplete(event)">
<mx:Script>
<![CDATA[
//////////////////////////////////////////////////
//import
import mx.controls.Text;
import mx.controls.TextArea;
import mx.events.FlexEvent;
import org.flex.events.*;
import org.flex.engine.managers.Comment;
//////////////////////////////////////////////////
//getter/setter variables
private var _commentData:Comment;
//////////////////////////////////////////////////
//public variables
public var preferredHeight:uint;
public var isLastItemInList:Boolean = false;
///////////////////////////////////////////////////////////////////
//getter/setter functions
[Bindable]
public function get commentData():Comment {
return this._commentData;
}
public function set commentData(val:Comment):void {
this._commentData = val;
setUserInfoText();
if (this.commentData.parentCommentID > 0) {
this.replyBut_mc.visible=false
this.editBut_mc.visible=true
this.container_mc.x=30
this.message_mc.width-=10
}
}
///////////////////////////////////////////////////////////////////
//initialization
private function handleCreationComplete(event:Event):void {
handleCommentData();
}
//comment data-------------------------------------------------------------
private function handleCommentData():void {
height = message_mc.height + this.replyBut_mc.height+10;
}
private function setUserInfoText():void {
var name:String = commentData.name;
if (name == "") {
name = "Anonymous";
}
userInfo_mc.htmlText = "<font color='#000000' size='12'>" + name + "</font><font color='#333333' size='10'> @ " + commentData.createdDate + "</font>";
}
//message functions-----------------------------------------------------------------
private function replyToMessage():void {
var flexDotOrgCommentEvent:FlexDotOrgCommentEvent = new FlexDotOrgCommentEvent(FlexDotOrgCommentEvent.ADD_COMMENT);
flexDotOrgCommentEvent.comment = commentData;
dispatchEvent(flexDotOrgCommentEvent);
}
private function editMessage():void {
var flexDotOrgCommentEvent:FlexDotOrgCommentEvent = new FlexDotOrgCommentEvent(FlexDotOrgCommentEvent.EDIT_COMMENT);
flexDotOrgCommentEvent.comment = commentData;
dispatchEvent(flexDotOrgCommentEvent);
}
]]>
</mx:Script>
<mx:Canvas id="container_mc">
<mx:Label id="userInfo_mc" styleName="myriadRegular" width="410" x="0" y="0" selectable="false"/>
<mx:Text id="message_mc" text="{commentData.body}" x="0" y="15" width="700"
dataChange="handleCommentData();" styleName="standardText" color="0x666666"/>
<mx:Button id="replyBut_mc" label="Reply" styleName="blackButton" x="-5" buttonMode="true" y="{this.message_mc.y+this.message_mc.height-5}" click="this.replyToMessage()"/>
<mx:Button id="editBut_mc" label="Edit" styleName="blackButton" x="-5" buttonMode="true" y="{this.message_mc.y+this.message_mc.height-5}" visible="false" click="this.editMessage()"/>
</mx:Canvas>
</mx:Canvas>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -