Hi Eric,
   first suggestion. Unless there is a really good reason not to, loose
the AsBroadcaster class. It is unreliable and has been well an truely
replaced by EventDispatcher. You can import this into your class, set
up an event dispatcher Object, add event listeners and then
dispatchEvent in the same place that you presently 'broadcastMessage',
only it'll work ;)

The basic lines of code are below, sorry, don't have more time to set out
a class for ya ;)

import mx.events.EventDispatcher;

public var objBroadcaster:Object;

objBroadcaster.addEventListener("markerPressed", Delegate.create(this,
this.markerPressed));

objBroadcaster.dispatchEvent({type:eventName, param:param});


In my example the event dispatcher line (the last line of code above) is
part of a generic event dispatcher function which accepts the event type
and any parameters as part of the function call. You could hard code it.

Good luck

FlashCoder.net

> This may sound daft, and perhaps not the way to go, but here is what I am
> trying to do (AS2):
>
> I have a class that I would like timeline code to instantiate and call a
> method on. I would like the class to broadcast back to whomever is
> listening...
>
> simplified class:
>
> import mx.utils.Delegate;
> class Login extends AsBroadcaster
> {
>     function Login()
>     {
>
>     };
>
>     public function foo( sValue:String ):Void
>     {
>         // stuff
>         broadcastMessage( "attempt", bValue );
>     };
> }
>
> timeline code (not class-based):
>
> var bar:Login = new Login();
> bar.foo( "test string" );
>
> function attempt( bValue:Boolean ):Void
> {
>      trace( "the result is " + bValue );
> }
>
> ===========
>
> Obviously I am missing some pieces here, any quick insights?
>
> - Eric
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to