MXML Component State Question

Hey guys,
I am trying to simplify my code and break out different parts of the app into different MXML Component files.  I have taken my login info and created the LoginScreen.mxml file which calls the doLogin function in its (parent) mxml file FlexCMS.  It properly sets the state to 'LoggedIn' but then the LoginScreen.mxml file doesnt hide...
Any ideas?
<!-- FlexCMS.mxml file -->
<s:states>
          <s:State name="Login" />
          <s:State name="LoggedIn" />
     </s:states>
<fx:Script>
          <![CDATA[
public function doLogin($username:String, $password:String):void {
                    loginResult.token = customUserClass.login($username, $password);
               protected function loginResultEvent(event:ResultEvent):void {
                    //Alert.show(event.result.toString(), 'loginResult');
                    trace(event.result.toString());
                    if (event.result == true) {
                         currentState = 'LoggedIn';
                    trace('currentState: ' + currentState);
     ]]>
     </fx:Script>
<components:LoginScreen includeIn="Login" />
... More code for rest of app that hasnt been broken out to other mxml files yet
<!-- LoginScreen.mxml -->
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
           xmlns:s="library://ns.adobe.com/flex/spark"
           xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:local="*">
     <s:layout>
          <s:BasicLayout/>
     </s:layout>
     <s:states>
          <s:State name="Login" />
          <s:State name="LoggedIn" />
     </s:states>
     <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <fx:Script>
          <![CDATA[
               private var flexCMS:FlexCMS = new FlexCMS(); //get reference to main class
               protected function loginClick(event:MouseEvent):void {
                    flexCMS.doLogin(username_txt.text, password_txt.text);
          ]]>
     </fx:Script>
     <s:Panel height="140"
                horizontalCenter="0"
                title="Login"
                includeIn="Login"
                verticalCenter="0"
                width="250">
          <s:TextInput id="username_txt" text="testuser" width="151" x="87" y="10" />
          <s:TextInput id="password_txt" text="test" width="151" x="87" y="40" />
          <s:Label fontSize="14" text="Username:" x="10" y="10" />
          <s:Label fontSize="14" text="Password:" x="10" y="44" />
          <s:CheckBox label="Remember Me" x="10" y="68" />
          <s:Button click="loginClick(event)" id="login" label="Login" x="168" y="69" />
          <!-- <local:FlexCMS -->
     </s:Panel>
</s:Group>

I did something similar in the past for a few of my apps.
The login screen was a custom TitleWindow component that contained the normal username field, password field and login button and could communicate with the server for authentication purposes. If the authentication was successful then I'd call the PopUpManager's removePopUp method on the login window and change the current state to the authenticated state.

Similar Messages

  • Creator2 component state question

    I am new to JSF and Creator. I am using a page fragment for navigation on all pages of my site. The page fragment contains a tabset, with sub-tabs. I would like the tab set to maintain its state (which tab is highlighted) between pages. I cannot get this to work. Is this possible with JSF and Creator and if so how? Thanks.

    Hi,
    There is a relevant topic on EA discussion.
    Topic:TabSet navigation on a page fragment
    https://feedbackprograms.sun.com/project/forum/thread.html?cap={3F4DA363-16D3-4D4C-920C-992ECB054B6D}&forid={CC6B8562-F896-4A44-ACB6-4684BDD05E19}&topid={DFA961CF-157A-4E7C-9BBC-FDB69D982E9E}
    Hope this helps.
    Please post messages related to Creator 2 EA at the feedbacks programs portal. The URL is:
    https://feedbackprograms.sun.com/login.html
    Thanks,
    RK.

  • Mxml component application

    Hi all,
    I am converting a asp.net website to Flex, I have five web pages which I designed as Five mxml components have buttons, grid, combos, text boxes etc.
    my question is how do I move between these pages they are distinct in there looks and functionality. I read a lot about view states and I am confused whether view states will solve my issue.
    Please tell me how do we handle this usually in flex applications.

    Hi,
    Flex 4 or Flex 3 the answer remains the same, I have a state for each form then I place a container, be it a group a canvas or a panel, in each state to show how states work, the following is in flex 3
    The Application
    ============
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600" currentState="form1" xmlns:ns1="*">
    <mx:states>
    <mx:State name="form1">
    <mx:AddChild position="lastChild">
    <ns1:form1 horizontalCenter="0" verticalCenter="0">
    </ns1:form1>
    </mx:AddChild>
    </mx:State>
    <mx:State name="form2">
    <mx:AddChild position="lastChild">
    <ns1:form2 horizontalCenter="0" verticalCenter="0">
    </ns1:form2>
    </mx:AddChild>
    </mx:State>
    <mx:State name="form3">
    <mx:AddChild position="lastChild">
    <ns1:form3 horizontalCenter="0" verticalCenter="0">
    </ns1:form3>
    </mx:AddChild>
    </mx:State>
    </mx:states>
    <mx:Button label="Form 1" click="currentState='form1'" top="10" horizontalCenter="-150"/>
    <mx:Button label="Form 2" click="currentState='form2'" top="10" horizontalCenter="0"/>
    <mx:Button label="Form 3" click="currentState='form3'" top="10" horizontalCenter="150"/>
    </mx:Application>
    The Mxml Component Container (which is exactly what you said you had)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" title="First Form">
    </mx:Panel>
    You can navigate through your 'pages' however you want to, the first example I offered is pure flex the above code is pure flex only using the antiquated sdk which I would advise against for 'new' projects, flex 3 sdk maybe used in flashbuilder but I would only go to this for legacy purposes using the flex 4 sdk is by far the better option.
    I try to help where I can, there is no reward for doing this, but I did answer your initial question about states, I hope you get to understand flex a little better with time.
    David.

  • Cairngorm 3 - Best practice for component states

    Hi,
    I have here small question.
    I have some component states (eq: application state, some component states, atp.) in my Application.
    I'm not sure if is best practise to save component states in Presentation Models, they hold current state only. So, i create ApplicationState class, which holding all possible application states. And here is my problem, i'm not sure, where should be this "State" class stored. In application directory or create another "states" directory  name ?
    Well, i'm not sure.
    Thx.

    Hi,
    I have here small question.
    I have some component states (eq: application state, some component states, atp.) in my Application.
    I'm not sure if is best practise to save component states in Presentation Models, they hold current state only. So, i create ApplicationState class, which holding all possible application states. And here is my problem, i'm not sure, where should be this "State" class stored. In application directory or create another "states" directory  name ?
    Well, i'm not sure.
    Thx.

  • Eclipse Plugin unable to add MXML component

    I click on "New" and then choose "Other".  The "Select a Wizard" popup comes up.  I then choose "MXML Component", but when I click "Next" nothing happens.
    Does anyone have any ideas on what might be causing this?
    I am running Adobe Flash Builder 4 Premium (Version 4.0 build 272416)
    I am running Eclipse Java EE IDE for Web Developers Indigo Service Release 2 Build id 20120216-1857
    An error occurs in the .metadata/.log file
    !ENTRY org.eclipse.ui 4 0 2014-11-05 10:06:37.605
    !MESSAGE Unhandled event loop exception
    !STACK 0
    java.lang.NullPointerException
    at com.adobe.flexbuilder.mxml.editor.ui.wizards.MXMLComponentControl.updateComponentText(MXM LComponentControl.java:209)
    at com.adobe.flexbuilder.mxml.editor.ui.wizards.MXMLComponentControl.createBaseComponentTagC ontrol(MXMLComponentControl.java:202)
    at com.adobe.flexbuilder.mxml.editor.ui.wizards.MXMLComponentControl.createControl(MXMLCompo nentControl.java:96)
    at com.adobe.flexbuilder.mxml.editor.ui.wizards.NewMXMLComponentWizard$NewMXMLComponentWizar dPage.createAdditionalControls(NewMXMLComponentWizard.java:224)
    at com.adobe.flexbuilder.mxml.editor.ui.wizards.AbstractNewMXMLFileWizardPage.createControl( AbstractNewMXMLFileWizardPage.java:180)

    Hello,
    A few items to consider:
    Do the components appear if you reload the page?
    If not, do any errors appear in the error.log when you drag the component onto the page?
    If there are no errors, are the components built to display something in the default / unconfigured state?
    Regards,
    Caleb

  • Open MXML component + button click

    Hi,
    I have an MXML component within my Flex 2 Application, and
    within this component I have a button which when clicked, I want to
    "go / link to" (open) another MXML component.... e.g.:
    <mx:Application.......>
    <mx:panel............>
    <mx:button label="open other page" click="open the other
    MXML component etc..."/>
    </mx:panel>
    </mx:Application>
    Additionally I want to be able to pass a variable (on the
    same button click) to the component that is being opened on the
    button click, and use this variable within the second
    component......
    Could anyone suggest the best method of going about this?
    Thanks,
    Jon.

    In general all of the components of an application are
    created at start up. You then use view states and navigation
    containers to display the component when needed. If you want to
    create a component then check out this subject 'Creating deferred
    components' in the docs. Primarily you worry about deferred
    creation of objects if you want to reduce the file size of your
    swf. View states would be one way to handle the display of the
    components.

  • MXML Component Layout

    Is there a way for MXML Components to inherit their layout
    based on where you place them in the Main Application?
    For instance, I have the following sample MXML Components:
    ===============
    MXML Component 1 - Name
    <Base class of Component>
    <FormItem label="First Name"><TextInput
    id="firstName"></FormItem>
    <FormItem label="Middle Name"><TextInput
    id="middleName"></FormItem>
    <FormItem label="Last Name"><TextInput
    id="lastName"></FormItem>
    </Base Class of Component>
    ===============
    ===============
    MXML Component 2 - Address
    <Base class of Component>
    <FormItem label="Address"><TextInput
    id="address"></FormItem>
    <FormItem label="City"><TextInput
    id="city"></FormItem>
    <FormItem label="State"><ComboBox
    id="state"></FormItem>
    </Base Class of Component>
    ===============
    ===============
    MXML Component 3 - Donation
    <Base class of Component>
    <FormItem label="Donation Amount $"><TextInput
    id="donation"></FormItem>
    <FormItem label="Payment Type"><ComboBox
    id="PaymentType"></FormItem>
    </Base Class of Component>
    ===============
    Is there a way to get all the FormItems in the MXML
    Components to line up when place in a Form container in the main
    application like below? I have the problem of the MXML Components
    needing a base class, usually a container or other DisplayObject,
    but this screws up the layout in the main application.
    <mx:Form>
    <common:Name/>
    <common:Address/>
    <common:Donation/>
    </mx:Form>
    Thanks,
    Bryan

    No. layout is handled by the container. There is no built-in
    way to inherit layout values.
    Now, each container has its defualts. you cn set those
    properties to "0" or whatever, to prevent nested containers from
    messing with the layout.
    Tracy

  • MXML Component Child Objects Loaded?

    I have a MXML component with various child components within. My question is:
    Are the child components initiated when the MXML component is initialized in AS (i.e. var instance:MyComponent = new MyComponent();)?
    The reason I'm asking this is because the child components are null after the component is initialized in AS when stepping through with the debugger.
    Thanks!
    Mike

    See creationPolicy, createChildren and references to deferred instantiation in the doc.  Children are not created in the constructor for performance reasons.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • MXML component

    I have an MXML component PR_PIECHART
    1. Can one call as a variable the MXML component in AS ?
    2. Can you show the var in the interface and which method to
    use ?
    Just need some confirmation here

    You can reference ANY (mxml or as) component by its "id"
    property.
    I don't understand question 2.
    Tracy

  • Very simple library with one MXML component ERROR

    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx"
                         mouseDown="FlexGlobals.topLevelApplication.nativeWindow.startMove()"
                         width="350" height="42" top="0" left="0" right="0">
              <s:states>
                        <mx:State name="maxed"/>
                        <mx:State name="restored"/>
              </s:states>
              <fx:Script>
                        <![CDATA[
                                  import flash.events.MouseEvent;
                                  import mx.core.FlexGlobals;
                                  private var maxed:Boolean = false;
                                  private function restore(e:MouseEvent):void{
                                            if (maxed){
                                                      FlexGlobals.topLevelApplication.restore();
                                                      this.currentState = "restored";
                                                      maxed = false;
                                            }else{
                                                      FlexGlobals.topLevelApplication.maximize();
                                                      this.currentState = "maxed";
                                                      maxed = true;
                                  public function Maximize() : void
                                            if (this.maxed)
                                                      FlexGlobals.topLevelApplication.restore();
                                                      this.currentState = "restored";
                                                      this.maxed = false;
                                            else
                                                      FlexGlobals.topLevelApplication.maximize();
                                                      this.currentState = "maxed";
                                                      this.maxed = true;
                                            return;
                                  }// end function
                                  public function get Maximized():Boolean{
                                            return this.maxed;
                        ]]>
              </fx:Script>
              <s:Rect left="0" top="0" bottom="0" right="0">
                        <s:fill>
                                  <s:SolidColor color="#FFFFFF"/>
                        </s:fill>
              </s:Rect>
              <s:Image x="5" y="-4" source="assets/colibright_title.png" left="5"/>
              <s:Button y="10" width="32" height="32" click="FlexGlobals.topLevelApplication.minimize();" icon="assets/icons/minimize.png" y.restored="5" y.maxed="5" right.restored="74" right.maxed="74"/>
              <s:Button width="32" height="32" click="restore(event)" y="5" icon="assets/icons/restore.png" includeIn="maxed" right="39"/>
              <s:Button y="5"  click="restore(event)"  includeIn="restored" width="32" height="32" icon="assets/icons/maximize.png" right="39"/>
              <s:Button y="10" width="32" height="32" click="FlexGlobals.topLevelApplication.close();" icon="assets/icons/close.png" y.restored="5" y.maxed="5" right.restored="5" right.maxed="5"/>
    </s:Group>
    In my main application when i try to load the SWF and use the Custom MXML Component i get this error
    [SWF] C:\Users\dude\Adobe Flash Builder 4.7\Colibr8\bin-debug\extensions\00 - WindowControlUIPlugin.swf - 8,287 bytes after decompression
    VerifyError: Error #1014: Class spark.components::Group could not be found.
    private function launchPluginsInspection():void{
                                  plLoader = new Loader();
                                  plLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPluginLoaded);
                                  var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
                                  context.allowLoadBytesCodeExecution = true;
                                  context.allowCodeImport = true;
                                  var appFolder:File = File.applicationDirectory;
                                  var extensionsFolder:File = new File(appFolder.nativePath + "/extensions/");
                                  if (extensionsFolder.isDirectory){
                                            var files:Array = extensionsFolder.getDirectoryListing();
                                            for each(var file:File in files){
                                                      if (file.extension == "swf")
                                                                plLoader.load(new URLRequest(file.nativePath), context);
    Why is this happening?

    Can you try giving permissions for the player to access your swf file by adding this
    Security.allowDomain( '<Location of the swf file>' );
    or  
    System.security.allowDomain( '<location of the swf file>' );
    Thanks,
    Sudhir

  • SkinState vs. component state

    I wrote some Gumbo prototypes recently and found it confusing that skinStates are independent of component states (currentState). I tried to imagine scenario when host component state should be different than its skin state but I cant find any.
    I have found that component states are used in item renderes, which in my opinion violates of skinning concept (see ARB http://opensource.adobe.com/wiki/display/flexsdk/Gumbo+Updated+Item+Renderer )
    What do you think about syncing surrentState with skinState?
    In such a case it would be easier for developer to migrate from MXML inline item renderer to fully skinnable one as states of both, inline MXML component and MXML skin, will be the same.

    You write your state implementations the same way.  SkinStates is just a formal mechanism for saying that your skin should support those states.   But since your skin is just like an MXML component, what you end up writing is the same. For your application components you’re simply declaring them to meet “business” rules, while in skins you’re doing it more for interaction rules.
    Matt
    On 3/24/09 7:37 AM, "Haykel Ben Jemia" <
    [email protected]> wrote:
    A new message was posted by Haykel Ben Jemia in
    Developers --
      skinState vs. component state
    I have used skin states and thought it was the new way of using states. I was not aware that the 'old' component states are still available and can be used. Some examples on using both would probably help understand how both state types can be used together. I'll see if I can find some interesting use cases.
    Haykel Ben Jemia
    Allmas
    Web & RIA Development
    http://www.allmas-tn.com
    On Mon, Mar 23, 2009 at 5:20 PM, Greenfield Eliot <
    [email protected]> wrote:
    A new message was posted by Greenfield Eliot in
    Developers --
      skinState vs. component state
    We had them coupled originally. Surprisingly, if you’ve written a Spark app, you’ve already run into this.  Any time you use a skinned spark component as the root tag of your MXML file (including FxApplication), and add your own states, you’re creating component states that are separate from any skin states.
    Ely.
    On 3/23/09 3:50 AM, "Tom Chiverton" <
    [email protected] <
    http://[email protected]> > wrote:
    A new message was posted by Tom Chiverton in
    Developers --
      skinState vs. component state
     On Friday 20 Mar 2009, Iwo Banas wrote:
    > What do you think about syncing surrentState with skinState?
    I'm trying to think of use cases where the internal state of the component may
    be detached from the showing of that state, and I've come up with one:
    Suppose a component has two skin states - OK and FAIL, and it has to call an
    external service to check something to computer the state (i.e. state
    transitions are asynchronous). There might be OK, UNKNOWN and FAIL states,
    but only two skins (UNKNOWN being the same as FAIL).
    View/reply at skinState vs. component state <
    http://www.adobeforums.com/webx?13@@.59b85be2/1>
    Replies by email are OK.
    Use the unsubscribe <
    http://www.adobeforums.com/webx?280@@.59b85be2%21folder=.3c060fa3>  form to cancel your email subscription.
    View/reply at skinState vs. component state <
    http://www.adobeforums.com/webx?13@@.59b85be2/4>
    Replies by email are OK.
    Use the unsubscribe <
    http://www.adobeforums.com/webx?280@@.59b85be2!folder=.3c060fa3>  form to cancel your email subscription.

  • Custom mxml component extending another mxml component

    I want to create a custom mxml component that extends another mxml component. Bacially I want structure like Group -> BaseMXMLComponent -> MyMXMLComponent. I understand that it used to be the case that trying to add child component to MyMXMLComponent would throw "Error: Multiple sets of visual children have been specified for this component (base component definition and derived component definition)." error. But i've been reading few articles that says this has been fixed in Flex 4.
    My question is.. is it an actually fixed, documented, and supported behavior of Flex 4? or just an undefined behavior that appears to be "fixed" but can change on future update?

    I dont know what is happening inside datagrid.But If
    you want to maintain a single instance you could use singleton design pattern
    read about it
    http://en.wikipedia.org/wiki/Singleton_pattern
        public class Singleton
            private static var instance:Singleton= new Singleton();
            public var userdata:*; // keep user object
            public function Singleton()
                if (instance != null) { throw new Error('Cannot create a new instance.  Must use Singleton.getInstance().') }
            public static function getInstance():Singleton
                return instance;

  • Flex4 : Component state vs skin state

    Hello,
    I still can't quite figure the difference between the two ( if there is even a difference )
    component state : Defined by UIComponent's current state
    skin state : Determined by SkinnableComponent->getCurrentSkinState.
    Now, when should one use these 2 different mechanisms ?
    My first thought was that skin state was used for small variations ( selected effects, small controls appearing, etc ) and that component state was more for application state, like a view representing a form would change drammatically if currentState became FORM_BEING_SUBMITTED. But a skin could very well be applied to a huge and complex view so this reasonning fails.
    ->  Another interpretation is that you would use a skin only if flexibility is required, or else just use the old component state mechanism.
    Is that correct?

    Hi,
    It can be a bit confusing, no worries.  Not sure if this will help but here goes...
    A Flex 4 "skin" is itself a component - e.g. Skin is derived from UIComponent and as such supports view states.   So when you see the term 'skin state' all it really means is that it is the 'currentState' of the Flex 4 skin.   The 'currentState' of a Skin is controlled automatically by the SkinnableComponent the skin is associated with (based on what getCurrentSkinState returns at a given point in time).
    There really is no functional difference between how view states work for a Flex 4 Skin vs. how they work for say any other MXML component (like Application) - other than who is responsible for changing the state over time.  It's just that in the case of Application where (as in your example) you may define 3 different orientations of your application for example - you'd be responsible for setting currentState when appropriate.
    The one thing to remember (and I'm sure is the reason for most folk's confusion) is that for a SkinnableComponent instance, there really aren't any "states" for the component itself - the 'currentState' and states array are unused in this case.
    A simple example:
    Button. The actual Button class has no states itself, but its Skin does.  The Button is responsible for putting the Skin in one of the possible view states at runtime based on user interaction over time (e.g. up, over, down, disabled).  e.g. getCurrentSkinState is called on Button and depending on what is returned, the Button will (behind the scenes) set 'currentState' of the Skin component to one of the 4 states.
    Setting 'currentState' on a Button itself has no affect, because the Button has no actual states defined (as far as the states API is concerned), even though it happens to also be a UIComponent.
    -Corey

  • Reuse a MXML component

    Hi All
    I have setup (not complete yet) a mxml component (see code below), which I want to implementhe multiple times in s:Application.
    Within the s:Script tag (currently empty) I want to reference the VideoDisplay, Buttons, etc. To do this I use the ID, but the problem is that I need to implement this component multiple times ? An other problem is that each instance should have a different video url. Any suggestions ?
    Cheers
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:layout>
    <s:BasicLayout/>
    </s:layout>
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
    <![CDATA[
    ]]>
    </fx:Script>
    <mx:DateFormatter id="dateFormatter" formatString="NN:SS" />
    <mx:Panel title="{videoDisplay.source.split('/').pop()} ({videoDisplay.state})">
    <mx:VideoDisplay id="videoDisplay" visible="false" width="400" height="100"
    playheadUpdate="videoDisplay_playheadUpdate('')"
    ready="videoDisplay_ready('')"
    rewind="videoDisplay.play()"
    source="./Android_Demo.flv" />
    <mx:ControlBar id="controlBar" visible="false">
    <mx:Button id="play" name="play" label="Play" click="videoDisplay.play()"></mx:Button>
    <mx:Button id="pause" name="pause" label="Pause" click="videoDisplay.pause()"></mx:Button>
    <mx:HSlider id="slider" width="100%"
    allowTrackClick="false"
    invertThumbDirection="true"
    liveDragging="false"
    maximum="{videoDisplay.totalTime}"
    minimum="0"
    thumbPress="slider_thumbPress('')"
    thumbRelease="slider_thumbRelease('')"
    tickInterval="1"
    value="{videoDisplay.playheadTime}" />
    <mx:Label id="timeLabel" textAlign="right" />
    </mx:ControlBar>
    </mx:Panel>
    </s:Group>

    Hi,
    You just create bindable vars(public) in the component, then you can reference them as a component property, this property can be any type string,int, array etc....
    David
    simple app using the same component twice
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx"
       xmlns:components="components.*"
       minWidth="955" minHeight="600">
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <components:MyComponent x="45" y="161" caption="Hello World" icon="img1.jpg" description="picture 1">
    </components:MyComponent>
    <components:MyComponent x="479" y="161" caption="Another Component" icon="img2.jpg" description="picture 2">
    </components:MyComponent>
    </s:Application>
    the simple component -
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
    <![CDATA[
    [Bindable] public var caption:String;
    [Bindable] public var icon:String;
    [Bindable] public var description:String;
    ]]>
    </fx:Script>
    <s:Panel left="0" right="0" top="0" bottom="0" title="{caption}">
    <s:VGroup verticalCenter="0" horizontalCenter="0">
    <s:Image width="140" height="140" horizontalCenter="0" source="{icon}"/>
    <s:Label text="{description}" width="100%" textAlign="center"/>
    </s:VGroup>
    </s:Panel>
    </s:Group>

  • Using a different default component state within each page state

    I am using a custom component in multiple page states but would like to have a different default state (for the same custom component) within each page state.
    Is there anyway to use a different default component state within each page state .
    When I change the default state at a component level it seems to go across all my page states.  Any solutions?
    Thank you

    I guess I can just add that interaction for that component!
    I think my brain is just catching up

Maybe you are looking for