Very confused

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
zachofthegolden1
Posts: 89
Joined: 05 Sep 2011, 19:31

Re: Very confused

Postby zachofthegolden1 » 11 May 2012, 18:42

I just want to let everyone know the problem is solved its just the problem of modertors them selves not seeing admin and admin badges but if ther enot hidden the options work i think its ignoring the smartfox.amImoderator

other users can see the admin badges on the moderators via the user.Ismoderator but smartfox.amImoderator is ignored

my trace shows as this

moderator> undefined
badge undefined visible undefined


my clientside coding for the moderator badge is

Code: Select all

mc.adminBadge._visible = smartfox.amIModerator();
       trace("moderator> "+smartfox.amIModerator())
       trace("badge "+mc.adminBadge+" visible "+mc.adminBadge._visible)
-ZG1
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Very confused

Postby rjgtav » 11 May 2012, 18:48

Hello.
The amIModerator is not a method, it is a property. Therefore, you retrieve it by doing:

mc.adminBadge._visible = smartfox.amIModerator;
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
zachofthegolden1
Posts: 89
Joined: 05 Sep 2011, 19:31

Re: Very confused

Postby zachofthegolden1 » 11 May 2012, 18:53

rjgtav wrote:Hello.
The amIModerator is not a method, it is a property. Therefore, you retrieve it by doing:

mc.adminBadge._visible = smartfox.amIModerator;



i did that and this is what i was given in the trace and this user is a moderator

[Received]: <msg t="sys"><body action="joinOK" r="7"><pid id="0" /><vars /><uLs r="7"><u i="4" m="1"><n>utest</n><vars /></u></uLs></body></msg>
moderator> false
badge undefined visible undefined
-ZG1
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Very confused

Postby rjgtav » 11 May 2012, 19:30

Hmm... I'm not sure, but maybe you need to manually update the amIModerator property.
Can you please check if when you get the extensionResponse (on custom-login), the smartfox.amIModerator is also false? If so, you have to send the moderator property alongside with the user's id and username when you send the loginResponse from the custom-login extension.
Then you just need to manually update the smartfox.myUsername, smartfox.myUserId and smartfox.amIModerator properties.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
zachofthegolden1
Posts: 89
Joined: 05 Sep 2011, 19:31

Re: Very confused

Postby zachofthegolden1 » 11 May 2012, 19:37

rjgtav wrote:Hmm... I'm not sure, but maybe you need to manually update the amIModerator property.
Can you please check if when you get the extensionResponse (on custom-login), the smartfox.amIModerator is also false? If so, you have to send the moderator property alongside with the user's id and username when you send the loginResponse from the custom-login extension.
Then you just need to manually update the smartfox.myUsername, smartfox.myUserId and smartfox.amIModerator properties.



my extention responce

smartfox.onExtensionResponse = function(resObj:Object) {
if (resObj._cmd == "logOK") {
_global.myName = resObj.name;
smartfox.myUserName = resObj.name;
smartfox.myUserId = resObj.id; //not sure if it is resObj.id
smartfox.getRoomList();
} else if (resObj._cmd == "logKO") {
error.text = "Error at login: "+resObj.error;
status.text = "Connected";
}
};
-ZG1
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Very confused

Postby rjgtav » 11 May 2012, 19:59

Please do what I said on the previous post. If the smartfox.amIModerator property is false on the onExtensionResponse() method, then manually set it to the value sent from the extension (of course you also have to edit your extension's code in order to send the moderator value).
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
zachofthegolden1
Posts: 89
Joined: 05 Sep 2011, 19:31

Re: Very confused

Postby zachofthegolden1 » 11 May 2012, 20:34

rjgtav wrote:Please do what I said on the previous post. If the smartfox.amIModerator property is false on the onExtensionResponse() method, then manually set it to the value sent from the extension (of course you also have to edit your extension's code in order to send the moderator value).



yes it's working but the badge will not show i keep receiving

moderator> true
badge undefined visible undefined


also this is my coding

Code: Select all

smartfox.onExtensionResponse = function(resObj:Object) {
 if (resObj._cmd == "logOK") {
  _global.myName = resObj.name;
  _global.coins = resObj.coins;
  smartfox.myUserName = resObj.name;
  smartfox.myUserId = resObj.id; //not sure if it is resObj.id
  smartfox.amIModerator = resObj.ismod;
  smartfox.getRoomList();
-ZG1
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Very confused

Postby rjgtav » 11 May 2012, 23:25

As you can see in the Output window, the badge is undefined. If the badge is not available yet, you can't change its visibility yet. Check if the instance name is really the same. If it is, then it seems you're facing with those nasty movieclip loading issues with AS2.0. Maybe you could initially set some variables on the avatar and then, when you get the onClipEvent(load) event, you update the mcs' visibility according to the variables previously stored.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
zachofthegolden1
Posts: 89
Joined: 05 Sep 2011, 19:31

Re: Very confused

Postby zachofthegolden1 » 11 May 2012, 23:31

rjgtav wrote:As you can see in the Output window, the badge is undefined. If the badge is not available yet, you can't change its visibility yet. Check if the instance name is really the same. If it is, then it seems you're facing with those nasty movieclip loading issues with AS2.0. Maybe you could initially set some variables on the avatar and then, when you get the onClipEvent(load) event, you update the mcs' visibility according to the variables previously stored.



hmmm this is trickey ill give it my best shot. i have been playing around but it doesent seem to like it one bit

also when a user sends a chat messge the chat bouble does not display for the user but everyone else sees the chat bouble of the other user so the sender does not see a chat buble with teir message but they do see it in the chat log.
-ZG1
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Very confused

Postby rjgtav » 12 May 2012, 14:13

That's also due to the fact that you aren't being able to get the current client's avatar mc.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
zachofthegolden1
Posts: 89
Joined: 05 Sep 2011, 19:31

Re: Very confused

Postby zachofthegolden1 » 12 May 2012, 15:12

rjgtav wrote:That's also due to the fact that you aren't being able to get the current client's avatar mc.



well this is annoying soon as i get datbase working nothing that used to work now doesen't so yes im soo clueless now
-ZG1
User avatar
zachofthegolden1
Posts: 89
Joined: 05 Sep 2011, 19:31

Re: Very confused

Postby zachofthegolden1 » 12 May 2012, 22:36

Turns out that if a client is logged in only works for other users so other users see the badge on moderators instead of the moderator himself ive been changing codes around and stuff and no luck

its like u have ot be another user watching yourself because if anothe ruser sends a chat u will see it but if u do you cant see your own hmm ive done a few debugs

{{EDIT}}

ok it finds themovie clip but trace tells me

Code: Select all

moderator 2> true
badge _level0.avatarMC.avatar_36.adminBadge visible false



my client side coding is

Code: Select all

myAvatar.adminBadge._visible = smartfox.amIModerator;
      
       trace("moderator 2> "+smartfox.amIModerator)
       trace("badge "+myAvatar.adminBadge+" visible "+myAvatar.adminBadge._visible)


On extension response

Code: Select all

smartfox.amIModerator = resObj.ismod;



I find this very strange as when custom ogin is set to false it all works perfectly but soon as i set custom login to true it all has poblems loading the badges and loading the chat bouble.
-ZG1

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 38 guests