2 Replies Latest reply on Jun 10, 2010 12:50 AM by Dajji

    How to load a Custom MXML Component??

    kiran7881 Level 1

      Hi ,

       

      I have made a custom MXML Component based on Form Container , say it has a name called as UserForm.swf .

       

      Upon clicking on a link button , i want to load this UserForm.swf .

       

      Can i use a SWFLoader inside the LinkButton event Listener for this  ??

       

      Or please tell me a appropiate way to do this .

       

      and One more question :

       

      Is it possible to use a navigateToURL() to load the UserForm.swf  ??

       

      Thanks in advance

        • 1. Re: How to load a Custom MXML Component??
          Rdsingh Ldh Level 1

          Hey,

           

          If you wan to load seprate mxml component in flex application you can use ViewStack to load the component in your application...... I suggested for ViewStack because you said it is mxml component and if you have to load the different mxml modules then you can use SWFLoader to load the module

          • 2. Re: How to load a Custom MXML Component??
            Dajji Level 3

            MXML components do not have any swf output. These are just classes within your code. You can create instances of your components within MXML or ActionScript.

             

            For MXML your can use following method:

            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:mycomps="com.mycomonents"/>
                 <mycomps:UserForm>
                 </mycomps:UserForm>
            </mx:Application
            

             

            For ActionScript you can use this:

            import com.mycomponents.*;
            
            public class MyClass{
            
                 function MyClass(){
                      var userForm:UserForm = new UserForm();
                 }
            }