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: CoCoMo and PureMVC advices needed  (Read 12263 times)
coulix
Full Member
***
Posts: 23


View Profile Email
« on: November 21, 2008, 03:12:24 »

Hi guys,

I was building a collaborative project using PureMVC, now i see that CoCoMo is knocking at the door and it will simplify a lot of work if we use it for our project.

The thing i dont know is how to integrate PureMVC with it.

Looking a this simple chat code coming from CoCoMo examples

:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
xmlns:rtc="CocomoNameSpace">

<mx:Script>
<![CDATA[
import com.adobe.rtc.pods.simpleChatClasses.ChatMessageDescriptor;
import com.adobe.rtc.events.ChatEvent;
import com.adobe.rtc.pods.simpleChatClasses.SimpleChatModel;

// This simple example just shows how this shared model can be made easily bindable for MXML.
// See SimpleChatModel for details.

[Bindable]
public var chatModel:SimpleChatModel;
protected function buildModel():void
{
// Create the model: just calling the constructor won't create the collection node or pass the messages.
// Call subscribe and give it a shared ID while creating the model.
// The shared ID becomes the name of the collection node.
chatModel = new SimpleChatModel();
chatModel.sharedID = "myChat_SimpleChatModel";

chatModel.subscribe();
chatModel.addEventListener(ChatEvent.HISTORY_CHANGE, onChatMsg);
this.addEventListener(KeyboardEvent.KEY_UP, onKeyStroke);
}

protected function submitChat(str:String):void
{
var cmd:ChatMessageDescriptor = new ChatMessageDescriptor();
cmd.displayName = cSession.userManager.getUserDescriptor(cSession.userManager.myUserID).displayName;
cmd.msg =  str;
chatModel.sendMessage(cmd);
chat_mesg_input.text = "";
}

protected function clearChat():void
{
chat_mesg_area.text = "";
chatModel.clear();
}

protected function onChatMsg(p_evt:ChatEvent):void
{
if(p_evt.message != null && p_evt.message.msg != null && p_evt.message.displayName != null)
chat_mesg_area.text += "\r\n" +  p_evt.message.displayName + ": " + p_evt.message.msg;
else
chat_mesg_area.text = "";
}

protected function onKeyStroke(p_evt:KeyboardEvent):void
{
if(p_evt.keyCode == Keyboard.ENTER) {
submitChat(chat_mesg_input.text);
}
}

]]>
</mx:Script>


<!--
You would likely use external authentication here for a deployed application;
you would certainly not hard code Adobe IDs here.
-->
<rtc:AdobeHSAuthenticator
id="auth"
userName="AdobeIDusername"
password="AdobeIDpassword"  />

<rtc:ConnectSessionContainer roomURL="YourPersonalRoomUrl" id="cSession" authenticator="{auth}" width="100%" height="100%">
<mx:Canvas width="100%" height="100%" creationComplete="buildModel()">
<mx:VBox id="chatBox">
<mx:TextArea width="800" height="500" id="chat_mesg_area"/>
<mx:TextInput width="400" id="chat_mesg_input"/>
<mx:HBox>
<mx:Button label="Submit Chat" click="submitChat(chat_mesg_input.text)"/>
<mx:Button label="Clear Chat" click="clearChat()"/>
</mx:HBox>
</mx:VBox>
</mx:Canvas>
</rtc:ConnectSessionContainer>
</mx:Application>


What would be the convertion path to a PureMVC way

Myapp.xml will sendNotification( STARTUP, app );
Which call StartupCommand

Which registers Proxies: what are my proxies here ?
ConnectSessionContainer  give access to many stuff:
    authenticator : AbstractAuthenticator
    autoLogin : Boolean = true
    fileManager : FileManager
    initialRoomSettings : RoomSettings
    isSynchronized : Boolean
    roomManager : RoomManager
    roomURL : String
    streamManager : StreamManager

What would be his place in PureMVC ?



ChatMessageDescriptor is a "simple value-object to describe chat message properties."  where should i put it ? in a descriptor folder along my models ?

cmd.displayName = cSession.userManager.getUserDescriptor(cSession.userManager.myUserID).displayName;

chatModel will be in a ChatProxy as a VO ?

Since here the View talk to the ChatModel directly with bindable there is no mediator. Should i add one ?

Thanks for your answers i want to continue using PureMVC.  :D




Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: November 21, 2008, 07:53:29 »

I'm diving into cocomo myself this coming week, so I'll get back to you on this!
-=Cliff>
Logged
coulix
Full Member
***
Posts: 23


View Profile Email
« Reply #2 on: November 22, 2008, 12:05:44 »

Great !
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #3 on: November 22, 2008, 08:59:20 »

I'm diving into cocomo myself this coming week, so I'll get back to you on this!
-=Cliff>

Haha, me too. I guess we all got the itch from MAX?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 on: November 23, 2008, 07:09:25 »

Guess it underlines the value of such conferences in getting people excited about your stuff, huh?

-=Cliff>
Logged
coulix
Full Member
***
Posts: 23


View Profile Email
« Reply #5 on: November 28, 2008, 01:02:52 »

Any news after this nice week ?  ;D
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #6 on: November 28, 2008, 02:00:42 »

Any news after this nice week ?  ;D

I got as far as registering for an account, then I got side tracked with work stuff :(
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #7 on: November 29, 2008, 08:02:03 »

I did manage to create and connect to a room, but also got side tracked doing a demo for a new utility.

-=Cliff>
Logged
coulix
Full Member
***
Posts: 23


View Profile Email
« Reply #8 on: December 22, 2008, 12:46:25 »

I did manage to create and connect to a room, but also got side tracked doing a demo for a new utility.

-=Cliff>

Hi cliff,
Did you connect in the standard cocomo way or with puremvc using some kind
of cocomo mediator / model ?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #9 on: December 22, 2008, 12:55:28 »

Unfortunately, I have yet to get to CocoMo. I have it downloaded and ready to tear into, but a flurry of other work got in my way.

-=Cliff>
Logged
Pages: [1]
Print