Revert custom component to default state?

I am building a website which has multiple pages, and within those pages are image galleries. I have used custom components for the galleries so i dont end up with an unmanagable amount of main pages. (15 pages containg galleries of up to 7 images) The problem is when you navigate away from a page and then back to that page the custom component remains in the state it was left in, obviously you would want an image gallery to always revert to the first image. (this is also the case with flvs) Is it possible to make a component revert to a particular state? I dont realy have to skills to do it in builder or anything unless it was very simple.
thanks!

Hi lucky_p,
There is a great post on the FlashCats blog that explains how to get  components to reset after a state change; I think this may answer your  question:
How do I get Flash Catalyst components to reset after changing states?
Hope that helps.
Regards,
Kim

Similar Messages

  • Custom Component vs. States

    Dear Catalyst team,
    After trying to work around the 15 states limitation by converting them into custom components. I ran into the problem that the pages of those custom components have the tendency to change their apearance relatively to the first page of the custom component. As a result, moving a button element up a bit from the first page to the next will, when running, move the same element up EACH time I click it, moving it out of the screen eventually. Is there a way to anchor the elements in a custom component? Otherwise, by the complex nature of my project, I might run into a dead end. Please let me know if you know of any solution.
    All the best,
    Wulffrunner

    ok, got it:)
    so how about this:
    Can I trigger action sequences outside of the custom component
    using buttons that are in the custom component, and vice-versa?
    Haven't found a way to do this yet...

  • States in a custom component

    I am having a problem getting my states to view correctly from a custom component.
    I call in the custom component that has states in it, and they do not view correctly.
    Here is an example:
    The states from my custom component:
    <mx:states>
            <mx:State name="state1">
                <mx:RemoveChild target="{formitem3}"/>
                <mx:RemoveChild target="{hbox4}"/>
                <mx:RemoveChild target="{vbox1}"/>
                <mx:RemoveChild target="{panel24}"/>
                <mx:AddChild relativeTo="{hbox3}" position="before">
                    <components:SensitivityValue2 variableString="Capital Cost Multiplier" unitsString="" close="currentState=''"/>
                </mx:AddChild>
                <mx:RemoveChild target="{button31}"/>
            </mx:State>
            <mx:State name="state2">
                <mx:RemoveChild target="{formitem3}"/>
                <mx:RemoveChild target="{hbox4}"/>
                <mx:RemoveChild target="{vbox1}"/>
                <mx:RemoveChild target="{panel24}"/>
                <mx:AddChild relativeTo="{hbox5}" position="before">
                    <components:SensitivityValue2 variableString="Replacement Cost Multiplier" unitsString="" close="currentState=''"/>
                </mx:AddChild>           
                <mx:RemoveChild target="{button1}"/>
            </mx:State>
    and here is how I am calling in the custom component to my main application:
    <components:MyCustomComp id="customComp" width="100%" height="100%" label="CustomComp"/>

    when you switch to a state (by click a button) it should just move some icons down and
    insert a panel.
    And when you switch back it should just move everything back up and remove the panel.
    What does happen is nothing, or an error, or it adds the panel to a strange location.

  • Reset custom component

    Hello!
    I have an app with some states.
    Each state shows a different custom component.
    My problem is that if someone types somthing in one of the states then changes state and then comes back the text will still be there.
    Is there a way to reintitialize the custom component on each state chage or do I have to create functions to reset everything myself?
    Thank you!

    Ok, thank you.
    Were they only Form fileds it would have been nice and easy.
    I have some AMF calls etc.
    I could probably remove the component with removeChild and add it when it's accessed again I guess, but that doesn't seem too elegant.

  • Interactions to custom component stopped working

    I have created a beta site with 6 Page States. The last state has a custom component state that has 9 states of its own. The icon on Page 1 was clickable and transitioned to State 1 of Page 6, but when I linked the remaining 8 icons on Page 1 (for a total of 9) to their component states' variation; it stopped all transition to page 6 stopped. The transitions/interaction to Page 9 w/ custom components stop working. Is their a limit to the number of  these states? All other transitions to the remaining pages are working beautifully! This is a cool program. I almost completed a project without any help other than the videos.

    Gotcha. There is no limit to the number of objects per state of a custom component, and there is no problem with having text and an image in the same custom component.
    I think your explanation of states, transitions, and custom components might still be a little confused, so let me try to explain it a different way:
    Your main application has a set of states, aka views or places the user can go. You can create transitions that play when the user goes from a state to another state - so there are two transitions for every pair of states (A -> B and B -> A). It also has a set of objects (aka layers) which you can see in the Layers panel. Some objects only exist in one state, while some objects appear in multiple states.
    A custom component is like an enclosed microcosm of the main application. You can create states, and define transitions between pairs of states. You also define the set of objects in the custom component. These objects may exist in one or more states of the custom component, but are separate from the objects in the main application.
    There's no such thing as a transition from a state of the custom component to a state of the main application, or vice versa. Each component (the main application and the custom component) has its own set of states and transitions between those states. Likewise, each component has its own set of layers, and cannot manipulate the layers of other components.
    When you have an instance of a custom component in your main application, you can set its visibility, position, and other properties in each state of the main application, but you can't make changes to its layers between states of the main application. One property that you can change is its its state (either by creating an Interaction, or by creating a "Set Component State" action in a timeline). Setting its state will cause it to play the transition that exists from its current state to the new state, if such a transition exists.
    Does that make sense?
    -Adam

  • How Do I Link to Custom Component States From Scrolling Content Buttons?

    Hi there, I'm in need of some help as i've got a deadline to meet within the next few weeks and im stuck!
    Basically what I've done is i've made a scrolling content lists, containing about 10 products in each one, my plan was to turn each product into a button so that users could click on that product, and take them to a new page containing more detailed information on that product; when they've finished looking at that product they can click a button to return them to the list they were on previously. However I can't just make a brand new state for each product as there is a limit to 20 states, and I will need around 50 of them.
    So, from what i've read I will need to create custom components. the only trouble with doing this is that I can't link to the custom component on a different main timeline state (I dont get the option to link to the states of the custom component).
    If i put the image of the detailed product into the scroll panel I am able to link to it, however, it's inside the scrolling content and it just scrolls around and stuff which isn't what I want; as it makes it look messy.
    - Basically I just need to link from the buttons in the scrolling list, to a more detailed page for that product. Then be able to return to the list using a button.
    If anybody has any input on how to achieve this, please help me out. Starting to panic now as this needs to be finished before september :s
    Btw i'm happy to share my .fxp file it that helps.
    Thanks alot, Hoping for some helpful replies on this topic
    - Tom

    Hi Tom,
    Adding this back here to share my wireframe with the community.
    Have put a quick .fxp together based on the 'product' section of your project.
    Take a look at how the product lists are linking into the product detail pages within their custom components. 
    Using this model you should be able to expand out to infinite product detail states.  If a particular product area has more than the maximum allowed states, just start a new custom component (part 2 for that product section).
    Let me know if you have any questions. Hope this sets you on a path to getting your project complete.  It's looking nice.
    Tanya

  • Change base view state from a custom component

    I'm pretty new to flex and I'm having a small issue in change the view state from a component.
    My Application have 2 custom components called userlogin and main menu. In the main application page I have userlogin component in one state and the main menu component in another. I'm trying to change the state if the login in successful from user login to main menu. I have the following function written inside the login component.
    private function IsUserLoggedIn(evt:ResultEvent):void
                    if (evt.result.islogin.toString() == "true")
                        currentState = "MainMenu";
                    else
                        Alert.show("Login failed, please try again.", "Login Failed");
    This code worked when I had all the controls in the main page. But then I created components and included them in to components and now when the login is success, its giving the following error.
    ArgumentError: Undefined state 'MainMenu'.
        at mx.core::UIComponent/getState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UI Component.as:9908]
        at mx.core::UIComponent/findCommonBaseState()[E:\dev\4.0.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9928]
        at mx.core::UIComponent/commitCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\core\UIComponent.as:9750]
        at mx.core::UIComponent/setCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\ core\UIComponent.as:9701]
        at mx.core::UIComponent/set currentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6087 ]
        at components::UserLoginForm/__btnSubmit_click()[C:\Projects\WarrantyAutomation\src\componen ts\UserLoginForm.mxml:60]
    I'm sure this has something to do with accessing the states from a custom component, but I do not know how to change the state to the main menu. Please help me with this. Any help is greatly appriciated.

    Hi dasun1981,
    private function IsUserLoggedIn(evt:ResultEvent):void
                    if (evt.result.islogin.toString() == "true")
                        currentState = "MainMenu";
                    else
                        Alert.show("Login failed, please try again.", "Login Failed");
    If I am right the above function is in your userlogin component and the two components "userlogincomponent" and "maincomponent" are in main application file and the states were also defined in main application file.
    But in the function above the currentState refers to the state of the userlogin component and not the main application ...but the states are defined in main application file...that's the reason why the exception was thrown...
    Instead you replace the line in the above function with the below line:
    Application.application.currentState = "MainMenu";
    Please mark it as answer if it helped you.
    Thanks,
    Bhasker Chari

  • How to add default values when adding custom component to design view?

    I have a set of custom components (usually) extending Spark components. But when adding our custom component onto design view, how can I define defult values (in AS3).
    For example, s:Button has default label = 'Button' when added to application, or mx:DataGrid has 3 columns predefined, but when using custom components there are no predefined values like this.
    I can put this values in constructor, but they are not visible in design time, only runtime.
    Any ideas? Thanks
    Esmin

    yes, I am. By the way I've found the solution. Someone might find this usefull.
    In design.xml having
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput"/>
    use this
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput">
            <defaultAttribute name="text" value="ExtendedTextInput"/>
        </component>
    so when adding this component to design view, it will have text setted to value ('ExtendedTextInput' in this case).

  • Changing state of application from within a custom component

    Hello, I have several custom components all of which are included in the parent application.
    When I try to change state from a custom component, I get an error  saying "undefined state: state name". How do I change the state of the  application from within a custom component ? All the states are defined in the parent application.

    @linrsvp,
    If you are using Flex3 try Application.application.currentState = "somestate";
    If you are using Flex4 try FlexGlobas.topLevelApplication.currentState = "somestate";
    Don't forget to import the corresponding namespaces for the above.
    Thanks,
    Bhasker

  • Creating a button that leads back into the main Pages/States from a custom component

    Hello Y'all! isnt F.C. awesome!
    BUT... just cant get a button that leads from a custom component ive made back into the main bulk of pages and states ive created to work.
    it runs a bit like this:
    Main title page...
                            Photography...
                                                 Nature (on which theres a Custom Component which when clicked leads to...)
                                                            20 different custom component states each with different pics, linked via buttons
    from each of which id love a button that led back to Photography, exiting the custom component
    ive tried the basics:      Add interaction.. when clicked.. play transition to.. state: Photography
    but to no avail
    any ideas? im at a loss!
    thanks in advance,
    Tom

    Cross component communications are an issue in Flash Catalyst 1.0. Thankfully, in Flash Catalyst 5.5 the team addressed some of those issues.
    The only idea I have for remove the 'return' button from within the component, then it should be able to get you back to the home state.
    Or, you might be able to wait a few weeks for the new version of Flash Catalyst to ship (or you can play with the older preview release on labs.adobe.com)
    Chris

  • Custom ui component with default layout

    Hello,
    I am trying to develop custom swing components with default layout set.
    Both component class and its BeanInfo are written with NetBeans 6.1
    However, when trying to put this custom swing component into interface builder (matisse) of
    NetBeans 6.1, the default layout is always replaced with GroupLayout.
    Is there any way to correctly specify default layout manager used in a custom
    swing component?
    thanks a lot!

    Hi Jacek
    You can embed your custom component with IFrame element in WebDynpro view. IFrame element loads a content by URL which can be bound to controller's context. You can store your custom HTML content in MIME folder of the WebDynpro component. At runtime you can get the URL to the MIME content and initialize the IFrame with the URL.
    However, IFrame element is being reloaded by WebDynpro framework too often during each request/response cycle. This is a disadvantage of the solution.
    BR, Siarhei

  • Component property declaration in a Custom Component

    Hello everyone,
    I have a question related to a custom component. I will define a use case and how I want to define a property.
    e.g.: I develop a custom component using Flex Library Project, with all manifest.xml, design.xml, locale etc. My component name is CustomList, now in this component, I define a property with following getter/setter.
    //  defaultState
    private var _defaultState:CustomState;
    [Bindable( "defaultStateChange" )]
    //I have tried defining type property as CustomState, doesn't works
    [Inspectable( category="General",  name="Default State" )]
    public function get defaultState():CustomState
         return _defaultState
    public function set defaultState( v:CustomState ):void
         if ( _defaultState!= v)
              _defaultState = v
              dispatchEvent(new Event("defaultStateChange"))
    Here, CustomState extends MXMLObjectAdapter and defines a id property and few other property. and In mxml I can define it like this,
    <CustomList ....>
         <defaultState>
              <CustomState label="" icon="" />
         </defaultState>
    </CustomList>
    Now, what I want to achieve is, I want to define property something like this:
    <CustomList ....>
         <defaultState label="" icon=""/>
    </CustomList>
    Can someone tell me how to achieve this and point me to some description about it.
    Thanks in advance.
    Chetan Sachdev

    @Ryan:
    Thanks for your reply. For type property in Inspectable metadata tag: http://livedocs.adobe.com/flex/gumbo/html/WS2db454920e96a9e51e63e3d11c0bf680e1-7ffe.html#W S2db454920e96a9e51e63e3d11c0bf69084-7a21
    It can have values like Boolean, Array, String etc. I am trying to have a custom one. But I notice that I have to close the property tag, even if it is a string or html for e.g. text property in TextInput, I have to write something like this:
    <mx:TextInput>
            <mx:htmlText>
                <![CDATA[
                ]]>
            </mx:htmlText>
        </mx:TextInput>
    and
    <mx:TextInput>
            <mx:text>something</mx:text>
        </mx:TextInput>
    But I still think, it should be there. Not sure
    Chetan

  • Mute button default state

    Hi all,
    how to set the FLV Playback Custom UI's mute button to
    default state to "OFF"?
    Any ideas?

    In case I don't come back:
    AS2:
    Drag the component on stage, double click to get inside.
    Create a new layer and open up the actions panel, add this:
    off_mc.swapDepths(on_mc);
    AS3:
    Drag the component on stage, click it once and give it an
    instance name of, mute_btn, create a new layer and open the actions
    panel, add this:
    mute_btn.setChildIndex(mute_btn.getChildAt(1), 0);
    **Notice Difference**
    AS2 you go into the component to add the actions, and the
    instance names are already there by default. AS3 you need to give
    the component an instance name, and don't go into the component,
    put that script on the main stage.

  • System user to its default state

    Hi All,
    I created few oracle objects with System user and later I came to know that those objects should be created with another user. Is there any other method to revert System user to its default state (that means the state when database was created) without deleting individual objects that I created manually.
    Thank you.
    ~ neo

    There is no script to drop unnecessary objects. You could :-
    1. ignore those objects.
    or
    2. create a new database and import the data
    or
    3. identify the custom objects and drop them. You can identify them by selecting from dba_objects and order by created.
    select object_name, object_type, created from dba_objects where owner = 'SYSTEM' order by created.

  • Dispatching & listening for custom events from custom component [Flex 4.1]

    I'm giving this a try for the first time and I'm not sure I have the recipe correct!
    I have a custom component - it contains a data grid where I want to double click a row and dispatch an event that a row has been chosen.
    I created a custom event
    package oss
        import flash.events.Event;
        public class PersonChosenEvent extends Event
            public function PersonChosenEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
                super(type, bubbles, cancelable);
            // Define static constant.
            public static const PERSON_CHOSEN:String = "personChosen";
            // Define a public variable to hold the state of the enable property.
            public var isEnabled:Boolean;
            // Override the inherited clone() method.
            override public function clone():Event {
                return new PersonChosenEvent(type);
    Then I try to dispatch the event within the component when the datagrid is doubleclicked:
    import oss.PersonChosenEvent
    dispatchEvent(new PersonChosenEvent(PersonChosenEvent.PERSON_CHOSEN, true, false));
    And in the parent application containing the component I do on creationComplete
    addEventListener(PersonChosenEvent.PERSON_CHOSEN,addPersonToList);
    The event does not seem to fire though. And if I try to evaluate the "new PersonChosenEvent(..." code it tells me "no such variable".
    What am I doing wrong?
    (It was so easy in VisualAge for Java, what have we done in the last 10 years?? )
    Martin

    I've done this kind of thing routinely, when I want to add information to the event.  I never code the "clone" method at all.
    Be sure that you are listening to the event on a parent of the dispatching component.
    You can also have the dispatching component listen for the event too, and use trace() to get a debug message.
    I doubt if it has anything to to with "bubbles" since the default is true.
    Sample code
    In a child (BorderContainer)
    dispatchEvent(new ActivationEvent(ActivationEvent.CREATION_COMPLETE,null,window));
    In the container parent (BorderContainer)
    activation.addEventListener(ActivationEvent.CREATION_COMPLETE,activationEvent);
    package components.events
        import components.containers.SemanticWindow;
        import components.triples.SemanticActivation;
        import flash.events.Event;
        public class ActivationEvent extends Event
            public static const LOADED:String = "ActivationEvent: loaded";
            public static const CREATION_COMPLETE:String = "ActivationEvent: creation complete";
            public static const RELOADED:String = "ActivationEvent: reloaded";
            public static const LEFT_SIDE:String = "ActivationEvent: left side";
            public static const RIGHT_SIDE:String = "ActivationEvent: right side";
            private var _activation:SemanticActivation;
            private var _window:SemanticWindow;
            public function ActivationEvent(type:String, activation:SemanticActivation, window:SemanticWindow)
                super(type);
                _activation = activation;
                _window = window
            public function get activation():SemanticActivation {
                return _activation;
            public function get window():SemanticWindow{
                return _window;

Maybe you are looking for