Creating unique identifiers for objects using the getUID()
2008-01-13 15:49
681 查看
The following example shows how you can use the static
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/11/01/creating-unique-identifiers-for-objects-using-the-getuid-method/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.utils.ObjectUtil;
import mx.utils.UIDUtil;
private function displayUID():void {
var text:String = ObjectUtil.toString(myObj);
var title:String = UIDUtil.getUID(myObj);
Alert.show(text, title);
}
]]>
</mx:Script>
<mx:Object id="myObj" name="peter" site="flexexamples.com" />
<mx:ApplicationControlBar dock="true">
<mx:Button label="Display UID"
click="displayUID();" />
</mx:ApplicationControlBar>
</mx:Application>
UIDUtil.getUID()method to generate and retreive a unique identifier for an Object. The first time you click the Display UID button, an Alert control displays the generated UID and a string representation of the Object (yay
ObjectUtil.toString()!). The second time you click the Display UID button, you’ll notice that a new parameter is added to the Object, mx_internal_uid
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/11/01/creating-unique-identifiers-for-objects-using-the-getuid-method/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.utils.ObjectUtil;
import mx.utils.UIDUtil;
private function displayUID():void {
var text:String = ObjectUtil.toString(myObj);
var title:String = UIDUtil.getUID(myObj);
Alert.show(text, title);
}
]]>
</mx:Script>
<mx:Object id="myObj" name="peter" site="flexexamples.com" />
<mx:ApplicationControlBar dock="true">
<mx:Button label="Display UID"
click="displayUID();" />
</mx:ApplicationControlBar>
</mx:Application>
相关文章推荐
- Creating unique identifiers for objects using the getUID() (转载)
- Generate Java objects for FpML using JAXB and Maven: The Easy Way!
- Are you looking for a way to get the entire text of a word document into a RichEdit without using the Clipboard?
- How Can I Get the Unique ID for the Last Inserted Row
- Unable to get system library for the project
- 关于EnumerateObjectsUsingBlock和for-in之间的较量
- Question 7: Which of the following correctly identify benefits of the getline() member function for cin over the extraction oper
- View Controller Programming Guide for iOS---(八)---Using View Controllers in the Responder Chain
- how to create colored 3D Objects using the OpenGL® ES cross-platform API.
- apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName错误的解决方法
- Most of these Diesel-engined wristwatches wall socket available for purchase are designed when using the similar premium quality products
- Error launching remote program: failed to get the task for process 10722.The解决方法
- [转]Using NLog for ASP.NET Core to write custom information to the database
- Using JavaScript to show the current time for the end user
- process launch failed :failed to get the task for process XXX
- 启动PHP报错ERROR: [pool www] cannot get uid for user '@php_fpm_user@'
- The method getTextContent() is undefined for the type Element
- jsp The method getServletContext() is undefined for the type in eclipse解决方法
- 修复错误1093 “Unable to get the private bytes memory limit for the W3WP process”