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

  • Home
  • SEARCH
  • 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 almost feel embarrassed to ask, but I always struggle with how to organize
I always struggle with joins within Access. Can someone guide me? 4 tables. Contest
always when I open some project(which already exists) in eclipse I get this question
I've always struggled with how to best include classes into my php code. Pathing
Always was interested why are Array.Sort() and Array.IndexOf() methods made static and similar ArrayList.Sort()
Always when I run java application it will display in Windows Task Manager is
I always believe they did, but seeing some answers here make me doubt... Can
I always tend to forget these built-in Symfony functions for making links.
I always seem to have a hard time starting a new Firefox extension. Can
I always use unix timestamps for everything, but am wondering if there is a

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.