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 488553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:43:07+00:00 2026-05-13T01:43:07+00:00

I always struggle with sending messages between objects. Consider the hierarchy of objects of

  • 0

I always struggle with sending messages between objects. Consider the hierarchy of objects of a quiz:

  • Quiz
    • QuestionList
      • Question
        • AnswerList
          • Answer

So:
a Quiz has a QuestionList
a QuestionList has multiple Questions
a Question has an AnswerList
a AnswerList has multiple Answers

When an Answer gets clicked (we’re talking Flash AS3 here):
Answer notifies AnswerList.
AnswerList notifies Question.
Question notifies QuestionList.
QuestionList notifies Quiz.

In other words, the message bubbles up. This is possible since I pass each ‘parent’ object through the constructor of it’s ‘child’. But I think I read somewhere that objects shouldn’t be aware of it’s parent. Should I take another approach?

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-13T01:43:07+00:00Added an answer on May 13, 2026 at 1:43 am

    Yes, you shouldn’t give the child objects links to their parent. I guess you the situation you explained above is a display hierarchy. In that case, you could do it much better using the event system. You can create custom events that are dispatched, when things happen and the parent would add listeners to events to take care of those.

    A possible event scenario for your structure would for example be the following:

    • Answer (a button) gets clicked, and the listening AnswerList notices that.
    • The AnswerList dispatches a “answered” event, which is received by the question.
    • The Question dispatches a “answered” event to notify the Question List to mark this question as answered
    • When the Question List has received answered events by all questions, it dispatches a “finished” event to tell the Quiz that it is completed
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure this has to do with scope, but I always seem to struggle
Here is another JSON question (I always struggle with arrays). My PHP code returns
... always getting exceptions when creating a edge/relation between a vertex and the Neo4j
I always struggle with dealing with normalised data, and how I display it. Maybe
I always struggle with Array to JSON formatting. I am using a selectbox plugin
I always seem to struggle with the decision of whether a value in a
I always struggle to keep all these macros straight in my head. Is there
I almost feel embarrassed to ask, but I always struggle with how to organize
I always seem to have this internal struggle when it comes to user interface.
I'm a budding web designer and do not always struggle with realizing my design

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.