I am new to APE and Mootools and have an small issue I hope some one
can help me with.

I have APE 1.1.1 and Mootools 1.2.4

After getting hello world working, I found a post @
http://www.ifc0nfig.com/using-jquery-with-ape/ where he used ape and
jquery. I figured I would try and get this going using the updated
version of APE and the mootools client.

I am not sure if it's my send or receive that isn't working. I am sure
it's probably something small.

HTML
<script type="text/javascript">
        var client = new APE.colorChanger();
        client.load({
            'identifier': 'colorChangerDemo',
            'channel': 'test'
        });
</script>

JS File
APE.colorChanger = new Class
({
    Extends: APE.Client,
    Implements: Options,
    options: {
        debug:true,
        select: "div#wrapper select[name=selectColor]"
    },

    initialize: function(options)
    {
        this.setOptions(options);
        this.addEvent("load", this.apeStart);
        this.addEvent('ready', this.apeReady);
        this.addEvent("multiPipeCreate", this.setup);
        this.addEvent("userJoin", this.createUser);
        this.addEvent("userLeft", this.deleteUser);
        this.addEvent("send", this.cmdSend);
        this.addEvent("data", this.rawData);
    },

    apeStart: function()
    {
        console.log('Your APE client is loaded');
        this.core.start({'name': String((new
Date()).getTime()).replace("/\D/gi,")});
    },

    apeReady: function() { console.log('You are connected to APE
server. Now you can takeover the world'); },

    setup: function(pipe, options)
    {
        $$(this.options.select).addEvent("change", function(){
            color = $(this).value;
            $$("body").setStyle("background-color", color);
            pipe.send(color);
        });
    },

    createUser: function(user, pipe) { ... },
    deleteUser: function(user, pipe) { ... },

    cmdSend: function(data, pipe)
    {
        if(this.options.debug)
        {
             var el =
Element("span").appendText("&nbsp;&nbsp;&nbsp;&nbsp;" +
this.core.user.properties.name + " changed the bg color to " +
data.msg).inject("div#debug").inject(Element("br"));
        }
    },

    rawData: function(raw, pipe)
    {
        $(this.options.select).value(raw.data.msg);
        $("body").setStyle("background-color", raw.data.msg);
    }

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to