actionscript 3 - Flex - Calling a public method located outside of the main view -


new flex, i'm trying figure out way call public method declared on view "firstview" of application. how reference?

main view

<?xml version="1.0" encoding="utf-8"?> <s:viewnavigatorapplication xmlns:fx="http://ns.adobe.com/mxml/2009"                 xmlns:s="library://ns.adobe.com/flex/spark" applicationdpi="160"  firstview="views.loaderview" creationcomplete="init()">     <fx:declarations>         <!-- place non-visual elements (e.g., services, value objects) here -->     </fx:declarations>     <fx:script>         <![cdata[             private function init():void{                 //how access method?                         loaderview.setloadermsg("my message");             }         ]]>     </fx:script> </s:viewnavigatorapplication> 

loader view

    <fx:declarations>         <s:radiobuttongroup id="rg"/>     </fx:declarations>      <s:layout>         <s:verticallayout paddingtop="10" paddingbottom="15" paddingleft="15" paddingright="15" gap="15"                            horizontalalign="center" verticalalign="middle"/>     </s:layout>     <s:busyindicator/>       <s:label id="loadermsg" text="loading..." />  </s:view> 

by default, children defined in mxml in public namespace, can access via dot notation. that's easiest way first steps in flex.

<?xml version="1.0" encoding="utf-8"?> <s:viewnavigatorapplication xmlns:fx="http://ns.adobe.com/mxml/2009"                              xmlns:s="library://ns.adobe.com/flex/spark"                              applicationdpi="160"                             firstview="views.loaderview"                             creationcomplete="init()">   <fx:declarations>   <!-- place non-visual elements (e.g., services, value objects) here -->   </fx:declarations>   <fx:script>     <![cdata[       private function init():void{         trace(navigator.activeview);         // const first:loaderview = navigator.activeview loaderviewm         // first.loadermsg.text = "my message";       }     ]]>   </fx:script> </s:viewnavigatorapplication> 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -