1: // README
2: //
3: // There are two steps to adding a property:
4: //
5: // 1. Create a member variable to store your property
6: // 2. Add the get_ and set_ accessors for your property
7: //
8: // Remember that both are case sensitive!
9:
10:
11: /// <reference name="MicrosoftAjaxTimer.debug.js" />
12: /// <reference name="MicrosoftAjaxWebForms.debug.js" />
13: /// <reference name="AjaxControlToolkit.ExtenderBase.BaseScripts.js" assembly="AjaxControlToolkit" />
14:
15:
16: Type.registerNamespace('AJAXControls.Ticker');
17:
18: AJAXControls.Ticker.TickerBehavior = function(element) {
19: AJAXControls.Ticker.TickerBehavior.initializeBase(this, [element]);
20:
21: // TODO : (Step 1) Add your property variables here
22: this._DelayValue = null;
23: this._Animation = null;
24: this._Width = 0;
25: this._Height = 0;
26: this._XPosition = 0;
27: this._YPosition = 0;
28: this._ScollText = null;
29: }
30: AJAXControls.Ticker.TickerBehavior.prototype = {
31: initialize: function() {
32: AJAXControls.Ticker.TickerBehavior.callBaseMethod(this, 'initialize');
33:
34: // TODO: Add your initalization code here
35: var CurrentElement = this.get_element();
36: this._Width = CurrentElement.offsetWidth;
37: this._Height = CurrentElement.offsetHeight;
38: this._XPosition = this.cumulativeOffset(CurrentElement)[0];
39: this._YPosition = this.cumulativeOffset(CurrentElement)[1];
40:
41: CurrentElement.style.overflow = "hidden";
42: CurrentElement.style.overflowX = "hidden";
43: CurrentElement.style.overflowY = "hidden";
44: CurrentElement.style.position = "absolute";
45:
46: this._ScrollText = document.createElement('div');
47: this._ScrollText.setAttribute('id', 'ScrollingText');
48: this._ScrollText.style.width = this._Width + "px";
49: this._ScrollText.style.height = this._Height + "px";
50: this._ScrollText.innerHTML = CurrentElement.innerHTML;
51: CurrentElement.innerHTML = "";
52: CurrentElement.appendChild(this._ScrollText);
53: this._ScrollText.style.position = "relative";
54: this._ScrollText.style.left = "0px";
55: this._ScrollText.style.top = this._Height + "px";
56:
57: this._Animation = new $AA.MoveAnimation(this._ScrollText, this._DelayValue, 50, 0, -2 * this._Height, true, 'px');
58: this._Animation.add_ended(Function.createDelegate(this, this.AnimationEnd));
59: this._Animation.initialize();
60: this._Animation.play();
61: },
62:
63: cumulativeOffset: function(Element) {
64: var Left = 0;
65: var Top = 0;
66: do {
67: Top += Element.offsetTop || 0;
68: Left += Element.offsetLeft || 0;
69: Element = Element.offsetParent;
70: } while (Element);
71: var ReturnValues = [Left, Top];
72: return ReturnValues;
73: },
74:
75: AnimationEnd: function() {
76: this._ScrollText.style.top = this._Height + "px";
77: this._Animation.play();
78: },
79:
80: dispose: function() {
81: // TODO: Add your cleanup code here
82:
83: AJAXControls.Ticker.TickerBehavior.callBaseMethod(this, 'dispose');
84: },
85:
86: // TODO: (Step 2) Add your property accessors here
87: get_Delay: function() {
88: return this._DelayValue;
89: },
90:
91: set_Delay: function(value) {
92: this._DelayValue = value;
93: }
94: }
95: AJAXControls.Ticker.TickerBehavior.registerClass('AJAXControls.Ticker.TickerBehavior', Sys.UI.Behavior);