The AS3 Sugar provides a Lua-like way to access AS3 class and instance creation, property getter/setters, and function calls.

Values return from sugar are always AS3 Objects for performance reasons. If you need to perform Lua operations on these values, you should convert them to Lua types using as3.tolua(value).

example = as3.class.String.new("Hello")
hello = as3.tolua(example).." World!"
as3.trace(hello)--Traces"Hello World!"

Note: Only classes that have been included in the SWF can be created. For the demo all of mx.containers and mx.controls have been included along with all the top level and default classes all SWFs get.

Sugar is optional feature. See UsingRawLuaAlchemy.

Create AS3 Object

syntax = as3.class.ClassName.new(param1,..., paramN)
example1 = as3.class.String.new("Hello There")
example2 = as3.class.flash.utils.ByteArray.new()

Get Member Property

value = as3obj.property
example = as3.class.Array.new()
len = example.length

Set Member Property

as3obj.property = value
example = as3.class.MyClass.new()
example.text ="Hello There"

Call Member Function

return= as3obj.function([param1,..., paramN])
example1 = as3.class.Array.new()
example1.push(5) example2 = as3.class.MyClass.new()
example2.someFunction()
result = example2.anotherFunction(1,"hello")

Get A Class

syntax = as3.class.ClassName.class()
example = as3.class.flash.utils.ByteArray.class()

You should be able to call static functions or get static methods using this class just as if it were an instance created with new. But sometimes you may want to directly call into a class without creating an instance like done in ActionScript

Get Static Property

syntax = as3.class.ClassName.staticProperty
example = as3.class.MyClass.SOME_CONSTANT

Set Static Property

as3.class.ClassName.staticProperty = value
as3.class.MyClass.text ="hello"

Call Static Function

as3.class.ClassName.staticFunction([param1,..., paramN])
as3.class.MyClass.someStaticFunction()
v = as3.class.MyClass.anotherStaticFunction(1,6,999)

Call Namespace Function

as3.namespace.ClassName.namespaceFunction([param1,..., paramN])
as3.namespace.MyClass.someNamespaceFunction()
v = as3.namespace.MyClass.anotherNamespaceFunction(1,6,999)

LuaAlchemy API 介绍的更多相关文章

  1. 常用ArcGIS for Silverlight 开发API介绍

    1.API介绍 2.Map对象  3.Layer对象 4.Symbol对象 5.Task对象

  2. Servlet基础(一) Servlet简介 关键API介绍及结合源码讲解

    Servlet基础(一) Servlet基础和关键的API介绍 Servlet简介 Java Servlet是和平台无关的服务器端组件,它运行在Servlet容器中. Servlet容器负责Servl ...

  3. python学习笔记(win32print API介绍)

    最近博主在研究用python控制打印机 这里整理下win32print的API介绍,官网地址http://timgolden.me.uk/pywin32-docs/win32print.html Op ...

  4. 使用html5中video自定义播放器必备知识点总结以及JS全屏API介绍

    一.video的js知识点: controls(控制器).autoplay(自动播放).loop(循环)==video默认的: 自定义播放器中一些JS中提供的方法和属性的记录: 1.play()控制视 ...

  5. Commons-lang API介绍

    4.1 Commons-lang API介绍 4.1.1 StringUtils 4.1.2 StringEscapeUtils 4.1.3 ArrayUtils 4.1.4 DateUtils 4. ...

  6. APP自动化框架LazyAndroid使用手册(3)--核心API介绍

    作者:黄书力 概述 在前一篇博文中,简要介绍了一款安卓UI自动化测试框架LazyAndroid (http://blog.csdn.net/kaka1121/article/details/53204 ...

  7. Spring Boot 2.x 编写 RESTful API (一) RESTful API 介绍 & RestController

    用Spring Boot编写RESTful API 学习笔记 RESTful API 介绍 REST 是 Representational State Transfer 的缩写 所有的东西都是资源,所 ...

  8. FastDFS api介绍

    1. 命令行api介绍 FastDFS提供了可用于运维测试的命令行api,下面进行介绍: 1.1 fastdfs服务管理 tracker进程服务管理脚本 /etc/init.d/fdfs_tracke ...

  9. ElasticSearch的API介绍

    ElasticSearch的API介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.ES是基于Restful风格 1>ES是基于Restful风格 Elasticsea ...

随机推荐

  1. OD使用教程9

    先运行程序打开about,发现这是一个未注册的软件需要注册后才能使用里面的工具,所以随便注册一下,跳出一个提示说注册的是非法的邮箱,所以就可以以此做为突破口来破解这个程序 将提示的语句作为关键字去找出 ...

  2. MVC文件上传和下载

    1.单个文件上传 HTML写法:form表单中加enctype="multipart/form-data" <form aciont="" method= ...

  3. C++回顾map的用法

    map<T, T>是C++的STL中存储key-value键值对数据结构的最基础的模板类,相对于multimap可以重复的key值,map的key是非重复的. C++的reference这 ...

  4. Oracle学习指南

    Oracle学习指南 你走的那天,我决定不落泪,迎着风撑着眼帘用力不眨眼 创建数据库.创建用户.创建表空间.创建表.插入数据..... 1.用系统用户登录,任选系统用户 代码: >>sql ...

  5. hdu 5976 Detachment

    Detachment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total ...

  6. CreateFile() 打开u盘 物理设备

    //以下是用的vs2010 windows7 64 管理员权限编译成功的 HANDLE hDev = CreateFile(TEXT("\\\\.\\PhysicalDrive1" ...

  7. Tomcat中使用JNDI加载JDBC数据源

    以前写JDBC的时候总是手工写一个类,用硬代码写上className.url.用户名和密码什么的,然后通过DriverManager获取到Connection.那样写是很方便,但是如果想更改的话,需要 ...

  8. 无状态的web应用

    无意间看到这个话题,随便看了下 觉得有点意思.比较零散,记录一下. 1. http协议无状态. 简单的理解:每一个http请求都是独立的.不会因为前一个请求的失败就影响到下一个请求.既不会影响前面的, ...

  9. linux下 tar解压 gz解压 bz2等各种解压文件使用方法

    http://alex09.iteye.com/blog/647128 大致总结了一下linux下各种格式的压缩包的压缩.解压方法. .tar 解包:tar xvf FileName.tar 打包:t ...

  10. 《LINUX内核设计与实现》读书笔记之第五章

    第五章——系统调用 5.1 与内核通信 1.为用户空间提供一种硬件的抽象接口 2.保证系统稳定和安全 3.除异常和陷入,是内核唯一的合法入口. API.POSIX和C库 关于Unix接口设计:提供机制 ...