-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoblox.Thumbs.AvatarImage.js
65 lines (53 loc) · 1.99 KB
/
Roblox.Thumbs.AvatarImage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// AvatarImage.js. Register the namespace for the control.
Type.registerNamespace('Roblox.Thumbs');
//
// Define the control properties.
//
Roblox.Thumbs.AvatarImage = function (element) {
Roblox.Thumbs.AvatarImage.initializeBase(this, [element]);
this._userID = 0;
};
//
// Create the prototype for the control.
//
Roblox.Thumbs.AvatarImage.prototype = {
initialize: function () {
Roblox.Thumbs.AvatarImage.callBaseMethod(this, 'initialize');
this._webService = Roblox.Thumbs.Avatar;
this._requestThumbnail = Function.createDelegate(this, this.requestThumbnail);
},
dispose: function () {
Roblox.Thumbs.AvatarImage.callBaseMethod(this, 'dispose');
},
get_userID: function () {
return this._userID;
},
set_userID: function (value) {
if (this._userID !== value) {
this._userID = value;
this.raisePropertyChanged('userID');
}
},
requestThumbnail: function () {
var style = this.get_element().style;
var width = style.pixelWidth;
var height = style.pixelHeight;
var onSuccess = function (result, context) { context._onUrl(result); };
var onError = function (result, context) { context._onError(result); };
this._webService.RequestThumbnail(this._userID, width, height, this._fileExtension, this._thumbnailFormatID, false, onSuccess, onError, this);
}
};
// Optional descriptor for JSON serialization.
Roblox.Thumbs.AvatarImage.descriptor = {
properties: []
};
// Register the class as a type that inherits from Sys.UI.Control.
Roblox.Thumbs.AvatarImage.registerClass('Roblox.Thumbs.AvatarImage', Roblox.Thumbs.Image);
Roblox.Thumbs.AvatarImage.updateUrl = function (componentID) {
/// <summary>
/// This static function (that is intended to be called from script emitted
/// on the server)
/// </summary>
var a = $find(componentID);
if (a) a._onUpdate();
};