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: Newbie : AS2 implementation trouble  (Read 9864 times)
dgtlmonk
Courseware Beta
Newbie
***
Posts: 8


View Profile Email
« on: June 10, 2008, 12:34:36 »

Hi,

  I'm trying to use AS3 examples around as a guide for a AS2 implementation (for another application). But I'm having some problems:

:
import org.puremvc.as2.patterns.facade.Facade;
import org.puremvc.as2.interfaces.IFacade;
import org.puremvc.as2.patterns.observer.Notification;
import CamScript;

class  CamScript.ApplicationFacade {

// Notification name constants
public static var STARTUP:String           = "startup";
private static var instance;

/**
* Singleton ApplicationFacade factory method
*/
public static function getInstance():ApplicationFacade
{
if ( instance == null ) instance = new ApplicationFacade();
return ApplicationFacade(instance);
}


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

/**
* Register Commands with the Controller
*/
function initializeController():Void
{
super.initializeController();

// registerCommand( STARTUP, StartupCommand );
}



}

some Question(s):

1. return ApplicationFacade(instance); // Did i type cast this correct?
2. There is no method with the name 'notifyObservers'.


« Last Edit: June 10, 2008, 12:38:56 by dgtlmonk » Logged
dgtlmonk
Courseware Beta
Newbie
***
Posts: 8


View Profile Email
« Reply #1 on: June 10, 2008, 01:36:48 »

  I just downloaded Baloonatroid and found out i should invoke sendNotification instead of notifyObservers( new Notification( STARTUP, app ) );

 However, im having an error at this line registerCommand( STARTUP, new StartupCommand()); // Type mismatch.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #2 on: June 10, 2008, 07:25:06 »

Drop the new from new StartupCommand. The latest version of the framework passes class names like the AS3 versions. For some reason we thought there was a problem with that in earlier versions.

Ballonatroid needs to be updated.

Chandima, if you're out there, is Balloonatroid running the latest release?

-=Cliff> 
Logged
dgtlmonk
Courseware Beta
Newbie
***
Posts: 8


View Profile Email
« Reply #3 on: June 10, 2008, 05:16:18 »

Thank you sir  ;D It's working now. Chandima helped me :), although i think Balloonatroid isn't updated sir.
Logged
dgtlmonk
Courseware Beta
Newbie
***
Posts: 8


View Profile Email
« Reply #4 on: June 18, 2008, 02:05:29 »

My first PureMVC AS2 minimal application

http://digitalmonkstudio.com/lab/as2/puremvc/RandomizedImage/RandomizeImage.html
 ;D

Basically, this simple application has two frames. 1 for preloading and the 2nd frame for the application main proper (a typical setup i believe). There’s a component in the library (a custom one, named ExampleComponent) that is being loaded by a Mediator, and this Mediator (ExampleComponentMediator) communicates with this custom component and freely notifies the facade. The Images and Tag (Character name) is from an XML file, utilizing “Proxy” pattern on PureMVC Framework.




http://digitalmonkstudio.com/lab/as2/puremvc/RandomizedImage/MinimalPureMVC_AS2.zip
Logged
Pages: [1]
Print