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: April 14, 2009, 03:11:05
Hi Daniele. I have a question. Your method is working but how can I load external information?
2  Announcements and General Discussion / General Discussion / [OT] from AS3 to UML on: March 02, 2009, 10:42:47
Hi! I've just finished writing the code of the web application written to graduate from my university (using pureMVC off course).
Now I would like to put in my thesis uml structure. Is there any tool to output the UML from pureMVC or AS3 in general?
3  Announcements and General Discussion / General Discussion / Re: Loading multiple information in a command on: January 05, 2009, 09:29:27
Just a question about "Best Pratices", in the LoginProxy didn't you forget to call the service.login inside the proxy login method?
4  Announcements and General Discussion / General Discussion / Re: Loading multiple information in a command on: January 05, 2009, 09:13:56
Yes, I'm using delegates because I need to use that service in two proxies.
BTW I'll try, thanks.
5  Announcements and General Discussion / General Discussion / Re: Loading multiple information in a command on: January 05, 2009, 06:31:59
thanks, just a question. I use a delegate, so my login method is:

:
public function login( username:String, password:String ):void
{
var delegate:UserService = new UserService( new Responder ( loginResult, onFault ) );
delegate.login( username, password );
}

from here where should I do the trick with the token? loginResult?

ps: I'm sorry, I'm really new to as3.
6  Announcements and General Discussion / General Discussion / Re: Loading multiple information in a command on: January 03, 2009, 04:06:56
I was just reading the Best Pratices, you basically do the same thing with the GetPrefsCommand, so I need to use two distinct command, don't I?
7  Announcements and General Discussion / General Discussion / Loading multiple information in a command on: January 03, 2009, 03:49:56
Hi, I'm having this problem: I have a loginCommand. Inside this command there is...let's say UserProxy.login which is the real login but then I have to load more information (in my case I have to load the item possesed by the logged user).
So I basically did this.

:
var _userlogin:User = notification.getBody() as User;
var _cuproxy: UsersItemsProxy = facade.retrieveProxy( UsersItemsProxy.NAME ) as UsersItemsProxy;
var _userproxy:UserProxy = facade.retrieveProxy( UserProxy.NAME ) as UserProxy;
_userproxy.login( _userlogin.username, _userlogin.password );
Alert.show(_userproxy.users[0].id);
// here i should load the items possessed by the user

The problem is that the user is loaded AFTER the Alert.show so I have an error of bad index at running time.

I'm using the delegate because I use the service in more proxy.

edit: I saw the AsyncCommand but I don't think it's the right thing to do because the command is just one: login, but I have to load more information from different proxies.
8  Announcements and General Discussion / General Discussion / Re: Help with TitleWindow and ViewStack and passing parameter? on: January 03, 2009, 03:36:23
Hi Flex.net! I had your problem, I spend an afternoon but I solve the problem.
Solution is simple. The problem is TitleWindow can't communicate with his parent in a direct way (actually it can but it would not be really good, you'll lose reusability).

In your view component inizialize your TitleWindow, then add to it an event listener associated with a function of the main view. Then inside the TitleWindow you can communicate with the view sendind this event.

MyView
--> mynewtitlewindow.addEventListener( "EVENT", privatefunction)
--> privatefunction( //do something )

mynewtitlewindows
-->dispatchEvent( new Event("EVENT") );
9  Announcements and General Discussion / General Discussion / Re: error 1009, viewstack on: January 01, 2009, 11:28:01
thanks.
10  Announcements and General Discussion / General Discussion / Re: error 1009, viewstack on: December 29, 2008, 06:35:07
Ok, I don't why but as soon as I write help 3ds I found a solution -_-
I added creationPolicy="all" to the viewStack component. Is the a correct way to solve the problem?
11  Announcements and General Discussion / General Discussion / error 1009, viewstack on: December 29, 2008, 06:26:40
Hi, I'm developing a little project but I have some problem. This application starts with a login view.
The main file looks like this:

:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:view="view.components.*" pageTitle="Tesi"
horizontalAlign="center" verticalAlign="middle"
creationComplete="facade.startup(this);" >
<mx:Script>
    <![CDATA[
import ApplicationFacade;
private var facade: ApplicationFacade = ApplicationFacade.getInstance();
]]>
    </mx:Script>
<mx:Panel width="900" height="500" title="TESI" id="tesi" >
<mx:ViewStack id="appView" width="100%" height="100%" >
    <view:Login id="login" />
    <view:UserProfile id="userprofile" />
    </mx:ViewStack>

</mx:Panel>
</mx:Application>

The main idea is: the user logs in and then the application loads the user data in "userprofile"
It's not working because after logs in (and that's fine) the UserProxy.login function send a notification to the application mediator to switch the view (the procedure is the same used in the login demo: http://puremvc.org/pages/demos/AS3/Demo_AS3_Flex_WebORB_Login/srcview/ ) and send a notification to the UserProfileMediator so the mediator can assign the user information to the component.

UserProfileMediator
:
package view
{
import model.UserProxy;
import model.vo.User;

import mx.controls.Alert;

import org.puremvc.as3.interfaces.IMediator;
import org.puremvc.as3.interfaces.INotification;
import org.puremvc.as3.patterns.mediator.Mediator;

import view.components.UserProfile;

public class UserProfileMediator extends Mediator implements IMediator
{
public static const NAME:String = "UserProfileMediator";

private var _uproxy: UserProxy;

public function UserProfileMediator( viewComponent:UserProfile )
{
super( NAME, viewComponent );
_uproxy = facade.retrieveProxy( UserProxy.NAME ) as UserProxy;
}

override public function listNotificationInterests():Array
{
return [
UserProxy.LOGIN_SUCCEDED
];
}

override public function handleNotification(notification:INotification):void
{
switch(notification.getName())
{
case UserProxy.LOGIN_SUCCEDED:
userprofile._us = _uproxy.users[0] as User; // TypeError: Error #1009: Cannot access a property or method of a null object reference.
break;

default:
}
}

protected function get userprofile():UserProfile
{
return viewComponent as UserProfile;
}
}
}

Here's the error.

And then the UserProfile.mxml
:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:help="view.components.*"
width="100%" height="100%" borderStyle="solid">
<mx:Script>
<![CDATA[
import model.vo.User;
[Bindable] public var _us: User;
]]>
</mx:Script>
<mx:Label text="{_us.username}" />
</mx:HBox>

Can you help me? I don't know what I'm doing wrong. The "proxy" part is working, the user infos are loaded.
Pages: [1]