Native Window in einer separaten Datei [AIR 2]
| Beiträge: 14 Wohnort: Koblenz Registriert: Jul 2011
| 22.07.2011, 11:20
Hi Flex Community,
mein Problem besteht darin den fx:Component-Tag in einer externen Datei im Projekt auszulagern. Weiß aber nicht ob das überhaupt möglich ist..
Mein Code sieht wie folgt aus:
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | <?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="applicationReady(event)">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
private var newWindow:MyNativeWindow;
public var house:String = "wooden house";
private static var _app:lalala;
private function openNewWindow():void {
trace(house);
if (newWindow != null) newWindow.close();
newWindow = new MyNativeWindow();
newWindow.width = 200;
newWindow.height = 200;
newWindow.data
try
{
newWindow.open();
}
catch (err:Error)
{
trace(err.message);
}
}
protected function applicationReady(event:FlexEvent):void
{
_app = this;
}
public static function get app():lalala
{
return _app;
}
]]>
</fx:Script>
<fx:Declarations>
<fx:Component className="MyNativeWindow">
<mx:Window horizontalAlign="center" verticalAlign="middle" backgroundColor="blue">
<fx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
{
import mx.core.FlexGlobals;
trace("Hallo Welt");
}
]]>
</fx:Script>
<mx:Button label="Yeah" click="button1_clickHandler(event)" />
<mx:Button label="close" click="this.close()"/>
</mx:Window>
</fx:Component>
</fx:Declarations>
<s:VGroup horizontalCenter="0" top="10">
<s:Button label="Open New Window" color="black" click="openNewWindow()"/>
</s:VGroup>
</s:WindowedApplication>
|
Würde mich auf eine Antwort freuen!
Grüße
Christian | | | Beiträge: 4909 Wohnort: zuhaus Registriert: Apr 2004
| 22.07.2011, 12:12
|
|