You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2014/03/17 19:43:23 UTC
git commit: [flex-asjs] [refs/heads/develop] - UI utility class.
Repository: flex-asjs
Updated Branches:
refs/heads/develop 24e96cfc2 -> 6684cf7da
UI utility class.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/6684cf7d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/6684cf7d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/6684cf7d
Branch: refs/heads/develop
Commit: 6684cf7da874267c3370db8b80836f5d85bedbe1
Parents: 24e96cf
Author: Peter Ent <pe...@apache.org>
Authored: Mon Mar 17 14:16:15 2014 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Mar 17 14:16:15 2014 -0400
----------------------------------------------------------------------
.../src/org/apache/flex/utils/UIUtils.as | 60 ++++++++++++++++++++
1 file changed, 60 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6684cf7d/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as
new file mode 100644
index 0000000..a812b60
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/UIUtils.as
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.utils
+{
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The UIUtils class is a collection of static functions that provide utility
+ * features to UIBase objects.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class UIUtils
+ {
+ /**
+ * @private
+ */
+ public function UIUtils()
+ {
+ throw new Error("UIUtils should not be instantiated.");
+ }
+
+ /**
+ * Centers the given item relative to another item. Typically the item being centered is
+ * a child or sibling of the second item.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public static function center( item:UIBase, relativeTo:UIBase ):void
+ {
+ var xpos:Number = (relativeTo.width - item.width)/2;
+ var ypos:Number = (relativeTo.height - item.height)/2;
+
+ item.x = xpos;
+ item.y = ypos;
+ }
+ }
+}
\ No newline at end of file