Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 624
  • Last Modified:

how to call function from a component

let's simplify

i have an application (1.mxml) and a component (2.mxml).
1.mxml:
private function something(i:string):void {
  label1.text=i;
}

2.mxml
something("some text");

how can i call the function in 1.mxml from 2.mxml? don't bother with the above code, i know it is not correct, i just need the solution how can i call a function from a different mxml.

thanks in advance
G
0
thegroover
Asked:
thegroover
1 Solution
 
evcrCommented:
example component below calls doSomething() in the main app:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="108" borderColor="#0096FF" borderStyle="solid" backgroundColor="#FF0000">
<mx:Script>
	<![CDATA[
	import mx.core.Application;
	]]>
</mx:Script>
	<mx:Button x="10" y="68" label="Button" click="Application.application.doSomething();"/>
</mx:Canvas>

Open in new window

0
 
thegrooverAuthor Commented:
perfect, thanks
0

Featured Post

Become an IT Security Management Expert

In today’s fast-paced, digitally transformed world of business, the need to protect network data and ensure cloud privacy has never been greater. With a B.S. in Network Operations and Security, you can get the credentials it takes to become an IT security management expert.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now