_root.attachMovie("zoom_btn", "zoom_btn", _root.getNextHighestDepth());
zoom_btn.onRelease = function() {
_root.attachMovie("blank_btn", "blank_btn", _root.getNextHighestDepth());
blank_btn._x=200;
}
//zoom_btn.onRelease();
blank_btn.onRelease = function() {
trace ("click");
}
点击" zoom_btn"," blank_btn"从库中添加舞台(AS的导出为ON)。
当我点击" blank_btn"时,没有任何反应。跟踪不起作用。
我做错了什么?
UPD:如果我取消注释第8行,一切正常。
答案 0 :(得分:0)
它不起作用,因为当您在blank_btn上添加$scope.messageNotificationDTO = {
adminNotificationTypeCode: [],
adminNotificationName:'',
adminNotificationBody: '',
adminNotificationStartTime: '',
adminNotificationEndTime: '',
activeFlag: ''
};
$scope.adminDataSource = adminData.data;
//Set notification grid config and dataSource
$scope.messageGridOptions = messageGridConfig.messagesGridOptions;
messageGridConfig.messagesGridOptions.dataSource = MessageAdminNotificationFactory.getNotificationDataSource();
//Save Notification
$scope.saveMessages = function() {
MessageAdminNotificationFactory.saveMessageAdmin($scope.messageNotificationDTO).then(function() {
$scope.messageNotificationModal.close();
$scope.messageGridOptions.dataSource.read();
clearNotificationForm();
});
};
//Add new Notification
$scope.addMessageNotification = function() {
$scope.messageNotificationModal.open().center();
};
var clearNotificationForm = function () {
$scope.messageNotificationDTO.adminNotificationTypeCode = [];
$scope.messageNotificationDTO.adminNotificationName = '';
$scope.messageNotificationDTO.adminNotificationBody = '';
$scope.messageNotificationDTO.adminNotificationStartTime = '';
$scope.messageNotificationDTO.adminNotificationEndTime = '';
$scope.messageNotificationDTO.activeFlag = '';
$scope.editMessagesForm.$setPristine();
};
处理程序时, Cannot read property '$setPristine' of undefined
为onRelease
。
在定义blank_btn
函数之前尝试添加undefined
,它会输出trace(blank_btn)
。
当您取消注释onRelease
时,它会正常工作,因为它会在添加undefined
处理程序之前创建zoom_btn.onRelease();
。
如果你想这样做,你需要做类似的事情:
bank_btn