ViewStack and custom components...

Hello

I have a viewstack with an id say "myViewStack" Code is below. Then I have a function to do this:

appViewStack.selectedChild = home; or something else...

I guess I'm referencing the container sorta like a switch statement from different points of view I can change using the selectedChild feature? That's how I do it, and I don't know if it's true, although it seems to work * until *.

Any help appreciated.

I get an error 'globalBar' used more than twice. It is a common toolbar, that I want to use and want it to appear in all views/screens in the application. How can I do this and do not have redundant code.

I have this code

< mx:Canvas id = "Home" >
< comps: globalToolBar id = "globalBar" width = "100%" / >
< / mx:Canvas >


< mx:Canvas id = "Issues" >
< comps: globalToolBar id = "globalBar" width = "100%" / >
< / mx:Canvas >

Thank you

-Westside

Westside,

Cannot tell you with certainty if the selectedChild code is correct, but I use it too and have had no problems with it yet.

Is there a reason you can't rename the id on the second page?

For example:





I say with confidence that Flex will not allow you to have two objects with the same ID only, because you can't access both one name.

Hope that helps.

Oz.

Tags: Flex

Similar Questions

  • Display States and custom components

    Hello

    I use a stack view for this application and once the user is logged on to the application that they see this "Home Page" that contains essentially two components as follows:

    It is in my file "AppMain.mxml".

    < mx:ViewStack id = "appView" height = "100%" width = "100%" >
    < mx:Canvas id = "Home" >
    < view: TeacherList id = "teacherList" / >
    < view: StudentList id = "studentList" / >
    < mx: / canvas >
    < / mx:ViewState >

    So in my TeachList.mxml file I have this < mx:ButtonBar > and one of the buttons is 'Add teachers', when this button is clicked, I want to hide the component StudentList using view States and finally display a form for the user on the same screen, so they can add a teacher. If all the code is in a single file, I think I could do it myself.

    I tried to put the tag < mx: states > in the file AppMain.mxml, but given that the < mx:ButtonBar > mxml code was inside a different file, that he did not see the block < mx: states > I added in the file 'AppMain.mxml '. So I then tried to put the block < mx: states > in the same file as < mx:ButtonBar > reality but then how do I access the id of the component (studentList) so I can hide

    Any help much appreciated.

    -Westside

    Yes - you have to control the use of custom events.

    Let me to pseudo code it for you - you'll have to maybe a little research yourself

    (1) create a State which removes the student list and displays the component that you want to display (I'll call it 'state2' for now).

    (2) in your teacherlist component, create the event, something like this:

    [Event (name = "customEventNameHere" type = "flash.events.Event")]

    (3) in your teacherList component dispatches the event:
    public function buttonClickHandler (): void {}
    var eventObj:Event = new Event ("customEventNameHere");
    dispatchEvent (eventObj);
    }

    Call this function when the user presses the special touch in your teacherList component.

    (4) manage the result. Using Flex Builder? If Yes, when you press the space bar on your call to the teacherList component, you will see the "customEventNameHere" event available.

    (5) change of State:
    public void changeTheState(eventObj:Event):void {}
    currentState = 'state2 ';
    }

    I hope that the work - please post back with your results (or mark replied if you get)

    See you soon,.

    David

  • 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 '.

  • 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

  • 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.

  • Architecture for the base product and custom versions of the product

    Hello

    We have a product written in Flex.

    We have several clients who have this product. The product is suitable for every customer.  When you start a new project, copy us the project to a customer who had similar requirements and then make other changes.

    We have this idea of having a layer of base product and then have a customization layer where we can place the project and personalized fuctionalities.   Also: when we update the base product, these updates can be incorporated into custom versions.

    I wonder how you can do this in Flex?

    Thank you

    Juan Esteban

    The development of a good architecture of plugin is * hard *. However, it is certainly worth it. The best approach depends on exactly what you want to do. At a high level, you can:

    1 write the base application and load the plugin modules and allow them to aspects of changes in the behavior of the application or style

    2. put your basic application into a logical application library and a library of custom components (separate) and turn each client application in a new project that pulls out of these.

    If you use dependency injection (e.g., SmartyPants or SwiftSuspenders), you can allow (1) a flexible way to interact with the application without function gynormous objects of 'context '. Simply perform injections on the loaded extensions, and they can pick up all the dependencies without having to worry about what anyone else.

    If (1) or (2) made most sense will depend on exactly what you're trying to do, but in general, (2) is more flexible (1) is a bit simpler (and usually work less by-implementation).

  • Create a personalized and Custom UIComponent are the same in Flex?

    Hello

    I make confusion in the terminology of words regarding the custom components.

    Please let me know if creating a component custom and Custom UIComponent are same in Flex?

    Because I created some custom components based on the container shape based on the screens of my company.

    They both Custom Component and Custom UIComponent means the same thing?


    Please tell me.

    Thanks in advance

    Yes, it's okay...

  • Problem with ViewStack and stream hobbies

    Hi all

    I have a problem with the use of flex ViewStack and re-creation of the view components. I included my code below. Forums, I understand that view stack only changes the visibility and see components once created are not re-created and then initialize and creationComplete events are not triggered when sight change. I used the hide to destroy the view components when ViewStack visibility changes. The hide event method event handler methods are called during component hide. But still the methods initialize or creationComplete see components are not executed. Please can someone tell what is wrong with my code here?

    MainAppl.mxml

    //Firing some events here

    }

    []] >

    < / mx:Script >

    < mx:VBox " width = ' 100 % "height =" " 100% " >

               < mx:HBox width = " " 100% "height =" 5% " >

    < see: MainControlHeaderView / >

               < / mx:HBox >

    < mx:HBox " width = ' 100% "height =" " 95 % " >

    < see: UserListView / >

               < / mx:HBox >

    < / mx:VBox >

    < / mx:Canvas >

    Thank you.

    Roshni

    The view stack takes care to hide and show your child components.  So all you need to do is to listen to the show in your custom comp or its label in the stack and act on it.  Do not destroy or re instansiate anything just act on these methods.

    It seems that your feature is going to be pretty basic on this so I think it will work very well.

    Andrew

  • Custom components &amp; help Webservice

    I built two custom, components based on a button and the other on a graph.

    The Web service has been defined with the following tag in the button component:

    " < mx:WebService id ="ws"wsdl =" http://localhost/Service1.asmx?WSDL « >
    < name mx:operation = "GetData" / >
    < / mx:WebService >

    I want to be able to add a listener for the chart (not the button) component that listens to the webservice result event and refresh the list. It will be a lot of buttons and many rankings for each graph must subscribe to result event of a particular call.

    The structure of my test application is something like this:

    < application >

    < button (call webservice here) >

    < chart (listener event result here) >

    < / application >

    I think it should be pretty simple, but I can't understand it. Any help would be greatly appreciated!

    Ivan

    you would have an arraycollection collection as the dataprovider for the chart component, just update that.

  • 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.

  • Possible bug in custom components

    I think I found a bug when you use custom components. I have a customized TabNavigator which children containers are also custom components. To do this, I can not set properties on custom containers, it fails.
    Here is an example of how do:

    1. create a TabNavigator custom like this: (in this example I'll call her TabN)
    <? XML version = "1.0" encoding = "utf-8"? >
    "< mx:TabNavigator xmlns:mx = ' http://www.adobe.com/2006/mxml" > "
    < / mx:TabNavigator >

    As you can see, there nothing wrong with it, just a custom bar

    2 create a custom like this: (in this example, named reportGrid)
    "" < mx:HBox xmlns:mx = ' http://www.adobe.com/2006/mxml '
    < mx:DataGrid id = "telefonosDG" dataProvider = "{dataGridList}" width="100%"/ >
    < mx:Script >
    <! [CDATA]
    Import mx.collections.ArrayCollection;

    [Bindable]
    public var dataGridList: ArrayCollection collection;
    []] >
    < / mx:Script >
    < / mx:HBox >

    As you can see there's only a dataGrid whose dataProvider is an arrayCollection collection-related.

    3. in your application follow these steps:
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml '
    xmlns:custom = "custom.*".
    creationComplete = "initialize ()" width = "100%" height = "100%" layout = "absolute" > "

    < mx:ArrayCollection id = "testList" / >
    < custom: TabN width = "100%" >
    < custom: reportGrid id = "marketing" dataGridList = "{testList}" width = "100%" height="100%"/ >
    < / custom: TabN >

    < mx:Script >
    <! [CDATA]
    private void inicializar(): void
    {
    var prod1:Object = {};
    var prod2:Object = {};
    prod1. Qty = 1;
    prod1. Index = 1;
    prod2. Qty = 2;
    prod2. Index = 2;
    testList.addItem (prod1);
    testList.addItem (prod2);
    }
    []] >
    < / mx:Script >
    < / mx:Application >


    In theory, when you change the testList these changes should appear in the DataGrid control, but he fails, the DataGrid stays empty.

    Now instead of using the customized TabNavigator (TabN) using a normal component < mx:TabNavigator > and see what is happening, it works perfectly fine, the DataGrid control is populated with the two elements that I added.

    SO, what's the problem here? Is this a bug?

    My friend uses the 2.0.154976 version and on that one, the bug has been fixed

  • 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.

  • Passing data between the component main enforcement through custom methods and custom

    Similar to what this article is talking about, I have a custom list that contains a list of names of State of the United States in chains. (Let's call this states.mxml) #comments http://www.boyzoid.com/blog/index.cfm/2006/11/22/Flex-Custom-Components-and-Custom-Methods

    I create an action script that is included in my states.mxml like < mx:Script source = "myScripts.as" / > so that I can call the method in mySpcripts.as

    Now, what I want to do is, whenever I click on an item in the list, I want this string is displayed on the Application of the hand (on a canvas or Panel) as a label.

    I don't know how I am supposed to refer to the canvas and wood, which lies on the main of the application of myScripts.as
    Is there a way to create an action script file where methods can reference components for the main application and the custom component file?

    Thank you

    this.parentApplication.canvas.label should do what you are looking for

  • My playlists on apple music continues to repeat the first progress song and custom to the next song

    My playlists on apple music continues to repeat the first progress song and custom to the next song

    Hi, tabby1008!

    Thanks a lot for the use of Community Support from Apple! After reading your post, I understand that when you listen to music from Apple, one song keeps repeating instead of skip to the next track, when it finishes. I wouldn't listen to the same song over and over again when Apple's music catalog is so big, so I'm happy to help you!

    First of all, check that the "repeat" feature is not enabled. The following article gives some information about the feature 'repeat' and what to look for.

    Use of music music Apple in the app

    The "Shuffle and repeat your music" section provides this information:

    Shuffle or repeat your music

    Press on at the bottom of the playback screen to mix songs in a playlist or album. Alternatively, you can ask Siri to scramble your music.

    Type once to play entire playlist or album looped or twice to repeat a song.

    When activated, the icon for a repetition will be "BOLD". If this is the case, type just the icon to activate the recurrence at the wide. The next page of this article will show you where these buttons:

    If the repeat function is turned off, try closing the music app using the steps described in the article below.

    Force a nearby application on your iPhone, iPad or iPod touch

    Once the music app is closed, press the icon to open it again and then try to play your songs. If one is always repeat, restart the device. Instructions on the way can be found in the following article.

    Restart your iPhone, iPad or iPod touch

    Good listening!

Maybe you are looking for