Re: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Muzak
Look into Event bubbling http://www.google.com/search?hl=en&q=AS3+event+bubbling&meta= - Original Message - From: "Lehr, Ross (N-SGIS)" To: "Flash Coders List" Sent: Thursday, February 05, 2009 8:14 PM Subject: RE: [Flashcoders] Best way to access my ma

Re: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Todd Kerpelman
riginal Message- > From: flashcoders-boun...@chattyfig.figleaf.com [mailto: > flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason > Sent: Thursday, February 05, 2009 1:03 PM > To: Flash Coders List > Subject: RE: [Flashcoders] Best way to access my main class? > > &g

RE: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Merrill, Jason
Ross (N-SGIS) Sent: Thursday, February 05, 2009 2:15 PM To: Flash Coders List Subject: RE: [Flashcoders] Best way to access my main class? This brings up a question I had about events. Is there a way to send an event all the way to the document class, no matter where it's been dispatche

RE: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Lehr, Ross (N-SGIS)
the document class receive an event directly sent from the "icon button"? Thanks, Ross -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: Thursday, February 05, 2009 1:03 PM

Re: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Ian Thomas
al Message- > From: flashcoders-boun...@chattyfig.figleaf.com > [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason > Sent: Thursday, February 05, 2009 1:03 PM > To: Flash Coders List > Subject: RE: [Flashcoders] Best way to access my main class

Re: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Ian Thomas
Additionally, you should take a look at what the code is doing. Why does Bouncing Ball have to call something in the parent? Is it some sort of notification? ("I've finished animating/I've hit a wall!"). In which case an event is definitely the right solution. Is it to gain information of some s

RE: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Merrill, Jason
>>I think I whip up custom events more than almost anything else. Yup - me too - in fact, in FlashDevelop, I have a nice event template in the form of a code snippet for a new custom events I use all the time: package { import flash.events.Event; public class extends Ev

Re: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Eric E. Dolecki
Agreed on Option 3. Custom event inclusive of whatever kind of data you want to send to the associated listening method. I think I whip up custom events more than almost anything else. - Eric On Thu, Feb 5, 2009 at 1:30 PM, Nate Beck wrote: > Option 3! > > Always opt to use event based architec

Re: [Flashcoders] Best way to access my main class?

2009-02-05 Thread David Hershberger
My preference is usually option 3, using an event. It means you can use your ball in other situations, where that "call" back to the root may or may not be necessary. Regarding cleaning up references in event listeners, you can use a "weak reference" when you call addEventListener(). Also, I oft

Re: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Nate Beck
Option 3! Always opt to use event based architecture. It promotes loose coupling of your components. Although it might be a bit more code, you will be able to use BouncingBall within many games, or other applications. On Thu, Feb 5, 2009 at 10:02 AM, Merrill, Jason < jason.merr...@bankofamerica

RE: [Flashcoders] Best way to access my main class?

2009-02-05 Thread Merrill, Jason
>>*Option 3:* I create a custom event, dispatch that event, and create a >>listener in MyGame rather than call a function directly. >>I'm guessing this is the best way to go theoretically, and will allow me to >>reuse my BouncingBall object in other applications, but it's a lot of extra >>code, and

[Flashcoders] Best way to access my main class?

2009-02-05 Thread Todd Kerpelman
Hey, FlashCoders. I'm wondering if you can help me out with a general style question that I keep running into. Let's say I've got a setup like this... class MyGame extends MovieClip - It creates a "camera" sprite that I can add children into - It then creates a "Bouncing Ball" object with t