Flex 4.1 export of custom components in an Application or Module if used in the Module only?

According to me, Miss me something here:

"Because a module is loaded into a child domain, it has definitions of classes that are not in the area of the main application. For example, the first module to load the PopUpManager class becomes the owner of the PopUpManager class for the whole application because it records the Manager with the SingletonManager. If later another module tries to use the PopUpManager, Adobe® Flash® Player throws an exception.

This technique also applies to components. The module that uses the first has the class of the component definition in its field. Therefore, if another module tries to use a component that has already been used by another module, its definition do not match the existing definition. To avoid a mismatch of definitions of element, create an instance of the component in the main application. The result is that the definition of the component is the property of the main application and can be used by modules in any field of the child. »

I thought that if I use a component in one module then I won't be able to use it in application modules or a brother and I would be able to use it only in the Submodule of this module as the component definitions are in the scope of module which is a child of the scope of the application.

So I just do a simple example: application with 2 moduleLoaders and 2 modules both using the same 3 components:

(1) ButtonBar

(2) DataGrid

(3) CustomSkinnableComponent (empty, just extends SkinnableComponent) with custom skin (with a Rect 200 x 200 px, extends skin).

I start the application--> two modules load without problem. Wasn't this supposed to cause error with the second loading module because the first module contains the definitions of components? Or does not result in an error because the component definitions match and match because my component is in the same project in flex, and in this case there is no problem. Problem will be if I have 2 or more RSL with the same definitions of package and class, but different features?

I do not really understand how to cause incompatibility of definitions component so I can watch to avoid that it... can someone please explain?

I'm confused and I thought I knew this kind of things. What Miss me?

Also one last thing:

I thought that if a module contains component definitions which means it is swf should grow in size-> due to the use of modules. If the application contains the definitions of components would not be what it means the application swf will grow in size and then-> why should I use a module? To save the memory of bodies and images/fonts embeded in the module?

Bearing also in mind that the skin of a component is also a class definition and I incorporate some large images in there, and I use this skin in 2 modules, wouldn't that require skin to be implemented-> big size of swf application and no module swf as it should?

Please someone shed some light in my foggy mind

Post edited by: FM_Flame

Pretty much:

public var foo:Object;

public function runTest (): void

{

If (Application.application.foo is nothing)

Application.application.foo = new SomeClass();

on the other

trace (test (application.application.foo));

}

If you click the first button, then the second, you should see a type

incompatibility.

Tags: Flex

Similar Questions

  • Using custom components will break my site if the framework is updated?

    Using custom components will break my site if the framework is updated?

    For example if I use the tink browser which is a version of the spark of the viewstack: http://www.tink.ws/blog/flex-4-navigator/

    In the case of update of the framework, it is possible that my sites Web stops working due to changes in the basic components used?

    I would like to know how can I design my components to ensure that they stop working?

    Thanks in advance.

    Any updates to the SDK that you recompile against could potentially break the desired site behavior. Could be with the SDK components or ones you've written yourself. It's just the nature of software development. Testing is the key.

  • Custom components and passing arguments

    This afternoon I got a great response on the use of custom MXML components and calling a function in the main file of the application. I can do it now using parentDocument, BUT I need to pass the name of a function (for filtering) as a parameter of the function call in the custom component. Here are two code fragments.

    Custom component code

    " < mx:LinkButton label = '10% discount or more" (showTenPercent) click = "parentDocument.filterFunction" / >

    The main application code

    public function filterFunction(functionName:Function):void {}

    merchantDG.visible =true;

    merchantData.filterFunction = functionName;

    merchantData.refresh ();

    }

    public Function showTenPercent(item:Object):Boolean {}

    return (item.merchantOfferCategory ==' 10% ');

    }

    The filterFunction in main application function is called by multiple components, so I think I should keep centralized in the main application. There is probably another way to do it, but I build my Flex skills slowly and need to understand how to proceed. As the code is now, I get an error on the functions and strings.

    I think instead of calling the function inside the custom component, you must do this from the inside of your main application whenever you are initiating the custom component.

    for ex.

    in this way, that you need not prefix parentDocument.

  • custom - components

    Hello
    I hope that it isn't something obvious... but I searched high and low for a benchmark decent to implement custom components.
    It is not critical, but I would like to place a set of codes < mx: states > in a custom component.
    Can anyone suggest it please if or how this is possible?

    It is important that I'm calling the new State of a VBox inside a TabNavigator?

    Also, while I'm here...
    I'm States okay - kind of... I get the new State (a form) to spend in the upper region of my VBox tab.
    BUT I want the form actually replace the datagrid control, which is the normal display mode when you click the tab.

    Thanks in advance...
    Chris

    Hello again...

    Eureka!
    I went to pages of search help 'parentApplication' in the discovery of the hierarchy.
    .. .came between Flex Applications > uses the container of the Application > object on the Application
    where I found the refernce to mx.core.UIComponent.parentDocument, then
    "You can use parentDocument.parentDocument to back up the tree of multiple documents.

    So, I replaced 'parentApplication' with 'parentDocument' in the file states_TaskMgr_addNew.mxml...

    ... and it worked.

    Thanks again for your help... it was a great experience.
    See you soon,.
    Chris

  • Disappeared from custom components

    I have some custom components in my app and when I opened Eclipse with the Flex SDK kit it shows red boxes with X inside. I'm going to fashion, the design pane Explorer and it shows the empty custom folder. I have my custom in this namespace. I restarted Eclipse, deleted and recreated the project and nothing. Any ideas?

    turns, I got back my components to another folder. Remove the component in Eclipse, create a new component of the same name in Eclipse. Copy and replace the new file with the backup file. I suppose that Eclipse was not save files for some reason any.

  • To access the elements of a call from the custom components page

    I'm sure that it's simple, but I have searched for hours and find nothing.

    I have my main mxml page various controls and a HTTPService. From this main page to include a component custom.

    Everything what I'm trying to access the main page in custom components gives me "access undefined property error."

    What Miss me?

    Should be a little bit more about your custom component and what you are trying to access. Normally, when you access objects outside the scope of the current element it is advisable to raise events.

    However, if you simply 'dot' your way to scope enforcement check out
    http://livedocs.Adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=live Docs_Book_Parts & file = app_container_064_11.html

    parentDocument and enforcement will probobly you get what you are looking for.

    If this does not address your situation, your zip code and will bring a more detailed solution.

  • Export of custom to another logic/computer icons

    I would like to export my custom icons LPX to an iMac, in a city far from my Studio, where I teach a course on Logic Pro X. could I do?

    Hello

    Go to the order of icons in the header of the track, click the control on one and choose 'show in Finder '.

    Copy the icons in the Finder.

    TDC

  • export of custom code C data type

    Hello

    I wonder, in TestStand, is there a way I can export a customized data type to the type C struct definition?

    I use TestStand 4.2

    Thank you.

    Peggy

    You will need to make a series of API calls, I think.

    I suppose that you have an active container with passing C struct type, otherwise you will have no subproperties in C data types match. Then the following API functions should help you:

    • GetNumSubProperties gives you the subproperties number in the type of container. Then you can make a loop on them. For each

      • GetNthSubPropertyName to get the name of the Member in the type of container.
      • GetStructMemberType gives you the type C, a subproperty maps to.
      • GetStructMemberStringBufferSize, GetStructMemberStorage and GetStructMemberArrayStorage tell you, how structs and arrays are stored in the container (inline, pointers...)
    • GetStructPacking gives you the padding byte used to pass the struct. For Visual C++, for example, this can be translated into a #pragma pack surrounding the type.

    I think you need to use standard Win32 file operations to actually write the information in a header file, as the built-in functions of WriteFile of TestStand write AFAIK TestStand file formats.

    Maybe someone knows an easier way. Hope that helps, anyway.

    Concerning

    Peter

  • Any request for a list of the custom components in system

    Hello

    Is there any question to find the list of the custom components in the system.

    Concerning

    Jagadish

    What is the purpose of a list of custom components?

  • Lack of export presets custom after update

    After SOUL update with the latest update and Premiere Pro my custom export settings I created when exporting from Premiere Pro after that opens the export window is missing. What is a Premiere Pro question or the question of the SOUL. Parameters are created in the export window that opens on the front. I understand there is a window to check what update that allows the selected settings, which I believe is checked by default. Would like an answer for future updates please. This is on a Mac, if that makes a difference.

    Thank you

    I found the file with the old presets so I just copied to the new folder and the presets are back.

  • Custom components in FXML

    Hello

    I want to set in the FXML a custom component, something like MyTreeItem, which extends from TreeItem. To do this, I created a MyJavaFXBuilderFactory to return the correct constructor (MyTreeItemBuilder). MyTreeItemBuilder returns instances of MyTreeItem.

    Note: Below, I send my courses and my tree.fxml.


    Is it possible to include in the custom components of fxml?



    When I run my application, I got this error:

    com.sun.javafx.fxml.PropertyNotFoundException: "myvalue" property does not exist or is read-only.

    at com.sun.javafx.fxml.BeanAdapter.put (unknown Source)

    at com.sun.javafx.fxml.BeanAdapter.put (unknown Source)

    to javafx.fxml.FXMLLoader$ Element.applyProperty (unknown Source)

    to javafx.fxml.FXMLLoader$ Element.processPropertyAttribute (unknown Source)

    to javafx.fxml.FXMLLoader$ Element.processEndElement (unknown Source)

    to javafx.fxml.FXMLLoader$ ValueElement.processEndElement (unknown Source)

    at javafx.fxml.FXMLLoader.processEndElement (unknown Source)

    at javafx.fxml.FXMLLoader.load (unknown Source)

    at MainWindowTree.start (MainWindowTree.java:33)

    to com.sun.javafx.application.LauncherImpl$ 5.run (unknown Source)

    to com.sun.javafx.application.PlatformImpl$ 4.run (unknown Source)

    to com.sun.javafx.application.PlatformImpl$ 3.run (unknown Source)

    at com.sun.glass.ui.win.WinApplication._runLoop (Native Method)

    in com.sun.glass.ui.win.WinApplication.access$ 100 (unknown Source)

    to com.sun.glass.ui.win.WinApplication$ $2 1.run (unknown Source)

    at java.lang.Thread.run(Thread.java:722)



    Tree.fxml



    <? XML version = "1.0"; Encoding = "UTF-8"? >



    <? import javafx.scene.layout. *? >

    <? import javafx.scene.control. *? >

    <? import javafx.scene. *? >

    <? import javafx.geometry.Side? >;

    <? importdummy.tree.MyTreeItem? >;



    < xmlns:fx VBox = "http://javafx.com/fxml" >

    < children >

    < showRoot TreeView = "false" fx:id = "treeView" >

    < root >

    < TreeItem value = 'Root' >

    < children >

    < MyTreeItem myvalue = "Node1" fx:id = "treeItemNode1" >

    < children >

    < TreeItem value = "none" / >

    < / children >

    < / MyTreeItem >

    < children >

    < / TreeItem >

    < / root >

    < / TreeView >

    < / children >

    < / VBox >



    Classes:



    package package dummy.tree;



    Import javafx.scene.control.TreeItem;



    SerializableAttribute public class MyTreeItem extends TreeItem {}



    public Object getMyvalue() {}

    Return super.getValue ();

    }

    public void setMyvalue (Object value) {}

    super.setValue (value);

    }



    }



    package dummy.tree;



    Import javafx.fxml.JavaFXBuilderFactory;

    Import javafx.util.Builder;

    Import javafx.util.BuilderFactory;



    Import dummy.tree.MyTreeItem;





    / public class MyJavaFXBuilderFactory implements BuilderFactory {}



    private JavaFXBuilderFactory javaFXBuilderFactory = new JavaFXBuilderFactory();



    class MyTreeItemBuilder implements {Builder < MyTreeItem >



    @Override

    public MyTreeItem build() {}

    return new MyTreeItem();

    }



    }



    @Override

    public Builder <>? getBuilder (class <>? clazz) {}

    If (clazz.equals (MyTreeItem.class)) {}

    return new MyTreeItemBuilder();

    }

    Return javaFXBuilderFactory.getBuilder (clazz);

    }



    }



    package dummy.tree;



    import java.io.InputStream;

    import java.net.URL;



    Import javafx.application.Application;

    Import javafx.fxml.FXMLLoader;

    Import javafx.fxml.JavaFXBuilderFactory;

    Import javafx.scene.Scene;

    Import javafx.scene.layout.Pane;

    Import javafx.scene.paint.Color;

    Import javafx.stage.Stage;



    SerializableAttribute public class MainWindowTree extends Application {}



    Public Shared Sub main (String [] args) {}

    Application.Launch (null);

    }



    @Override

    public void start (s phase) {}

    Location of the URL = getClass().getResource("/com/dbn/ui/theme/default/tree.fxml";);

    FXMLLoader fxmlLoader = new FXMLLoader();

    fxmlLoader.setLocation (rental);



    MyJavaFXBuilderFactory fxBuilderFactory = new MyJavaFXBuilderFactory();



    fxmlLoader.setBuilderFactory (fxBuilderFactory);

    InputStream inputStream = null;

    try {}

    inputStream = location.openStream ();

    Root = fxmlLoader.load (inputStream) (component) component;

    Scene = new scene (root, 800, 600, Color.TRANSPARENT);

    s.setScene (scene);

    s.Show ();

    } catch (Exception ex) {}

    ex.printStackTrace ();

    }

    }



    }

    Hello

    When you include the code (and the stack traces) in your forum messages, please include in a tag {code} as shown: https://forums.oracle.com/forums/ann.jspa?annID=1622 this makes it more easy for us all to read.

    Your code is sort of ok, but you have a lot of typos in your FXML and your Java code. Try searching for the code below instead. You don't actually have a constructor or by the way, it will work only without it.

    Try this FXML:

    
    
    
    
    
    
    
    
    
        
            
                
                    
                        
                            
                                
                                    
                                
                            
                        
                    
                
            
        
    
    

    With that for your item custom:

    package dummy.tree;
    
    import javafx.scene.control.TreeItem;
    
    public class MyTreeItem extends TreeItem
    {
        public Object getMyvalue()
        {
            return super.getValue();
        }
    
        public void setMyvalue(Object value)
        {
            super.setValue(value);
        }
    }
    

    And for launch:

    package dummy.tree;
    
    import javafx.application.Application;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    
    public class TestApp extends Application
    {
        public static void main(String[] args) throws Exception
        {
            launch(args);
        }
    
        public void start(Stage stage) throws Exception
        {
            Parent rootNode = FXMLLoader.load(getClass().getResource("/tree.fxml"));
            Scene scene = new Scene(rootNode, 800, 600);
            stage.setScene(scene);
            stage.show();
        }
    }
    

    Also, I guess it is just a test case, but you don't need to provide your own "myvalue" getters/setters when this is delegated to super. Just use the 'value' property directly in your FXML.

    A view Naming Convention, it should be myValue with getMyValue and setMyValue (e.g. capital 'V'). FXML is case-sensitive too, so if you change, you need to change your FXML for use myValue instead.

    Hope that helps,
    zonski

    Did you find this answer useful? If so, please mark it as 'Correct' or 'useful '.

  • Create custom components: lack of problem MovieClip

    Hi guys,.

    I've been creating reusable components customized for a while now, but have noticed a problem with one of my components.

    I have two Clips that represent the status of a phone operator, I want to be able to be styled individually; unavailable, available. The two video clips are found in component assets/_private folder in the library, as well as a container that I use for positioning and swapping/addChild/removeChild every two clips. The bin is emptied when the component is loaded, and then depending on the update settings, the relevant clip is loaded in it, using the AS3 class file.

    Now on the real state of the component I have positioned available clip, and one not available does not exist on the stage.

    When I create the hold and run the MXI to package the component in a distributable ZXP file unavailable clip seems to disappear from the packaging.

    Each video clip in the library needs to exist on the stage so that it can be included in the package? Or I can specify which elements should be included.

    Would be great for this answer! Because it is a very confusing subject!

    I have all of the CBC can send on request, cannot appear to download here.

    Concerning

    Charlie

    OK, I found how to fix this.

    All clips must be placed on the stage in one way or another, either inside the container movieclip (should be deleted on common language runtime) or you can simply place all movieclips on the 2nd picture of a layer on the component, as it is disabled when the component is run.

    Hope this helps anyone else having this problem

  • Communication between two custom components

    Hello

    I have a problem to get action in a custom component to cause a refresh of another custom component?

    My configuration is:

    < application >

    < component includeIn custom 1 "View1" >

    < component custom 2 id = "custom2" level = "{level}" "view2" includeIn >

    < component custom an includeIn 'View1' >

    < component includeIn custom B "view2" >

    < / application >

    I have a number of custom components load in my main application window.

    In the custom component 1, I have a drop down menu which determines levels 1 to 10.

    When the user chooses a new level, change an event is triggered and the dispathed to the main application that receives it in the UpdateDisplayHandler.

    Component event dispatcher custom 1:

    protected function level_changeHandler(event:IndexChangeEvent):Sub

    {

    var newDisplay:UpdateDisplay = new UpdateDisplay ("UpdateDisplay", level.selectedItem.value);

    dispatchEvent (newDisplay);

    }

    Main application manager:

    protected function updateDisplayHandler(event:UpdateDisplay):Sub

    {

    Level = event.level

    }

    Level information comes to the manager who updates the "level" variable correctly. So far so good.

    The variable "level" is can be linked and analyzed for the custom component 2.

    < components: custom2 id = level "custom2" = "{level}" / >

    The question is how to make my component custom 2 refresh(), reload() then it makes again based on new information of level?

    I will be grateful for any help on this matter.

    Karsten

    Is probably not the cleanest way, but he's going to move you quickly.

    public var levelNumber:int = new int;

    implement

    private var _levelNumber:int;

    public function get levelNumber (): int

    {

    Return _levelNumber;

    }

    public function set levelNumber(value:int):void

    {

    If (value! = _levelNumber)

    {

    _levelNumber = value;

    call the custom here update refresh method

    }

    }

    I don't know your usecase or your architecture so there are probably better ways.

    Maybe like this:

    The main application event handler:

    protectedfunction updateDisplayHandler(event:UpdateDisplay):void

    {//check if there is a change in level and exposes a public service on the part 2}

    If (level! = event.level)

    {

    Level = event.level;

    COMPONENT2.updateOrRefreshBasedOnNewLevelValue (Level);

    }

    }

    HTH,

    Claudiu

  • Is it possible to mark several custom components in the same namespace prefix?

    Hello

    I've referenced several .swc library in my Flex project. The problem is that what I realized, is that they do not have the same namespaces, so that I have set a separate for each .swc file label, such as my Application tag looks like this:

    " < = xmlns:fx s:Application ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx".
    xmlns:test = "" some.namespace. * ""

    xmlns:Test2 = "" some.otherNamespace. * ""

    < / s:Application >

    In this example of a reference library components would be called by the prefix of the trial, while another reference library will be called by the prefix test2.

    I realize that the simplest solution would be to combine all the components into a .swc file, but it is important to separate the .swc files as it is (one of the reasons is that I don't have the source files for most of the .swc to merge together).

    So is it possible in Flex to define several namespaces for a tag prefix, or they are strictly a one-to-one relationship?

    Thank you

    Patrick

    No, the link I mentioned did not mention on the fusion of everything together, he mentioned on the unique prefix for all components in a .swc, if you have access to the source of the library, you can follow the steps mentioned in the link to get a unique prefix, or well, it's a bit impossible to do without access to the source.

  • Modular or new approach by custom components: Please suggest


    Hello

    I'm developing a Flex Application that will used in the organization employees

    Please suggest me what to do to develop this:

    After a user (used), a connection to organization, it may be authorized to perform operations
    According to the different modules.

    Should I develop each of these things with Flex Modules approach or the normal component again?

    Please suggest an approach

    @kiran7881,.

    If your each module is individually large and involves a lot of code and stuff and if number of these modules is more then you can go with the concept of modules.

    Otherwise if your stuff means small operations and simple to perform then you can go with creation of normal approach of components.

    Thank you

    Jean Claude

Maybe you are looking for