Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 577977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:12:42+00:00 2026-05-13T14:12:42+00:00

Right now I have an Accordion component in Flex that has two children, I

  • 0

Right now I have an Accordion component in Flex that has two children, I want to give the children a reference to my application model when they have completed their instantiation (after the accordion changes index).

The following notation fails for me because the children are instantiated after the event is triggered (accordionChange method):

<mx:Accordion change="accordionChange(event)" > ...

So what I have currently done is add a creationComplete to each Accordion child which will then assign the model reference:

<?xml version="1.0" encoding="utf-8"?>
<pod:InspectorClass xmlns:pod="pod.*" xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Accordion id="accordion" color="0x323232" width="100%" height="100%">
    <mx:VBox label="Card Front" creationComplete="setChildModel()" >
        <pod:FaceInspector id="frontFaceInspector"/>
    </mx:VBox>
    <mx:VBox label="Card Back" creationComplete="setChildModel()" >
        <pod:FaceInspector id="backFaceInspector"/>
...

My “Code behind” class InspectorClass contains a method that looks like this:

    public function setChildModel():void
    {
        if ( accordion.selectedIndex == 0 )
        {
            frontFaceInspector.setModel(model);
        }
        else if ( accordion.selectedIndex == 1 )
        {
            backFaceInspector.setModel(model);
        }
    }

This feels clumsy to me, like I am missing the point of some key part of Flex. I would appreciate any advice as to how I should be doing this, this seems to be a reoccurring pattern for me.

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:12:43+00:00Added an answer on May 13, 2026 at 2:12 pm

    You can just bind the model in each of your FaceInspector instances as you declare them in MXML.

    In you FaceInspector Class (AS3/code-behind), make sure your model property is public and bindable.

    [Bindable]
    public var model:Model;
    

    Then in your Main MXML (or wherever you declare the FaceInspector instances), just bind the model property to the model.

    <pod:FaceInspector id="frontFaceInspector" model="{model}" />
    

    I hope this is what you are after.

    Also, if your FaceInspector instances only need access to specific properties of your model, then I would suggest making those properties bindable in the Model Class, and bind them directly. E.g.

    <pod:FaceInspector id="frontFaceInspector" currentIndex="{model.sceneIndex}" imageURL="{model.image_url}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have a script that will get the last five files in
Right now I have a function, in a class that is used to listen
Right now I have a link that causes a hidden div to appear when
Right now I have a foreach loop that grabs the first link with an
Right now I have a PHP file that does a MYSQL query and then
Right now I have an application which uses Reporting Services to render reports. This
I have a accordion which shows the months of year. Now I want to
First I want to say that, I have a vector which has thousand of
I have an accordion that I want to have the following functionality: when the
I am working on a project right now that uses an accordion style menu,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.