delfick
01-13-2008, 02:59 AM
hello
I have an ongoing project where I have many squares (called plugins in the code) that change colour according to which one is either pressed or hovered over (so the one that is pressed stays red, the one being hovered over is blue and the rest of them are white)
now my problem is that I want to be able to broadcast when one of them is being rolled over and then have the listener object for each plugin hear this broadcast and change the colour of the plugin accordingly.
because the code for my ongoing project is a little messy (http://flashbsm.googlecode.com/svn/trunk/) I've made a smaller version concentrating on this particular issue (http://flashbsm.googlecode.com/svn/testing/listener/)
if you have subversion installed, then it can be gotten with the command
svn checkout http://flashbsm.googlecode.com/svn/testing/listener listener
though if you don't, then you can just download this here http://delfick.test.googlepages.com/listener.zip
currently I've initialised the broadcaster via the /objects/plugins/initialiseBroadcaster() function from the /base/base/startPoint() function, which then creates three new plugins
when each plugin is initialised, it adds it's listener object to the broadcaster and I've created a listener.onRoll function which is supposed to change the colour of the plugin when the broadcaster broadcasts the onRoll call from the /objects/plugins/setEvents function (when you look at it, you'll see :D)
the problem I have is that I'm unsure all the plugins' listener objects are hearing the call, and even if they all are, I'm not sure how to access the plugin itself from within that function....
hopefully you people see where I'm going wrong.
thankyou for help :D
I have an ongoing project where I have many squares (called plugins in the code) that change colour according to which one is either pressed or hovered over (so the one that is pressed stays red, the one being hovered over is blue and the rest of them are white)
now my problem is that I want to be able to broadcast when one of them is being rolled over and then have the listener object for each plugin hear this broadcast and change the colour of the plugin accordingly.
because the code for my ongoing project is a little messy (http://flashbsm.googlecode.com/svn/trunk/) I've made a smaller version concentrating on this particular issue (http://flashbsm.googlecode.com/svn/testing/listener/)
if you have subversion installed, then it can be gotten with the command
svn checkout http://flashbsm.googlecode.com/svn/testing/listener listener
though if you don't, then you can just download this here http://delfick.test.googlepages.com/listener.zip
currently I've initialised the broadcaster via the /objects/plugins/initialiseBroadcaster() function from the /base/base/startPoint() function, which then creates three new plugins
when each plugin is initialised, it adds it's listener object to the broadcaster and I've created a listener.onRoll function which is supposed to change the colour of the plugin when the broadcaster broadcasts the onRoll call from the /objects/plugins/setEvents function (when you look at it, you'll see :D)
the problem I have is that I'm unsure all the plugins' listener objects are hearing the call, and even if they all are, I'm not sure how to access the plugin itself from within that function....
hopefully you people see where I'm going wrong.
thankyou for help :D