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

Show Posts

* | |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / General Discussion / Re: Popup Window on: March 17, 2008, 05:33:12
Hello,

I am having problems with creating an PopUp Window.  I receive an error message when trying to create the PopUp Window.  Here is the error message:

TypeError: Error #1007: Instantiation attempted on a non-constructor.
        at mx.managers::PopUpManagerImpl/createPopUp()
        at mx.managers::PopUpManager$/createPopUp()
        at com.managers.popup::PopManager$/openPopUpWindow()
        at org.puremvc.user.view::RepDetailsMediator/onUploadPopUp()
        at flash.events::EventDispatcher/dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.core::UIComponent/dispatchEvent()
        at org.puremvc.user.view.components::RepDetails/uploadPopUpFunc()
        at org.puremvc.user.view.components::RepDetails/___Button1_click()

I have a canvas that sends an event to its mediator which calls the method to create the popup.  I created an UploadForm and UploadFormMediator and a PopManager class.

:
package com.managers.popup
{
import flash.display.Sprite;
import mx.core.Application;
import mx.core.IFlexDisplayObject;
import mx.managers.PopUpManager;
import org.puremvc.user.ApplicationFacade;


public class PopManager extends PopUpManager
{
public static function openPopUpWindow( ComponentClass:Class, MediatorClass:Class ):void
    {
        var window:IFlexDisplayObject = PopUpManager.createPopUp( Application.application as Sprite, ComponentClass, true );

        ApplicationFacade.getInstance().registerMediator( new MediatorClass( window ) );
        PopUpManager.centerPopUp( window );
    }

    public static function closePopUpWindow( window:IFlexDisplayObject, mediatorName:String ):void
    {
        PopUpManager.removePopUp( window );
        ApplicationFacade.getInstance().removeMediator( mediatorName );
    }
}
}

Here is the RepDetailsMediator.as
:
/*
  PureMVC Architecture 101 Course
Copyright(c) 2007 FutureScale, Inc. All rights reserved.
 */
package org.puremvc.user.view
{
import mx.controls.Alert;
import flash.events.Event;

import org.puremvc.interfaces.IMediator;
import org.puremvc.interfaces.INotification;
import org.puremvc.patterns.mediator.Mediator;
import org.puremvc.patterns.observer.Notification;

import org.puremvc.common.model.vo.UserVO;
import org.puremvc.common.model.UserProxy;
import org.puremvc.common.model.RepDetailsProxy;

import org.puremvc.user.ApplicationFacade;
import org.puremvc.user.view.components.NewUserForm;
import org.puremvc.user.view.components.RepDetails;
import org.puremvc.user.view.components.UploadForm;
import com.managers.popup.PopManager;

public class RepDetailsMediator extends Mediator implements IMediator
{

public static const NAME:String = "RepDetailsMediator";
private var userProxy:UserProxy;
private var repDetailsProxy:RepDetailsProxy;
private var UploadForm:Class;
private var UploadFormMediator:Class;

public function RepDetailsMediator( viewComponent:Object )
{

super( viewComponent );

repDetails.addEventListener( RepDetails.CHECKBOX_SELECTED, onCheckBoxSelected );
repDetails.addEventListener( RepDetails.UPLOAD_POPUP, onUploadPopUp );

userProxy = facade.retrieveProxy( UserProxy.NAME ) as UserProxy;
repDetailsProxy = facade.retrieveProxy( RepDetailsProxy.NAME ) as RepDetailsProxy;

}


private function get repDetails():RepDetails
{
return viewComponent as RepDetails;
}

override public function getMediatorName():String
{
return NAME;
}

private function onCheckBoxSelected( event:Event ) : void
{
trace("Here Here Data:" + repDetails.checkedData);
userProxy.updateProject(repDetails.checkedData);
}

private function onUploadPopUp(event:Event):void
{
PopManager.openPopUpWindow( UploadForm, UploadFormMediator );
    }

override public function listNotificationInterests():Array
{
return [
ApplicationFacade.NEW_USER_FORM
   ];
}

override public function handleNotification( note:INotification ):void
{
switch ( note.getName() )
{
case ApplicationFacade.NEW_USER_FORM:
repDetails.projectData = repDetailsProxy.projectData;
repDetails.statesData = repDetailsProxy.statesData;
repDetails._selectedDate = repDetailsProxy.getNow18Years();
}
}
}
}

Any help or suggestions is much needed and appreciated.

Thanks,
Kevin

2  Announcements and General Discussion / General Discussion / Re: VewStack on: January 24, 2008, 01:18:38
Hi Cliff and Joel,

Thank you for all your efforts.  I resolved the problems regarding vewStacks and commands.  Both were easy to resolve after I realized I had a stupid mistake.  For the short period of working with the framework, it is well written and pretty easy to implement.  Thank you Cliff for a job well done!!!

Kevin
3  Announcements and General Discussion / General Discussion / Re: VewStack on: January 24, 2008, 11:11:50
Hi Joel,

Thanks for the response and the article.  I will check it out.  I found a method that worked, I am not sure if it is the best.  Would you happen to have any advice on commands?  When I put any code inside the execute method, I receive a flash play null object error.  It happens no matter what the code, a simple alert.show will cause the error.

Thank you for your time on these matters.  I have a made a lot of progress learning the framework...

Kevin
4  Announcements and General Discussion / General Discussion / Re: VewStack on: January 23, 2008, 04:44:45
Hi Cliff and Joel,

Thank you for your inputs and advice.  In just the short amount of time working with the mediators for I can see where Cliff's approach works well and organize.  I have been able to get the viewStackMediator to utilize the selectedIndex.  I am still having trouble get the Register form to show up.  What troubleshooting advice can you give upon tracing down the problem?  I was able to get the login and login success page to show.

Thanks,
Kevin
5  Announcements and General Discussion / General Discussion / Re: VewStack on: January 23, 2008, 03:42:48
Thank you for the quick response.  I think I understand your response.  I am building a fairly large application with multiple views(children).  From your response, I would create a mediator for the ViewStack and call the multiple views using the controller.  Would I have to create a mediator for every child or this one ViewStack mediator that I can call from the controller to initialize the view that is needed?  I would like to only have one Mediator if possible...

Thank you for your time.
Kevin
6  Announcements and General Discussion / General Discussion / VewStack on: January 23, 2008, 12:54:49
Hello,

I am a new user working with PureMVC.  I have gone through the courseware literature, which by the way is very well written and thought thru.

My question is how I can I change Views?  I have a viewstack with multiple views defined.  Per example I have a Login Form, with a Register Link Button which should go to the Register new user form.  I have tried fully some examples and cannot seem to make it work correctly.  Can someone give me an overview of the solution or maybe some sample code.

Thank you for your time,
Kevin
Pages: [1]