Note that there are some explanatory texts on larger screens.

plurals
  1. POBetter practice for Flash AS3 RIA development - using events/listeners, or allowing children to call functions in parents?
    primarykey
    data
    text
    <p>I'm working on a web app built in Flash AS3.</p> <p>At a high level - the app has a main screen, and several "modal dialog"-type screens that pop-up to manage various user interactions.</p> <p>(This is a similar pattern I use in most of the apps I develop...)</p> <p>Typically - when the user clicks a UI control on the dialog screen (e.g., button, text box, slider bar, etc.) - the main screen needs to react, or manage the consequences.</p> <p>It seems like there are two general ways to handle this:</p> <ol> <li>Have the dialog screen dispatch events that the main screen listens for</li> <li>Allow the dialog screen to call functions in the main screen when those controls are clicked (which requires that the dialog screen maintain a reference to the main screen, and that the functions in the main screen are public)</li> </ol> <p>In general - I understand that one of the key benefits of the first method is that the dialog screen isn't so tightly coupled; it's only responsibility is to broadcast the event. This would allow me to more easily use the dialog class in other contexts, or applications.</p> <p>But for many RIAs I develop - a particular screen is <strong>SO SPECIFIC</strong> to the the application that there's no chance I'd ever reuse it in another application. So, the "easy re-use" benefit is minimal.</p> <p>So - if you eliminate that benefit - which method is actually better? (More performant, less resource-intensive?)</p> <p>For example - if I use events, then Flash needs to manage many listeners for events that may never occur. So - it <em>might</em> be more efficient if the dialog window could call a function in the main screen directly, instead of dispatching an event.</p> <p>Which method is a better practice? What other benefits/pros/cons are there for each method?</p> <p>Many thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload