以下示例首先设置 someOther_mc
实例的 _x
和 _y
属性,然后指示 someOther_mc
转到第 3 帧并停止。
同时访问一个作用域链列表中的多个项时,with
语句会很有用。在以下示例中,内置 Math 对象位于作用域链之前。将 Math 设置为默认对象可将标识符 cos
、sin
和 PI
分别解析为 Math.cos
、Math.sin
和 Math.PI
。标识符 a
、x
、y
和 r
polar()
的对象激活范围中,所以将解析为相应的局部变量。 不是 Math 对象的方法或属性,但由于它们位于函数
function polar(r:Number):void {
var a:Number, x:Number, y:Number;
with
(Math) {
a = PI * pow(r, 2);
x = r * cos(PI);
y = r * sin(PI / 2);
}
trace("area = " + a);
trace("x = " + x);
trace("y = " + y);
} polar(3);
/*
area = 28.2743338823081
x = -3
y = 3
*/
转载:http://xiejiangbo.iteye.com/blog/459350
with
(someOther_mc) {
_x = 50;
_y = 100;
gotoAndStop(3);
}
以下代码段显示在不使用 with
语句的情况下如何编写先前的代码。
someOther_mc._x = 50;
someOther_mc._y = 100;
someOther_mc.gotoAndStop(3);
分享到:
相关推荐
Flex dynamic 关键字使用实例代码。对于学习flex的朋友也许有所帮助。
NULL 博文链接:https://queue19.iteye.com/blog/373457
flex 经常用法flex 经常用法flex 经常用法flex 经常用法flex 经常用法
flex 3 with java 好书,可惜自己学net的,有空也看看
一些flex组件的用法! flex组件用法。 自定义控件
Enterprise Development with Flex.pdf
Testing Flex Applications with Mercury QuickTest Professional程序的迁移及测试
Part of the popular "Adobe Developer Library" co-published by O'Reilly and Adobe, "Enterprise Development with Flex" goes well beyond Flex tutorials and product documentation to suggest best ...
里面收集了一些Flex的tree控件的用法和实例的源代码
flex4 中文教程 详细介绍flex4 的基本用法,适合没有基础的开发人员参考
Flex_3_with_JavaFlex_3_with_JavaFlex_3_with_JavaFlex_3_with_Java
With Getting Started with Flex 3, you will: Walk through sample RIA projects and see examples of amazing applications people have built with Flex Work with ActionScript 3.0 and the MXML markup ...
After learning how to install and becoming familiar with the basics of the Flex Builder 2 software, you will explore in depth how ActionScript 3.0 interacts with Flexs powerful XML-like design ...
flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图flex 地图...
Ideal for experienced developers with or without a background in Flex, Getting Started with Flex 4 shows you how to take advantage of your existing skills. You'll quickly discover how easy RIA ...
简介 Book Description <br>* Understand MXML containers * Create transitions * Create data-driven applications with XML * Interface Flex with ColdFusion * Understand the power of states...
简介 Book Description <br>* Understand MXML containers * Create transitions * Create data-driven applications with XML * Interface Flex with ColdFusion * Understand the power of states...
Flex 3 with Java PDF File
flex-spring.zip 博文链接:https://hjy2099.iteye.com/blog/233655