Skip navigation
Currently Being Moderated

Pass variable from .swc to main application...

Apr 12, 2012 9:39 AM



I am trying to retrieve data from a compiled .swc that is loaded into the main application. I have a generic function like so:


public function onSubFormFinishClick(event:MouseEvent):void


            var applicationCompletedVar:int = 1;

            trace("Application Complete = "+ applicationCompletedVar);



... that is run when the user clicks the Finish button within the custom .swc. I want to be able to pass that parameter to the main application. Can anyone point out examples of how to accomplish this? Using Flash and loading external swfs into an swf, I would simply dispatch a new event and listen for that event and act on hearing the event being passed. being new to Flex, I'm not sure how to accomplish this.


Thx for any help,


  • Currently Being Moderated
    Apr 13, 2012 2:45 AM   in reply to Chipleh

    Define public variable in main application for eg,


    public var dataValue : String = "Hi";


    Assign value to the dataValue in the SWC component file using FlexGlobals as:


    FlexGlobals.topLevelApplication.dataValue = "Hello Friend";


    Now, trace the value in the event handler in main application which handle event dispatched from SWC. Will get update value of dataValue.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points