ActionScript 3 测试1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 测试1相关的知识,希望对你有一定的参考价值。

package org.swizframework.quickswiz.controller
{
	import org.swizframework.quickswiz.model.User;
	import org.swizframework.quickswiz.service.UserService;
	import mx.controls.Alert;
	import mx.rpc.events.ResultEvent;	
	import org.swizframework.utils.services.ServiceHelper;

	public class UserController
	{
		[Inject]
		public var userService : UserService;

		[Inject]
		public var serviceHelper : ServiceHelper;

		[Bindable]
		public var currentUser : User;

		[PostConstruct]
		/**
		 * [PostConstruct] methods are invoked after all dependencies are injected.
		 * In this example, we set up a default user after the bean is created.
		 */ 
		public function createDefaultUser() : void
		{
			currentUser = new User();
		}

		[Mediate( event="UserEvent.SAVE_USER_REQUESTED", properties="user" )]
		/**
		 * Perform a server request to save the user
		 */ 
		public function saveUser( user : User ) : void
		{
			serviceHelper.executeServiceCall( userService.saveUser( user ), handleSaveUserResult );
		}

		/**
		 * Handle the server call result
		 */ 
		private function handleSaveUserResult( event : ResultEvent ) : void
		{
			// Show an Alert just to make it obvious that the save was successful.
			Alert.show( 'User saved successfully!' );
		}

	}
}

以上是关于ActionScript 3 测试1的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 测试Action Script中是否存在类方法

ActionScript 3:字符命中测试对象,所有对象都在数组中

影片剪辑数组 ActionScript 3

动画未在 actionscript 3.0 (flash cc) 中启动

测试对象是不是在 ActionScript 中定义

ActionScript 3 AIR — 视频使眨眼跳跃