1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen">
6
<link rel="stylesheet" href="../../../../print.css" type="text/css" media="print">
7
<meta content="DisplayObjectUtil,com.yahoo.astra.utils.DisplayObjectUtil,align,localToLocal,resizeAndMaintainAspectRatio" name="keywords">
8
<title>com.yahoo.astra.utils.DisplayObjectUtil</title>
11
<script type="text/javascript" language="javascript" src="../../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../../cookies.js"></script><script type="text/javascript" language="javascript">
13
asdocTitle = 'DisplayObjectUtil - YUI Flash Component Documentation';
14
var baseRef = '../../../../';
15
window.onload = configPage;
17
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
19
<td align="left" class="titleTableTitle">YUI Flash Component Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../package-summary.html">All Packages</a> | <a onclick="loadClassListFrame('../../../../all-classes.html')" href="../../../../class-summary.html">All Classes</a> | <a onclick="loadClassListFrame('../../../../index-list.html')" href="../../../../all-index-A.html">Index</a> | <a href="../../../../index.html?com/yahoo/astra/utils/DisplayObjectUtil.html&com/yahoo/astra/utils/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../../images/logo.jpg"></td>
21
<tr class="titleTableRow2">
22
<td align="left" id="subTitle" class="titleTableSubTitle">Class DisplayObjectUtil</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
24
<tr class="titleTableRow3">
25
<td colspan="2"> </td>
28
<script type="text/javascript" language="javascript">
30
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class DisplayObjectUtil"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
32
<div class="MainContent">
33
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
35
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">com.yahoo.astra.utils</a></td>
38
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class DisplayObjectUtil</td>
42
Utility functions for use with DisplayObjects.
48
<a name="methodSummary"></a>
49
<div class="summarySection">
50
<div class="summaryTableTitle">Public Methods</div>
51
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
53
<th> </th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined by</th>
56
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol">
57
<div class="summarySignature">
58
<a class="signatureLink" href="#align()">align</a>(target:DisplayObject, bounds:Rectangle, horizontalAlign:String = null, verticalAlign:String = null):void</div>
59
<div class="summaryTableDescription">[static]
60
Aligns a DisplayObject vertically and horizontally within specific bounds.</div>
61
</td><td class="summaryTableOwnerCol">DisplayObjectUtil</td>
64
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol">
65
<div class="summarySignature">
66
<a class="signatureLink" href="#localToLocal()">localToLocal</a>(point:Point, firstDisplayObject:DisplayObject, secondDisplayObject:DisplayObject):Point</div>
67
<div class="summaryTableDescription">[static]
68
Converts a point from the local coordinate system of one DisplayObject to
69
the local coordinate system of another DisplayObject.</div>
70
</td><td class="summaryTableOwnerCol">DisplayObjectUtil</td>
73
<td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol">
74
<div class="summarySignature">
75
<a class="signatureLink" href="#resizeAndMaintainAspectRatio()">resizeAndMaintainAspectRatio</a>(target:DisplayObject, width:Number, height:Number, aspectRatio:Number):void</div>
76
<div class="summaryTableDescription">[static]
77
Resizes a DisplayObject to fit into specified bounds such that the
78
aspect ratio of the target's width and height does not change.</div>
79
</td><td class="summaryTableOwnerCol">DisplayObjectUtil</td>
83
<script type="text/javascript" language="javascript">
87
<div class="MainContent">
88
<a name="methodDetail"></a>
89
<div class="detailSectionHeader">Method detail</div>
90
<a name="align()"></a>
91
<table cellspacing="0" cellpadding="0" class="detailHeader">
93
<td class="detailHeaderName">align</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
96
<div class="detailBody">
97
<code>public static function align(target:DisplayObject, bounds:Rectangle, horizontalAlign:String = null, verticalAlign:String = null):void</code><p>
98
Aligns a DisplayObject vertically and horizontally within specific bounds.
100
</p><span class="label">Parameters</span>
101
<table border="0" cellspacing="0" cellpadding="0">
103
<td width="20px"></td><td><code><span class="label">target</span>:DisplayObject</code> — The DisplayObject to align.
107
<td class="paramSpacer"> </td>
110
<td width="20px"></td><td><code><span class="label">bounds</span>:Rectangle</code> — The rectangle in which to align the target DisplayObject.
114
<td class="paramSpacer"> </td>
117
<td width="20px"></td><td><code><span class="label">horizontalAlign</span>:String</code> (default = <code>null</code>)<code></code> — The alignment position along the horizontal axis. If <code>null</code>,
118
the target's horizontal position will not change.
122
<td class="paramSpacer"> </td>
125
<td width="20px"></td><td><code><span class="label">verticalAlign</span>:String</code> (default = <code>null</code>)<code></code> — The alignment position along the vertical axis. If <code>null</code>,
126
the target's vertical position will not change.
131
<a name="localToLocal()"></a>
132
<table cellspacing="0" cellpadding="0" class="detailHeader">
134
<td class="detailHeaderName">localToLocal</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td>
137
<div class="detailBody">
138
<code>public static function localToLocal(point:Point, firstDisplayObject:DisplayObject, secondDisplayObject:DisplayObject):Point</code><p>
139
Converts a point from the local coordinate system of one DisplayObject to
140
the local coordinate system of another DisplayObject.
141
</p><span class="label">Parameters</span>
142
<table border="0" cellspacing="0" cellpadding="0">
144
<td width="20px"></td><td><code><span class="label">point</span>:Point</code> — the point to convert
148
<td class="paramSpacer"> </td>
151
<td width="20px"></td><td><code><span class="label">firstDisplayObject</span>:DisplayObject</code> — the original coordinate system
155
<td class="paramSpacer"> </td>
158
<td width="20px"></td><td><code><span class="label">secondDisplayObject</span>:DisplayObject</code> — the new coordinate system
163
<span class="label">Returns</span>
164
<table border="0" cellspacing="0" cellpadding="0">
166
<td width="20"></td><td><code>Point</code></td>
170
<a name="resizeAndMaintainAspectRatio()"></a>
171
<table cellspacing="0" cellpadding="0" class="detailHeader">
173
<td class="detailHeaderName">resizeAndMaintainAspectRatio</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td>
176
<div class="detailBody">
177
<code>public static function resizeAndMaintainAspectRatio(target:DisplayObject, width:Number, height:Number, aspectRatio:Number):void</code><p>
178
Resizes a DisplayObject to fit into specified bounds such that the
179
aspect ratio of the target's width and height does not change.
181
</p><span class="label">Parameters</span>
182
<table border="0" cellspacing="0" cellpadding="0">
184
<td width="20px"></td><td><code><span class="label">target</span>:DisplayObject</code> — The DisplayObject to resize.
188
<td class="paramSpacer"> </td>
191
<td width="20px"></td><td><code><span class="label">width</span>:Number</code> — The desired width for the target.
195
<td class="paramSpacer"> </td>
198
<td width="20px"></td><td><code><span class="label">height</span>:Number</code> — The desired height for the target.
202
<td class="paramSpacer"> </td>
205
<td width="20px"></td><td><code><span class="label">aspectRatio</span>:Number</code> — The desired aspect ratio. If NaN, the aspect
206
ratio is calculated from the target's current
217
<center class="copyright">