Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Notifications  (Read 12348 times)
Peter
Full Member
***
Posts: 26


View Profile Email
« on: October 27, 2007, 01:05:36 »

When do I use:

var note:Notification = new Notification();
facade.notifyObservers();

and when
sendNotification();
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: October 28, 2007, 08:39:21 »

Peter,

If possible, always use sendNotification. Please see the post about the better startup idiom that obviates the need to call notifyObservers from the application:

http://forums.puremvc.org/index.php?topic=85.msg283#msg283

-=Cliff>
Logged
Peter
Full Member
***
Posts: 26


View Profile Email
« Reply #2 on: October 28, 2007, 10:02:18 »

Thanks for the pointer to the article. That works for me too, but,

public function startup( app:Object ):void
{
    notifyObservers( new Notification( STARTUP, app ) );
}

should probably be:

public function startup( app:MovieClip ):Void
{
    notifyObservers( new Notification( STARTUP, app ) );
}

since we are passing the _root timeline as the container for our application?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: October 28, 2007, 11:32:53 »

You got it.

-=Cliff>
Logged
Peter
Full Member
***
Posts: 26


View Profile Email
« Reply #4 on: November 01, 2007, 03:48:30 »

About the startup idiom for Flash AS3 applications.
Why not use the base class:

package com.mydomain.myapp {
   
   import flash.display.MovieClip;

   /**
    * @author
    */
   public class StartUp extends MovieClip {
      
      public function StartUp() {
         init();
      }
      
      private function init() : void {
         ApplicationFacade.getInstance().start( this );
      }
   }
}
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #5 on: November 01, 2007, 05:42:16 »

Nothing wrong with that.

-=Cliff>
Logged
Pages: [1]
Print