Skip navigation
Cuong.Tran
Currently Being Moderated

Flex 4: Module issues

Aug 27, 2009 8:51 AM

Hi everybody.

My company using flex 3 and now upgrade to flex 4. I have the problem when using module in flex 4.

I create module in Flash Builder, and the default, Flash Builder create module by extend mx:Module. In this module i creaate ComboBox(mx) and Button(spark) for example.

 

In the main application, the first, if i using ModuleLoader tag and specify url of ModuleLoader than application load module ok. But the project is too large, and main application can not load static module. So i define module in xml file. If i using ModulerManager.getModule(url).load() then error occur. Or if i loaded completly, when module init it throw error that skin for control that i create in module has not skin.The problem occur when i do not set skin class style. And it not occur if i set skin class style.

 

So, what i need do before add module into main application, i do not want specify skinclass for all control in my module(i think the default skin load, but not).

Anyone please help me.

Thanks.

Attachments:
 
Replies
  • Currently Being Moderated
    Aug 27, 2009 10:01 AM   in reply to Cuong.Tran

    Are you defining the module in .AS or .MXML?  You should be using .MXML to define a module with styleable components.  The styles are not linked in if the module is defined in .AS

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 27, 2009 11:16 PM   in reply to Cuong.Tran

    I am unable to open the zip file.  Sometimes it takes a while before the server will serve it.  If you can paste in code snippets it might help.

     

    Remember that Flex 4 uses CSS namespaces so maybe you haven't fixed up the namespaces properly.

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 28, 2009 12:18 AM   in reply to Cuong.Tran

    When I run your code, I get problems whether I use moduleLoader or not.  Modules containing spark components are not fully supported at this time.  I thought you were still using Flex 3 components.

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 28, 2009 7:55 AM   in reply to Cuong.Tran

    It will.  You can use -keep-all-type-selectors on the main app to try to get styles to work across modules as a workaround for now.

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 28, 2009 8:43 AM   in reply to Cuong.Tran

    First, do not use Loader, use ModuleManager.  Your example had some errors in the CSS.  You have to use ClassReference compiler directives for skins and other classes.

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 28, 2009 9:18 AM   in reply to Cuong.Tran

    Make sure you use -static-rsls when compiling modules.

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 29, 2009 7:30 PM   in reply to Flex harUI

    I was able to compile and run your application by changing one line of the application. I changed

     

     

    this.addChild(info.factory.create() as DisplayObject);

    to

     

     

    this.contentGroup.addElement(info.factory.create() as IVisualElement);

     

    Compiling modules to load RSLs is not necessary, assuming the main application is loading all the RSLs the module needs. But you should not need to compile your application with -static-rsls=true to avoid errors. If your errors go away when using -static-rsls=true it means there was an error loading the RSLs. Check your Flash Player log to see if there are other errors.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 30, 2009 7:07 AM   in reply to Darrell Loverin

    I should have said I didn't get the same VerifyError that you did. I compiled the application and module within Flash Builder. My guess is you are compiling the module with framework.swc on the external library path but the main application is not loading the framework RSL. Try removing any extra libraries you have on the external library path when compiling your module.

     

    One improvement to my change. You don't need to specify this.contentGroup. The application knows the content group to add the module to so the line could have been written like this:

     

     

     

     

    this

     

     

    .addElement(info.factory.create() as IVisualElement);

     

     

     

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 21, 2009 12:18 PM   in reply to Cuong.Tran

    I am about to start developing some complex modules. From what I am understanding, by the time gumbo is released modules will be radically different from how they are now? Do you imagine big fundamental changes, or minor ones that may not even need re-coding?

     

    Cheers,

    Baz

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 15, 2009 7:04 PM   in reply to Flex harUI

    Are spark controls in modules now supported with Gumbo Beta 2 (or any nightly sdk)?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 16, 2009 10:46 AM   in reply to KenichiM

    Since my last post I built an entire spark application as a module of a bigger spark application, and everything is working perfectly well. The only difference I see (which is expected) is that it takes the app longer to load with a module, probably because the module is being loaded using a separate http call. Over-all it was smooth sailing using modules with spark and halo.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2009 6:26 AM   in reply to Flex harUI

    Alex,

     

    Is there any more information posted somewhere on the limitations of Spark components within Modules?

     

    I tried searching the bugbase, and the version filtering is not very intuitive to say the least (the drop down selections do not seem to match what is displayed as the version in the results).

     

    We're having trouble with setting the layout to "absolute" in an essentially Spark module (of course, the module is Halo, but all of the children are Spark components). I should probably note that the module is sub-classed (actually a couple of levels) and the children are added dynamically.

     

    In the constructor (of the module sub-class), when the layout is set to "absolute" the module is not renderer on the stage. If we remove that layout = "absolute" everything displays as it should.

     

    Any thoughts?

     

    Thanks!

    Kirk

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2009 11:17 AM   in reply to Kirk_Holbrook

    Recent nightly builds should not have functional limitations.  That said, I'm sure there are some that we don't know about or I'm not remembering, so if you run into one, file a bug or post a simple test case in the forums.

     

    But for sure, use -static-rsls when compiling modules if you are using rsl-linkage for the main app (which is the default).

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    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