4 Replies Latest reply on Sep 22, 2006 1:43 PM by peterent

    Question about SWFLoader

    dimival Level 1
      I am using the SWF Loader to load other Flex applications but i was wondering if you can pass parameters a to a swf when you load it.
      For example:

      Application 1 has a label to show a message
      Application 2 loads application 1's swf and passes a string to show in the label of application 1

      Is there any way to do this? is it possible? if it does, how????
        • 1. Re: Question about SWFLoader
          leotemp Level 1
          im pretty sure there is like a params property you can specify in the html of your parent document

          <param name="YourParamNAme" value="YourValue" />
          • 2. Re: Question about SWFLoader
            peterent Level 2
            If you do:

            <mx:Label id="messageLabel" text="Something would go here" />

            <mx:SWFLoader source="otherapp.swf?thatLabel={messageLabel.text}" />

            WIthin the otherapp you can access the thatLabel parameter through the Application's parameters object:


            where the parameter name is a key to the parameters object:

            var someLabel:String = parameters.thatLabel;
            <mx:Label text="{someLabel}" />
            • 3. Re: Question about SWFLoader
              dimival Level 1
              Let's see if i got it right, first i do pass the parameter using ?propertyName = value like this:

              <mx:SWFLoader source="otherapp.swf?thatLabel={messageLabel.text}" />

              then in the code of the loaded application i recover this by using the parameters property, like this:
              var someLabel = parameters.propertyName

              is that right?
              • 4. Re: Question about SWFLoader
                peterent Level 2

                <mx:SWFLoader source="otherapp.swf? thatLabel={messageLabel.text}" />


                var someLabel = parameters. thatLabel

                The request parameter (thatLabel in this case) is the name of the property in the parameters object.