actionscript 3 - FLEX: How to reference a MXML class from an AS3 external class file? -
i have mxml class place list , couple of buttons.
i'd 2 things:
- to access list class external file.
- to add as3 class child (visual element) since need "stage" (global property).
i woudnt't embed code mxml through <![cdata[]]>.
so, example of mxml
<?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="800" minheight="600" width="800" visible="true"> <fx:style source="main.css"/> <fx:declarations> <!-- place non-visual elements (e.g., services, value objects) here --> </fx:declarations> <fx:script> <![cdata[ private var menucontroller:cmenucontroller= new cmenucontroller(); ]]> </fx:script> <s:list x="598.35" y="100.55" width="178" height="324" id="listbox"> <s:layout> <s:verticallayout/> </s:layout> </s:list> </s:application> thus, i'd access listbox cmenucontroller typing in cdata. besides, need able add sprites , shapes trough addchild() method in cmenucontroller.
you have add sprites , shapes uicomponent first , add flex code.
to access flex code external as3 class have reference in as3 class. this:
menucontroller.listreference = listid;
Comments
Post a Comment