how to call function from a component

Posted on 2008-11-19
Last Modified: 2013-11-05
let's simplify

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

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
Question by:thegroover
    LVL 7

    Accepted Solution

    example component below calls doSomething() in the main app:

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

    Open in new window

    LVL 1

    Author Closing Comment

    perfect, thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
    PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now