| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| 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. |
| |
| --> |
| <js:View xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:js="library://ns.apache.org/royale/basic" |
| xmlns:local="*" |
| xmlns:models="models.*" |
| xmlns:acc="org.apache.royale.html.accessories.*"> |
| |
| <fx:Style> |
| .title { |
| font-size: 14pt; |
| font-weight: bold; |
| } |
| |
| </fx:Style> |
| |
| <fx:Script> |
| <![CDATA[ |
| import org.apache.royale.core.IPopUpHost; |
| import org.apache.royale.events.Event; |
| import org.apache.royale.utils.UIUtils; |
| |
| import org.apache.royale.reflection.describeType; |
| import org.apache.royale.reflection.MetaDataArgDefinition; |
| import org.apache.royale.reflection.MetaDataDefinition; |
| import org.apache.royale.reflection.MethodDefinition; |
| import org.apache.royale.reflection.TypeDefinition; |
| |
| [Event(name="foo", type="org.apache.royale.events.Event")] |
| public function runTest():void |
| { |
| var metadata:Array; |
| var mtd:MetaDataDefinition; |
| var mtdarg:MetaDataArgDefinition; |
| var args:Array; |
| var j:int; |
| var m:int; |
| |
| var td:TypeDefinition = describeType(this); |
| trace(td.name); |
| var methods:Array = td.methods; |
| var n:int = methods.length; |
| for (var i:int = 0; i < n; i++) |
| { |
| var md:MethodDefinition = methods[i] as MethodDefinition; |
| trace(md.name); |
| if (md.name == "runTest") |
| { |
| metadata = md.metadata; |
| for each (mtd in metadata) |
| { |
| trace(mtd.name); |
| args = mtd.args; |
| m = args.length; |
| for (j = 0; j < m; j++) |
| { |
| mtdarg = args[j] as MetaDataArgDefinition; |
| trace(mtdarg.name, mtdarg.value); |
| } |
| } |
| break; |
| } |
| } |
| td = describeType(cont); |
| trace(td.name); |
| metadata = td.metadata; |
| n = metadata.length; |
| for (i = 0; i < n; i++) |
| { |
| mtd = metadata[0] as MetaDataDefinition; |
| trace(mtd.name); |
| args = mtd.args; |
| m = args.length; |
| for (j = 0; j < m; j++) |
| { |
| mtdarg = args[j] as MetaDataArgDefinition; |
| trace(mtdarg.name, mtdarg.value); |
| } |
| } |
| } |
| ]]> |
| </fx:Script> |
| |
| <js:Container id="cont" width="600" height="700" x="50" y="50"> |
| <js:beads> |
| <js:VerticalLayout /> |
| </js:beads> |
| |
| <js:Label text="Reflection Test" className="title" /> |
| <js:TextButton text="Test" click="runTest()" /> |
| </js:Container> |
| |
| </js:View> |