Advertisement
Guest User

Untitled

a guest
Aug 9th, 2011
3,665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 323.36 KB | None | 0 0
  1. package fl.motion.easing {
  2.  
  3. public class Back {
  4.  
  5. public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
  6. if (!_arg5){
  7. _arg5 = 1.70158;
  8. };
  9. _arg1 = (_arg1 / _arg4);
  10. return (((((_arg3 * _arg1) * _arg1) * (((_arg5 + 1) * _arg1) - _arg5)) + _arg2));
  11. }
  12. public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
  13. if (!_arg5){
  14. _arg5 = 1.70158;
  15. };
  16. _arg1 = ((_arg1 / _arg4) - 1);
  17. return (((_arg3 * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 1)) + _arg2));
  18. }
  19. public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
  20. if (!_arg5){
  21. _arg5 = 1.70158;
  22. };
  23. _arg1 = (_arg1 / (_arg4 / 2));
  24. if (_arg1 < 1){
  25. _arg5 = (_arg5 * 1.525);
  26. return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) - _arg5))) + _arg2));
  27. };
  28. _arg1 = (_arg1 - 2);
  29. _arg5 = (_arg5 * 1.525);
  30. return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 2)) + _arg2));
  31. }
  32.  
  33. }
  34. }//package fl.motion.easing
  35. package fl.motion.easing {
  36.  
  37. public class Quartic {
  38.  
  39. public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  40. _arg1 = (_arg1 / _arg4);
  41. return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
  42. }
  43. public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  44. _arg1 = ((_arg1 / _arg4) - 1);
  45. return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
  46. }
  47. public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  48. _arg1 = (_arg1 / (_arg4 / 2));
  49. if (_arg1 < 1){
  50. return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
  51. };
  52. _arg1 = (_arg1 - 2);
  53. return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2));
  54. }
  55.  
  56. }
  57. }//package fl.motion.easing
  58. package fl.motion.easing {
  59.  
  60. public class Linear {
  61.  
  62. public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  63. return ((((_arg3 * _arg1) / _arg4) + _arg2));
  64. }
  65. public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  66. return ((((_arg3 * _arg1) / _arg4) + _arg2));
  67. }
  68. public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  69. return ((((_arg3 * _arg1) / _arg4) + _arg2));
  70. }
  71. public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  72. return ((((_arg3 * _arg1) / _arg4) + _arg2));
  73. }
  74.  
  75. }
  76. }//package fl.motion.easing
  77. package fl.managers {
  78. import fl.controls.*;
  79. import flash.display.*;
  80. import flash.events.*;
  81. import fl.core.*;
  82. import flash.utils.*;
  83. import flash.text.*;
  84. import flash.ui.*;
  85.  
  86. public class FocusManager implements IFocusManager {
  87.  
  88. private var focusableObjects:Dictionary;
  89. private var _showFocusIndicator:Boolean = true;
  90. private var defButton:Button;
  91. private var focusableCandidates:Array;
  92. private var _form:DisplayObjectContainer;
  93. private var _defaultButtonEnabled:Boolean = true;
  94. private var activated:Boolean = false;
  95. private var _defaultButton:Button;
  96. private var calculateCandidates:Boolean = true;
  97. private var lastFocus:InteractiveObject;
  98. private var lastAction:String;
  99.  
  100. public function FocusManager(_arg1:DisplayObjectContainer){
  101. activated = false;
  102. calculateCandidates = true;
  103. _showFocusIndicator = true;
  104. _defaultButtonEnabled = true;
  105. super();
  106. focusableObjects = new Dictionary(true);
  107. if (_arg1 != null){
  108. _form = _arg1;
  109. addFocusables(DisplayObject(_arg1));
  110. _arg1.addEventListener(Event.ADDED, addedHandler);
  111. _arg1.addEventListener(Event.REMOVED, removedHandler);
  112. activate();
  113. };
  114. }
  115. public function get showFocusIndicator():Boolean{
  116. return (_showFocusIndicator);
  117. }
  118. private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
  119. var _local5:int;
  120. var _local6:int;
  121. var _local7:DisplayObject;
  122. var _local8:IFocusManagerGroup;
  123. var _local9:int;
  124. var _local10:DisplayObject;
  125. var _local11:IFocusManagerGroup;
  126. _local5 = focusableCandidates.length;
  127. _local6 = _arg1;
  128. while (true) {
  129. if (_arg2){
  130. _arg1--;
  131. } else {
  132. _arg1++;
  133. };
  134. if (_arg3){
  135. if (((_arg2) && ((_arg1 < 0)))){
  136. break;
  137. };
  138. if (((!(_arg2)) && ((_arg1 == _local5)))){
  139. break;
  140. };
  141. } else {
  142. _arg1 = ((_arg1 + _local5) % _local5);
  143. if (_local6 == _arg1){
  144. break;
  145. };
  146. };
  147. if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
  148. _local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
  149. if ((_local7 is IFocusManagerGroup)){
  150. _local8 = IFocusManagerGroup(_local7);
  151. _local9 = 0;
  152. while (_local9 < focusableCandidates.length) {
  153. _local10 = focusableCandidates[_local9];
  154. if ((_local10 is IFocusManagerGroup)){
  155. _local11 = IFocusManagerGroup(_local10);
  156. if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
  157. _arg1 = _local9;
  158. break;
  159. };
  160. };
  161. _local9++;
  162. };
  163. };
  164. return (_arg1);
  165. };
  166. };
  167. return (_arg1);
  168. }
  169. public function set form(_arg1:DisplayObjectContainer):void{
  170. _form = _arg1;
  171. }
  172. private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
  173. var focusable:* = null;
  174. var io:* = null;
  175. var doc:* = null;
  176. var i:* = 0;
  177. var child:* = null;
  178. var o:* = _arg1;
  179. var skipTopLevel:Boolean = _arg2;
  180. if (!skipTopLevel){
  181. if ((o is IFocusManagerComponent)){
  182. focusable = IFocusManagerComponent(o);
  183. if (focusable.focusEnabled){
  184. if (((focusable.tabEnabled) && (isTabVisible(o)))){
  185. focusableObjects[o] = true;
  186. calculateCandidates = true;
  187. };
  188. o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
  189. o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
  190. };
  191. } else {
  192. if ((o is InteractiveObject)){
  193. io = (o as InteractiveObject);
  194. if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
  195. focusableObjects[io] = true;
  196. calculateCandidates = true;
  197. };
  198. io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
  199. io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
  200. };
  201. };
  202. };
  203. if ((o is DisplayObjectContainer)){
  204. doc = DisplayObjectContainer(o);
  205. o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
  206. if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
  207. i = 0;
  208. while (i < doc.numChildren) {
  209. try {
  210. child = doc.getChildAt(i);
  211. if (child != null){
  212. addFocusables(doc.getChildAt(i));
  213. };
  214. } catch(error:SecurityError) {
  215. };
  216. i = (i + 1);
  217. };
  218. };
  219. };
  220. }
  221. private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
  222. return (_arg1.getChildIndex(_arg2));
  223. }
  224. private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
  225. if ((_arg1.relatedObject is TextField)){
  226. return;
  227. };
  228. _arg1.preventDefault();
  229. }
  230. private function focusOutHandler(_arg1:FocusEvent):void{
  231. var _local2:InteractiveObject;
  232. _local2 = (_arg1.target as InteractiveObject);
  233. }
  234. private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
  235. var _local3:IFocusManagerGroup;
  236. if (!isEnabledAndVisible(_arg1)){
  237. return (false);
  238. };
  239. if ((_arg1 is IFocusManagerGroup)){
  240. _local3 = IFocusManagerGroup(_arg1);
  241. if (_arg2 == _local3.groupName){
  242. return (false);
  243. };
  244. };
  245. return (true);
  246. }
  247. public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
  248. var _local2:InteractiveObject;
  249. _local2 = _arg1;
  250. while (_arg1) {
  251. if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
  252. return (_arg1);
  253. };
  254. _arg1 = _arg1.parent;
  255. };
  256. return (_local2);
  257. }
  258. private function sortFocusableObjectsTabIndex():void{
  259. var _local1:Object;
  260. var _local2:InteractiveObject;
  261. focusableCandidates = [];
  262. for (_local1 in focusableObjects) {
  263. _local2 = InteractiveObject(_local1);
  264. if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
  265. focusableCandidates.push(_local2);
  266. };
  267. };
  268. focusableCandidates.sort(sortByTabIndex);
  269. }
  270. private function removeFocusables(_arg1:DisplayObject):void{
  271. var _local2:Object;
  272. var _local3:DisplayObject;
  273. if ((_arg1 is DisplayObjectContainer)){
  274. _arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
  275. _arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
  276. for (_local2 in focusableObjects) {
  277. _local3 = DisplayObject(_local2);
  278. if (DisplayObjectContainer(_arg1).contains(_local3)){
  279. if (_local3 == lastFocus){
  280. lastFocus = null;
  281. };
  282. _local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
  283. delete focusableObjects[_local2];
  284. calculateCandidates = true;
  285. };
  286. };
  287. };
  288. }
  289. private function addedHandler(_arg1:Event):void{
  290. var _local2:DisplayObject;
  291. _local2 = DisplayObject(_arg1.target);
  292. if (_local2.stage){
  293. addFocusables(DisplayObject(_arg1.target));
  294. };
  295. }
  296. private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
  297. while (_arg1 != InteractiveObject(form)) {
  298. if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
  299. return (_arg1);
  300. };
  301. _arg1 = _arg1.parent;
  302. if (_arg1 == null){
  303. break;
  304. };
  305. };
  306. return (null);
  307. }
  308. private function tabChildrenChangeHandler(_arg1:Event):void{
  309. var _local2:DisplayObjectContainer;
  310. if (_arg1.target != _arg1.currentTarget){
  311. return;
  312. };
  313. calculateCandidates = true;
  314. _local2 = DisplayObjectContainer(_arg1.target);
  315. if (_local2.tabChildren){
  316. addFocusables(_local2, true);
  317. } else {
  318. removeFocusables(_local2);
  319. };
  320. }
  321. public function sendDefaultButtonEvent():void{
  322. defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
  323. }
  324. public function getFocus():InteractiveObject{
  325. var _local1:InteractiveObject;
  326. _local1 = form.stage.focus;
  327. return (findFocusManagerComponent(_local1));
  328. }
  329. private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
  330. var _local2:DisplayObjectContainer;
  331. var _local3:TextField;
  332. var _local4:SimpleButton;
  333. _local2 = DisplayObject(form).parent;
  334. while (_arg1 != _local2) {
  335. if ((_arg1 is UIComponent)){
  336. if (!UIComponent(_arg1).enabled){
  337. return (false);
  338. };
  339. } else {
  340. if ((_arg1 is TextField)){
  341. _local3 = TextField(_arg1);
  342. if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
  343. return (false);
  344. };
  345. } else {
  346. if ((_arg1 is SimpleButton)){
  347. _local4 = SimpleButton(_arg1);
  348. if (!_local4.enabled){
  349. return (false);
  350. };
  351. };
  352. };
  353. };
  354. if (!_arg1.visible){
  355. return (false);
  356. };
  357. _arg1 = _arg1.parent;
  358. };
  359. return (true);
  360. }
  361. public function set defaultButton(_arg1:Button):void{
  362. var _local2:Button;
  363. _local2 = ((_arg1) ? Button(_arg1) : null);
  364. if (_local2 != _defaultButton){
  365. if (_defaultButton){
  366. _defaultButton.emphasized = false;
  367. };
  368. if (defButton){
  369. defButton.emphasized = false;
  370. };
  371. _defaultButton = _local2;
  372. defButton = _local2;
  373. if (_local2){
  374. _local2.emphasized = true;
  375. };
  376. };
  377. }
  378. private function deactivateHandler(_arg1:Event):void{
  379. var _local2:InteractiveObject;
  380. _local2 = InteractiveObject(_arg1.target);
  381. }
  382. public function setFocus(_arg1:InteractiveObject):void{
  383. if ((_arg1 is IFocusManagerComponent)){
  384. IFocusManagerComponent(_arg1).setFocus();
  385. } else {
  386. form.stage.focus = _arg1;
  387. };
  388. }
  389. private function setFocusToNextObject(_arg1:FocusEvent):void{
  390. var _local2:InteractiveObject;
  391. if (!hasFocusableObjects()){
  392. return;
  393. };
  394. _local2 = getNextFocusManagerComponent(_arg1.shiftKey);
  395. if (_local2){
  396. setFocus(_local2);
  397. };
  398. }
  399. private function hasFocusableObjects():Boolean{
  400. var _local1:Object;
  401. for (_local1 in focusableObjects) {
  402. return (true);
  403. };
  404. return (false);
  405. }
  406. private function tabIndexChangeHandler(_arg1:Event):void{
  407. calculateCandidates = true;
  408. }
  409. private function sortFocusableObjects():void{
  410. var _local1:Object;
  411. var _local2:InteractiveObject;
  412. focusableCandidates = [];
  413. for (_local1 in focusableObjects) {
  414. _local2 = InteractiveObject(_local1);
  415. if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
  416. sortFocusableObjectsTabIndex();
  417. return;
  418. };
  419. focusableCandidates.push(_local2);
  420. };
  421. focusableCandidates.sort(sortByDepth);
  422. }
  423. private function keyFocusChangeHandler(_arg1:FocusEvent):void{
  424. showFocusIndicator = true;
  425. if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
  426. setFocusToNextObject(_arg1);
  427. _arg1.preventDefault();
  428. };
  429. }
  430. private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
  431. var _local2:int;
  432. var _local3:int;
  433. _local2 = focusableCandidates.length;
  434. _local3 = 0;
  435. _local3 = 0;
  436. while (_local3 < _local2) {
  437. if (focusableCandidates[_local3] == _arg1){
  438. return (_local3);
  439. };
  440. _local3++;
  441. };
  442. return (-1);
  443. }
  444. public function hideFocus():void{
  445. }
  446. private function removedHandler(_arg1:Event):void{
  447. var _local2:int;
  448. var _local3:DisplayObject;
  449. var _local4:InteractiveObject;
  450. _local3 = DisplayObject(_arg1.target);
  451. if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
  452. if (_local3 == lastFocus){
  453. IFocusManagerComponent(lastFocus).drawFocus(false);
  454. lastFocus = null;
  455. };
  456. _local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
  457. delete focusableObjects[_local3];
  458. calculateCandidates = true;
  459. } else {
  460. if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
  461. _local4 = (_local3 as InteractiveObject);
  462. if (_local4){
  463. if (_local4 == lastFocus){
  464. lastFocus = null;
  465. };
  466. delete focusableObjects[_local4];
  467. calculateCandidates = true;
  468. };
  469. _local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
  470. };
  471. };
  472. removeFocusables(_local3);
  473. }
  474. private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
  475. var _local3:String;
  476. var _local4:String;
  477. var _local5:int;
  478. var _local6:String;
  479. var _local7:String;
  480. var _local8:String;
  481. var _local9:DisplayObject;
  482. var _local10:DisplayObject;
  483. _local3 = "";
  484. _local4 = "";
  485. _local8 = "0000";
  486. _local9 = DisplayObject(_arg1);
  487. _local10 = DisplayObject(_arg2);
  488. while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
  489. _local5 = getChildIndex(_local9.parent, _local9);
  490. _local6 = _local5.toString(16);
  491. if (_local6.length < 4){
  492. _local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
  493. };
  494. _local3 = (_local7 + _local3);
  495. _local9 = _local9.parent;
  496. };
  497. while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
  498. _local5 = getChildIndex(_local10.parent, _local10);
  499. _local6 = _local5.toString(16);
  500. if (_local6.length < 4){
  501. _local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
  502. };
  503. _local4 = (_local7 + _local4);
  504. _local10 = _local10.parent;
  505. };
  506. return ((((_local3 > _local4)) ? 1 : (((_local3 < _local4)) ? -1 : 0)));
  507. }
  508. public function get defaultButton():Button{
  509. return (_defaultButton);
  510. }
  511. private function activateHandler(_arg1:Event):void{
  512. var _local2:InteractiveObject;
  513. _local2 = InteractiveObject(_arg1.target);
  514. if (lastFocus){
  515. if ((lastFocus is IFocusManagerComponent)){
  516. IFocusManagerComponent(lastFocus).setFocus();
  517. } else {
  518. form.stage.focus = lastFocus;
  519. };
  520. };
  521. lastAction = "ACTIVATE";
  522. }
  523. public function showFocus():void{
  524. }
  525. public function set defaultButtonEnabled(_arg1:Boolean):void{
  526. _defaultButtonEnabled = _arg1;
  527. }
  528. public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
  529. var _local2:DisplayObject;
  530. var _local3:String;
  531. var _local4:int;
  532. var _local5:Boolean;
  533. var _local6:int;
  534. var _local7:int;
  535. var _local8:IFocusManagerGroup;
  536. if (!hasFocusableObjects()){
  537. return (null);
  538. };
  539. if (calculateCandidates){
  540. sortFocusableObjects();
  541. calculateCandidates = false;
  542. };
  543. _local2 = form.stage.focus;
  544. _local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
  545. _local3 = "";
  546. if ((_local2 is IFocusManagerGroup)){
  547. _local8 = IFocusManagerGroup(_local2);
  548. _local3 = _local8.groupName;
  549. };
  550. _local4 = getIndexOfFocusedObject(_local2);
  551. _local5 = false;
  552. _local6 = _local4;
  553. if (_local4 == -1){
  554. if (_arg1){
  555. _local4 = focusableCandidates.length;
  556. };
  557. _local5 = true;
  558. };
  559. _local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
  560. return (findFocusManagerComponent(focusableCandidates[_local7]));
  561. }
  562. private function mouseDownHandler(_arg1:MouseEvent):void{
  563. var _local2:InteractiveObject;
  564. if (_arg1.isDefaultPrevented()){
  565. return;
  566. };
  567. _local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
  568. if (!_local2){
  569. return;
  570. };
  571. showFocusIndicator = false;
  572. if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
  573. setFocus(_local2);
  574. };
  575. lastAction = "MOUSEDOWN";
  576. }
  577. private function isTabVisible(_arg1:DisplayObject):Boolean{
  578. var _local2:DisplayObjectContainer;
  579. _local2 = _arg1.parent;
  580. while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
  581. if (!_local2.tabChildren){
  582. return (false);
  583. };
  584. _local2 = _local2.parent;
  585. };
  586. return (true);
  587. }
  588. public function get nextTabIndex():int{
  589. return (0);
  590. }
  591. private function keyDownHandler(_arg1:KeyboardEvent):void{
  592. if (_arg1.keyCode == Keyboard.TAB){
  593. lastAction = "KEY";
  594. if (calculateCandidates){
  595. sortFocusableObjects();
  596. calculateCandidates = false;
  597. };
  598. };
  599. if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
  600. sendDefaultButtonEvent();
  601. };
  602. }
  603. private function focusInHandler(_arg1:FocusEvent):void{
  604. var _local2:InteractiveObject;
  605. var _local3:Button;
  606. _local2 = InteractiveObject(_arg1.target);
  607. if (form.contains(_local2)){
  608. lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
  609. if ((lastFocus is Button)){
  610. _local3 = Button(lastFocus);
  611. if (defButton){
  612. defButton.emphasized = false;
  613. defButton = _local3;
  614. _local3.emphasized = true;
  615. };
  616. } else {
  617. if (((defButton) && (!((defButton == _defaultButton))))){
  618. defButton.emphasized = false;
  619. defButton = _defaultButton;
  620. _defaultButton.emphasized = true;
  621. };
  622. };
  623. };
  624. }
  625. private function tabEnabledChangeHandler(_arg1:Event):void{
  626. var _local2:InteractiveObject;
  627. var _local3:Boolean;
  628. calculateCandidates = true;
  629. _local2 = InteractiveObject(_arg1.target);
  630. _local3 = (focusableObjects[_local2] == true);
  631. if (_local2.tabEnabled){
  632. if (((!(_local3)) && (isTabVisible(_local2)))){
  633. if (!(_local2 is IFocusManagerComponent)){
  634. _local2.focusRect = false;
  635. };
  636. focusableObjects[_local2] = true;
  637. };
  638. } else {
  639. if (_local3){
  640. delete focusableObjects[_local2];
  641. };
  642. };
  643. }
  644. public function set showFocusIndicator(_arg1:Boolean):void{
  645. _showFocusIndicator = _arg1;
  646. }
  647. public function get form():DisplayObjectContainer{
  648. return (_form);
  649. }
  650. private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
  651. return ((((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : (((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2))));
  652. }
  653. public function activate():void{
  654. if (activated){
  655. return;
  656. };
  657. form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
  658. form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
  659. form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
  660. form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
  661. form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
  662. form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
  663. form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  664. form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
  665. activated = true;
  666. if (lastFocus){
  667. setFocus(lastFocus);
  668. };
  669. }
  670. public function deactivate():void{
  671. form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
  672. form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
  673. form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
  674. form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
  675. form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
  676. form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
  677. form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
  678. form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
  679. activated = false;
  680. }
  681. public function get defaultButtonEnabled():Boolean{
  682. return (_defaultButtonEnabled);
  683. }
  684.  
  685. }
  686. }//package fl.managers
  687. package fl.managers {
  688. import fl.core.*;
  689. import flash.utils.*;
  690. import flash.text.*;
  691.  
  692. public class StyleManager {
  693.  
  694. private static var _instance:StyleManager;
  695.  
  696. private var globalStyles:Object;
  697. private var classToDefaultStylesDict:Dictionary;
  698. private var styleToClassesHash:Object;
  699. private var classToStylesDict:Dictionary;
  700. private var classToInstancesDict:Dictionary;
  701.  
  702. public function StyleManager(){
  703. styleToClassesHash = {};
  704. classToInstancesDict = new Dictionary(true);
  705. classToStylesDict = new Dictionary(true);
  706. classToDefaultStylesDict = new Dictionary(true);
  707. globalStyles = UIComponent.getStyleDefinition();
  708. }
  709. public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
  710. var _local3:Class;
  711. var _local4:Object;
  712. _local3 = getClassDef(_arg1);
  713. _local4 = getInstance().classToStylesDict[_local3];
  714. if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
  715. delete _local4[_arg2];
  716. invalidateComponentStyle(_local3, _arg2);
  717. };
  718. }
  719. private static function getClassDef(_arg1:Object):Class{
  720. var component:* = _arg1;
  721. if ((component is Class)){
  722. return ((component as Class));
  723. };
  724. try {
  725. return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
  726. } catch(e:Error) {
  727. if ((component is UIComponent)){
  728. try {
  729. return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
  730. } catch(e:Error) {
  731. };
  732. };
  733. };
  734. return (null);
  735. }
  736. public static function clearStyle(_arg1:String):void{
  737. setStyle(_arg1, null);
  738. }
  739. public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
  740. var _local4:Class;
  741. var _local5:Object;
  742. _local4 = getClassDef(_arg1);
  743. _local5 = getInstance().classToStylesDict[_local4];
  744. if (_local5 == null){
  745. _local5 = (getInstance().classToStylesDict[_local4] = {});
  746. };
  747. if (_local5 == _arg3){
  748. return;
  749. };
  750. _local5[_arg2] = _arg3;
  751. invalidateComponentStyle(_local4, _arg2);
  752. }
  753. private static function setSharedStyles(_arg1:UIComponent):void{
  754. var _local2:StyleManager;
  755. var _local3:Class;
  756. var _local4:Object;
  757. var _local5:String;
  758. _local2 = getInstance();
  759. _local3 = getClassDef(_arg1);
  760. _local4 = _local2.classToDefaultStylesDict[_local3];
  761. for (_local5 in _local4) {
  762. _arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
  763. };
  764. }
  765. public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
  766. var _local3:Class;
  767. var _local4:Object;
  768. _local3 = getClassDef(_arg1);
  769. _local4 = getInstance().classToStylesDict[_local3];
  770. return (((_local4)==null) ? null : _local4[_arg2]);
  771. }
  772. private static function getInstance(){
  773. if (_instance == null){
  774. _instance = new (StyleManager)();
  775. };
  776. return (_instance);
  777. }
  778. private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
  779. var _local3:Dictionary;
  780. var _local4:Object;
  781. var _local5:UIComponent;
  782. _local3 = getInstance().classToInstancesDict[_arg1];
  783. if (_local3 == null){
  784. return;
  785. };
  786. for (_local4 in _local3) {
  787. _local5 = (_local4 as UIComponent);
  788. if (_local5 == null){
  789. } else {
  790. _local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
  791. };
  792. };
  793. }
  794. private static function invalidateStyle(_arg1:String):void{
  795. var _local2:Dictionary;
  796. var _local3:Object;
  797. _local2 = getInstance().styleToClassesHash[_arg1];
  798. if (_local2 == null){
  799. return;
  800. };
  801. for (_local3 in _local2) {
  802. invalidateComponentStyle(Class(_local3), _arg1);
  803. };
  804. }
  805. public static function registerInstance(_arg1:UIComponent):void{
  806. var inst:* = null;
  807. var classDef:* = null;
  808. var target:* = null;
  809. var defaultStyles:* = null;
  810. var styleToClasses:* = null;
  811. var n:* = null;
  812. var instance:* = _arg1;
  813. inst = getInstance();
  814. classDef = getClassDef(instance);
  815. if (classDef == null){
  816. return;
  817. };
  818. if (inst.classToInstancesDict[classDef] == null){
  819. inst.classToInstancesDict[classDef] = new Dictionary(true);
  820. target = classDef;
  821. while (defaultStyles == null) {
  822. if (target["getStyleDefinition"] != null){
  823. defaultStyles = target["getStyleDefinition"]();
  824. break;
  825. };
  826. try {
  827. target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
  828. } catch(err:Error) {
  829. try {
  830. target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
  831. } catch(e:Error) {
  832. defaultStyles = UIComponent.getStyleDefinition();
  833. break;
  834. };
  835. };
  836. };
  837. styleToClasses = inst.styleToClassesHash;
  838. for (n in defaultStyles) {
  839. if (styleToClasses[n] == null){
  840. styleToClasses[n] = new Dictionary(true);
  841. };
  842. styleToClasses[n][classDef] = true;
  843. };
  844. inst.classToDefaultStylesDict[classDef] = defaultStyles;
  845. inst.classToStylesDict[classDef] = {};
  846. };
  847. inst.classToInstancesDict[classDef][instance] = true;
  848. setSharedStyles(instance);
  849. }
  850. public static function getStyle(_arg1:String):Object{
  851. return (getInstance().globalStyles[_arg1]);
  852. }
  853. private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
  854. var _local3:Class;
  855. var _local4:StyleManager;
  856. var _local5:Object;
  857. _local3 = getClassDef(_arg1);
  858. _local4 = getInstance();
  859. _local5 = _local4.classToStylesDict[_local3][_arg2];
  860. if (_local5 != null){
  861. return (_local5);
  862. };
  863. _local5 = _local4.globalStyles[_arg2];
  864. if (_local5 != null){
  865. return (_local5);
  866. };
  867. return (_local4.classToDefaultStylesDict[_local3][_arg2]);
  868. }
  869. public static function setStyle(_arg1:String, _arg2:Object):void{
  870. var _local3:Object;
  871. _local3 = getInstance().globalStyles;
  872. if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
  873. return;
  874. };
  875. _local3[_arg1] = _arg2;
  876. invalidateStyle(_arg1);
  877. }
  878.  
  879. }
  880. }//package fl.managers
  881. package fl.managers {
  882.  
  883. public interface IFocusManagerComponent {
  884.  
  885. function set focusEnabled(_arg1:Boolean):void;
  886. function drawFocus(_arg1:Boolean):void;
  887. function setFocus():void;
  888. function get focusEnabled():Boolean;
  889. function get tabEnabled():Boolean;
  890. function get tabIndex():int;
  891. function get mouseFocusEnabled():Boolean;
  892.  
  893. }
  894. }//package fl.managers
  895. package fl.managers {
  896. import fl.controls.*;
  897. import flash.display.*;
  898.  
  899. public interface IFocusManager {
  900.  
  901. function getFocus():InteractiveObject;
  902. function deactivate():void;
  903. function set defaultButton(_arg1:Button):void;
  904. function set showFocusIndicator(_arg1:Boolean):void;
  905. function get defaultButtonEnabled():Boolean;
  906. function get nextTabIndex():int;
  907. function get defaultButton():Button;
  908. function get showFocusIndicator():Boolean;
  909. function setFocus(_arg1:InteractiveObject):void;
  910. function activate():void;
  911. function showFocus():void;
  912. function set defaultButtonEnabled(_arg1:Boolean):void;
  913. function hideFocus():void;
  914. function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
  915. function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
  916.  
  917. }
  918. }//package fl.managers
  919. package fl.managers {
  920.  
  921. public interface IFocusManagerGroup {
  922.  
  923. function set groupName(_arg1:String):void;
  924. function set selected(_arg1:Boolean):void;
  925. function get groupName():String;
  926. function get selected():Boolean;
  927.  
  928. }
  929. }//package fl.managers
  930. package fl.containers {
  931. import flash.display.*;
  932. import flash.events.*;
  933. import fl.core.*;
  934. import flash.net.*;
  935. import flash.utils.*;
  936. import flash.system.*;
  937. import fl.events.*;
  938.  
  939. public class UILoader extends UIComponent {
  940.  
  941. private static var defaultStyles:Object = {};
  942.  
  943. protected var loader:Loader;
  944. protected var _autoLoad:Boolean = true;
  945. protected var _source:Object;
  946. protected var contentClip:Sprite;
  947. protected var _maintainAspectRatio:Boolean = true;
  948. protected var contentInited:Boolean = false;
  949. protected var _scaleContent:Boolean = true;
  950.  
  951. public function UILoader(){
  952. _scaleContent = true;
  953. _autoLoad = true;
  954. contentInited = false;
  955. _maintainAspectRatio = true;
  956. super();
  957. }
  958. public static function getStyleDefinition():Object{
  959. return (defaultStyles);
  960. }
  961.  
  962. public function get maintainAspectRatio():Boolean{
  963. return (_maintainAspectRatio);
  964. }
  965. public function set maintainAspectRatio(_arg1:Boolean):void{
  966. _maintainAspectRatio = _arg1;
  967. invalidate(InvalidationType.SIZE);
  968. }
  969. public function get source():Object{
  970. return (_source);
  971. }
  972. protected function _unload(_arg1:Boolean=false):void{
  973. var throwError:Boolean = _arg1;
  974. if (loader != null){
  975. clearLoadEvents();
  976. contentClip.removeChild(loader);
  977. try {
  978. loader.close();
  979. } catch(e:Error) {
  980. };
  981. try {
  982. loader.unload();
  983. } catch(e) {
  984. if (throwError){
  985. throw (e);
  986. };
  987. };
  988. loader = null;
  989. return;
  990. };
  991. contentInited = false;
  992. if (contentClip.numChildren){
  993. contentClip.removeChildAt(0);
  994. };
  995. }
  996. public function get bytesLoaded():uint{
  997. return ((((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesLoaded));
  998. }
  999. public function set source(_arg1:Object):void{
  1000. if (_arg1 == ""){
  1001. return;
  1002. };
  1003. _source = _arg1;
  1004. _unload();
  1005. if (((_autoLoad) && (!((_source == null))))){
  1006. load();
  1007. };
  1008. }
  1009. public function set autoLoad(_arg1:Boolean):void{
  1010. _autoLoad = _arg1;
  1011. if (((((((_autoLoad) && ((loader == null)))) && (!((_source == null))))) && (!((_source == ""))))){
  1012. load();
  1013. };
  1014. }
  1015. public function get content():DisplayObject{
  1016. if (loader != null){
  1017. return (loader.content);
  1018. };
  1019. if (contentClip.numChildren){
  1020. return (contentClip.getChildAt(0));
  1021. };
  1022. return (null);
  1023. }
  1024. public function get percentLoaded():Number{
  1025. return (((bytesTotal)<=0) ? 0 : ((bytesLoaded / bytesTotal) * 100));
  1026. }
  1027. protected function handleError(_arg1:Event):void{
  1028. passEvent(_arg1);
  1029. clearLoadEvents();
  1030. loader.contentLoaderInfo.removeEventListener(Event.INIT, handleInit);
  1031. }
  1032. public function load(_arg1:URLRequest=null, _arg2:LoaderContext=null):void{
  1033. var _local3:DisplayObject;
  1034. _unload();
  1035. if ((((((_arg1 == null)) || ((_arg1.url == null)))) && ((((_source == null)) || ((_source == "")))))){
  1036. return;
  1037. };
  1038. _local3 = getDisplayObjectInstance(source);
  1039. if (_local3 != null){
  1040. contentClip.addChild(_local3);
  1041. contentInited = true;
  1042. invalidate(InvalidationType.SIZE);
  1043. return;
  1044. };
  1045. if (_arg1 == null){
  1046. _arg1 = new URLRequest(_source.toString());
  1047. };
  1048. if (_arg2 == null){
  1049. _arg2 = new LoaderContext(false, ApplicationDomain.currentDomain);
  1050. };
  1051. initLoader();
  1052. loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleError, false, 0, true);
  1053. loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleError, false, 0, true);
  1054. loader.contentLoaderInfo.addEventListener(Event.OPEN, passEvent, false, 0, true);
  1055. loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, passEvent, false, 0, true);
  1056. loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleComplete, false, 0, true);
  1057. loader.contentLoaderInfo.addEventListener(Event.INIT, handleInit, false, 0, true);
  1058. loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, passEvent, false, 0, true);
  1059. loader.load(_arg1, _arg2);
  1060. }
  1061. public function unload():void{
  1062. _source = null;
  1063. _unload(true);
  1064. }
  1065. protected function passEvent(_arg1:Event):void{
  1066. dispatchEvent(_arg1);
  1067. }
  1068. public function loadBytes(_arg1:ByteArray, _arg2:LoaderContext=null):void{
  1069. var bytes:* = _arg1;
  1070. var context = _arg2;
  1071. _unload();
  1072. initLoader();
  1073. try {
  1074. loader.loadBytes(bytes, context);
  1075. } catch(error) {
  1076. throw (error);
  1077. };
  1078. }
  1079. public function get autoLoad():Boolean{
  1080. return (_autoLoad);
  1081. }
  1082. protected function sizeContent(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
  1083. var _local6:Number;
  1084. var _local7:Number;
  1085. var _local8:Number;
  1086. var _local9:Number;
  1087. _local6 = _arg4;
  1088. _local7 = _arg5;
  1089. if (_maintainAspectRatio){
  1090. _local8 = (_arg4 / _arg5);
  1091. _local9 = (_arg2 / _arg3);
  1092. if (_local8 < _local9){
  1093. _local7 = (_local6 / _local9);
  1094. } else {
  1095. _local6 = (_local7 * _local9);
  1096. };
  1097. };
  1098. _arg1.width = _local6;
  1099. _arg1.height = _local7;
  1100. _arg1.x = ((_arg4 / 2) - (_local6 / 2));
  1101. _arg1.y = ((_arg5 / 2) - (_local7 / 2));
  1102. }
  1103. protected function initLoader():void{
  1104. loader = new Loader();
  1105. contentClip.addChild(loader);
  1106. }
  1107. override protected function draw():void{
  1108. if (isInvalid(InvalidationType.SIZE)){
  1109. drawLayout();
  1110. };
  1111. super.draw();
  1112. }
  1113. override protected function configUI():void{
  1114. super.configUI();
  1115. contentClip = new Sprite();
  1116. addChild(contentClip);
  1117. }
  1118. protected function handleInit(_arg1:Event):void{
  1119. loader.contentLoaderInfo.removeEventListener(Event.INIT, handleInit);
  1120. contentInited = true;
  1121. passEvent(_arg1);
  1122. invalidate(InvalidationType.SIZE);
  1123. }
  1124. protected function handleComplete(_arg1:Event):void{
  1125. clearLoadEvents();
  1126. passEvent(_arg1);
  1127. }
  1128. override public function setSize(_arg1:Number, _arg2:Number):void{
  1129. if (((!(_scaleContent)) && ((_width > 0)))){
  1130. return;
  1131. };
  1132. super.setSize(_arg1, _arg2);
  1133. }
  1134. protected function drawLayout():void{
  1135. var _local1:Boolean;
  1136. var _local2:Number;
  1137. var _local3:Number;
  1138. var _local4:Number;
  1139. var _local5:Number;
  1140. var _local6:LoaderInfo;
  1141. if (!contentInited){
  1142. return;
  1143. };
  1144. _local1 = false;
  1145. if (loader){
  1146. _local6 = loader.contentLoaderInfo;
  1147. _local2 = _local6.width;
  1148. _local3 = _local6.height;
  1149. } else {
  1150. _local2 = contentClip.width;
  1151. _local3 = contentClip.height;
  1152. };
  1153. _local4 = _width;
  1154. _local5 = _height;
  1155. if (!_scaleContent){
  1156. _width = contentClip.width;
  1157. _height = contentClip.height;
  1158. } else {
  1159. sizeContent(contentClip, _local2, _local3, _width, _height);
  1160. };
  1161. if (((!((_local4 == _width))) || (!((_local5 == _height))))){
  1162. dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, true));
  1163. };
  1164. }
  1165. public function get bytesTotal():uint{
  1166. return ((((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesTotal));
  1167. }
  1168. public function set scaleContent(_arg1:Boolean):void{
  1169. if (_scaleContent == _arg1){
  1170. return;
  1171. };
  1172. _scaleContent = _arg1;
  1173. invalidate(InvalidationType.SIZE);
  1174. }
  1175. protected function clearLoadEvents():void{
  1176. loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, handleError);
  1177. loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, handleError);
  1178. loader.contentLoaderInfo.removeEventListener(Event.OPEN, passEvent);
  1179. loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, passEvent);
  1180. loader.contentLoaderInfo.removeEventListener(HTTPStatusEvent.HTTP_STATUS, passEvent);
  1181. loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, handleComplete);
  1182. }
  1183. public function get scaleContent():Boolean{
  1184. return (_scaleContent);
  1185. }
  1186. public function close():void{
  1187. try {
  1188. loader.close();
  1189. } catch(error) {
  1190. throw (error);
  1191. };
  1192. }
  1193.  
  1194. }
  1195. }//package fl.containers
  1196. package fl.events {
  1197. import flash.events.*;
  1198.  
  1199. public class ComponentEvent extends Event {
  1200.  
  1201. public static const HIDE:String = "hide";
  1202. public static const BUTTON_DOWN:String = "buttonDown";
  1203. public static const MOVE:String = "move";
  1204. public static const RESIZE:String = "resize";
  1205. public static const ENTER:String = "enter";
  1206. public static const LABEL_CHANGE:String = "labelChange";
  1207. public static const SHOW:String = "show";
  1208.  
  1209. public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
  1210. super(_arg1, _arg2, _arg3);
  1211. }
  1212. override public function toString():String{
  1213. return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
  1214. }
  1215. override public function clone():Event{
  1216. return (new ComponentEvent(type, bubbles, cancelable));
  1217. }
  1218.  
  1219. }
  1220. }//package fl.events
  1221. package fl.core {
  1222. import flash.display.*;
  1223.  
  1224. public dynamic class ComponentShim extends MovieClip {
  1225.  
  1226. }
  1227. }//package fl.core
  1228. package fl.core {
  1229. import flash.display.*;
  1230. import flash.events.*;
  1231. import fl.managers.*;
  1232. import flash.utils.*;
  1233. import flash.system.*;
  1234. import flash.text.*;
  1235. import fl.events.*;
  1236.  
  1237. public class UIComponent extends Sprite {
  1238.  
  1239. public static var inCallLaterPhase:Boolean = false;
  1240. private static var defaultStyles:Object = {
  1241. focusRectSkin:"focusRectSkin",
  1242. focusRectPadding:2,
  1243. textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0),
  1244. disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0),
  1245. defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0),
  1246. defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)
  1247. };
  1248. public static var createAccessibilityImplementation:Function;
  1249. private static var focusManagers:Dictionary = new Dictionary(false);
  1250.  
  1251. protected var _enabled:Boolean = true;
  1252. private var _mouseFocusEnabled:Boolean = true;
  1253. protected var startHeight:Number;
  1254. protected var _height:Number;
  1255. protected var _oldIMEMode:String = null;
  1256. protected var startWidth:Number;
  1257. public var focusTarget:IFocusManagerComponent;
  1258. protected var errorCaught:Boolean = false;
  1259. protected var uiFocusRect:DisplayObject;
  1260. protected var _width:Number;
  1261. public var version:String = "3.0.0.15";
  1262. protected var isFocused:Boolean = false;
  1263. protected var callLaterMethods:Dictionary;
  1264. private var _focusEnabled:Boolean = true;
  1265. private var tempText:TextField;
  1266. protected var invalidateFlag:Boolean = false;
  1267. protected var _inspector:Boolean = false;
  1268. protected var sharedStyles:Object;
  1269. protected var invalidHash:Object;
  1270. protected var isLivePreview:Boolean = false;
  1271. protected var _imeMode:String = null;
  1272. protected var instanceStyles:Object;
  1273. protected var _x:Number;
  1274. protected var _y:Number;
  1275.  
  1276. public function UIComponent(){
  1277. version = "3.0.0.15";
  1278. isLivePreview = false;
  1279. invalidateFlag = false;
  1280. _enabled = true;
  1281. isFocused = false;
  1282. _focusEnabled = true;
  1283. _mouseFocusEnabled = true;
  1284. _imeMode = null;
  1285. _oldIMEMode = null;
  1286. errorCaught = false;
  1287. _inspector = false;
  1288. super();
  1289. instanceStyles = {};
  1290. sharedStyles = {};
  1291. invalidHash = {};
  1292. callLaterMethods = new Dictionary();
  1293. StyleManager.registerInstance(this);
  1294. configUI();
  1295. invalidate(InvalidationType.ALL);
  1296. tabEnabled = (this is IFocusManagerComponent);
  1297. focusRect = false;
  1298. if (tabEnabled){
  1299. addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
  1300. addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
  1301. addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
  1302. addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
  1303. };
  1304. initializeFocusManager();
  1305. addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
  1306. }
  1307. public static function getStyleDefinition():Object{
  1308. return (defaultStyles);
  1309. }
  1310. public static function mergeStyles(... _args):Object{
  1311. var _local2:Object;
  1312. var _local3:uint;
  1313. var _local4:uint;
  1314. var _local5:Object;
  1315. var _local6:String;
  1316. _local2 = {};
  1317. _local3 = _args.length;
  1318. _local4 = 0;
  1319. while (_local4 < _local3) {
  1320. _local5 = _args[_local4];
  1321. for (_local6 in _local5) {
  1322. if (_local2[_local6] != null){
  1323. } else {
  1324. _local2[_local6] = _args[_local4][_local6];
  1325. };
  1326. };
  1327. _local4++;
  1328. };
  1329. return (_local2);
  1330. }
  1331.  
  1332. public function drawFocus(_arg1:Boolean):void{
  1333. var _local2:Number;
  1334. isFocused = _arg1;
  1335. if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
  1336. removeChild(uiFocusRect);
  1337. uiFocusRect = null;
  1338. };
  1339. if (_arg1){
  1340. uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
  1341. if (uiFocusRect == null){
  1342. return;
  1343. };
  1344. _local2 = Number(getStyleValue("focusRectPadding"));
  1345. uiFocusRect.x = -(_local2);
  1346. uiFocusRect.y = -(_local2);
  1347. uiFocusRect.width = (width + (_local2 * 2));
  1348. uiFocusRect.height = (height + (_local2 * 2));
  1349. addChildAt(uiFocusRect, 0);
  1350. };
  1351. }
  1352. private function callLaterDispatcher(_arg1:Event):void{
  1353. var _local2:Dictionary;
  1354. var _local3:Object;
  1355. if (_arg1.type == Event.ADDED_TO_STAGE){
  1356. removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
  1357. stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
  1358. stage.invalidate();
  1359. return;
  1360. };
  1361. _arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
  1362. if (stage == null){
  1363. addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
  1364. return;
  1365. };
  1366. inCallLaterPhase = true;
  1367. _local2 = callLaterMethods;
  1368. for (_local3 in _local2) {
  1369. _local3();
  1370. delete _local2[_local3];
  1371. };
  1372. inCallLaterPhase = false;
  1373. }
  1374. private function addedHandler(_arg1:Event):void{
  1375. removeEventListener("addedToStage", addedHandler);
  1376. initializeFocusManager();
  1377. }
  1378. protected function getStyleValue(_arg1:String):Object{
  1379. return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
  1380. }
  1381. protected function isOurFocus(_arg1:DisplayObject):Boolean{
  1382. return ((_arg1 == this));
  1383. }
  1384. override public function get scaleX():Number{
  1385. return ((width / startWidth));
  1386. }
  1387. override public function get scaleY():Number{
  1388. return ((height / startHeight));
  1389. }
  1390. override public function set height(_arg1:Number):void{
  1391. if (_height == _arg1){
  1392. return;
  1393. };
  1394. setSize(width, _arg1);
  1395. }
  1396. protected function keyDownHandler(_arg1:KeyboardEvent):void{
  1397. }
  1398. protected function focusInHandler(_arg1:FocusEvent):void{
  1399. var _local2:IFocusManager;
  1400. if (isOurFocus((_arg1.target as DisplayObject))){
  1401. _local2 = focusManager;
  1402. if (((_local2) && (_local2.showFocusIndicator))){
  1403. drawFocus(true);
  1404. isFocused = true;
  1405. };
  1406. };
  1407. }
  1408. public function setStyle(_arg1:String, _arg2:Object):void{
  1409. if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
  1410. return;
  1411. };
  1412. instanceStyles[_arg1] = _arg2;
  1413. invalidate(InvalidationType.STYLES);
  1414. }
  1415. override public function get visible():Boolean{
  1416. return (super.visible);
  1417. }
  1418. public function get componentInspectorSetting():Boolean{
  1419. return (_inspector);
  1420. }
  1421. override public function get x():Number{
  1422. return (((isNaN(_x)) ? super.x : _x));
  1423. }
  1424. override public function get y():Number{
  1425. return (((isNaN(_y)) ? super.y : _y));
  1426. }
  1427. protected function setIMEMode(_arg1:Boolean){
  1428. var enabled:* = _arg1;
  1429. if (_imeMode != null){
  1430. if (enabled){
  1431. IME.enabled = true;
  1432. _oldIMEMode = IME.conversionMode;
  1433. try {
  1434. if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
  1435. IME.conversionMode = _imeMode;
  1436. };
  1437. errorCaught = false;
  1438. } catch(e:Error) {
  1439. errorCaught = true;
  1440. throw (new Error(("IME mode not supported: " + _imeMode)));
  1441. };
  1442. } else {
  1443. if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
  1444. IME.conversionMode = _oldIMEMode;
  1445. };
  1446. IME.enabled = false;
  1447. };
  1448. };
  1449. }
  1450. public function set enabled(_arg1:Boolean):void{
  1451. if (_arg1 == _enabled){
  1452. return;
  1453. };
  1454. _enabled = _arg1;
  1455. invalidate(InvalidationType.STATE);
  1456. }
  1457. public function setSharedStyle(_arg1:String, _arg2:Object):void{
  1458. if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
  1459. return;
  1460. };
  1461. sharedStyles[_arg1] = _arg2;
  1462. if (instanceStyles[_arg1] == null){
  1463. invalidate(InvalidationType.STYLES);
  1464. };
  1465. }
  1466. protected function keyUpHandler(_arg1:KeyboardEvent):void{
  1467. }
  1468. public function set focusEnabled(_arg1:Boolean):void{
  1469. _focusEnabled = _arg1;
  1470. }
  1471. override public function set scaleX(_arg1:Number):void{
  1472. setSize((startWidth * _arg1), height);
  1473. }
  1474. public function get mouseFocusEnabled():Boolean{
  1475. return (_mouseFocusEnabled);
  1476. }
  1477. override public function set scaleY(_arg1:Number):void{
  1478. setSize(width, (startHeight * _arg1));
  1479. }
  1480. protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
  1481. var classDef:* = null;
  1482. var skin:* = _arg1;
  1483. classDef = null;
  1484. if ((skin is Class)){
  1485. return ((new (skin)() as DisplayObject));
  1486. };
  1487. if ((skin is DisplayObject)){
  1488. (skin as DisplayObject).x = 0;
  1489. (skin as DisplayObject).y = 0;
  1490. return ((skin as DisplayObject));
  1491. };
  1492. try {
  1493. classDef = getDefinitionByName(skin.toString());
  1494. } catch(e:Error) {
  1495. try {
  1496. classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
  1497. } catch(e:Error) {
  1498. };
  1499. };
  1500. if (classDef == null){
  1501. return (null);
  1502. };
  1503. return ((new (classDef)() as DisplayObject));
  1504. }
  1505. protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
  1506. var _local3:String;
  1507. for (_local3 in _arg2) {
  1508. _arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
  1509. };
  1510. }
  1511. protected function beforeComponentParameters():void{
  1512. }
  1513. protected function callLater(_arg1:Function):void{
  1514. if (inCallLaterPhase){
  1515. return;
  1516. };
  1517. callLaterMethods[_arg1] = true;
  1518. if (stage != null){
  1519. stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
  1520. stage.invalidate();
  1521. } else {
  1522. addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
  1523. };
  1524. }
  1525. protected function createFocusManager():void{
  1526. if (focusManagers[stage] == null){
  1527. focusManagers[stage] = new FocusManager(stage);
  1528. };
  1529. }
  1530. override public function set visible(_arg1:Boolean):void{
  1531. var _local2:String;
  1532. if (super.visible == _arg1){
  1533. return;
  1534. };
  1535. super.visible = _arg1;
  1536. _local2 = ((_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE);
  1537. dispatchEvent(new ComponentEvent(_local2, true));
  1538. }
  1539. protected function hookAccessibility(_arg1:Event):void{
  1540. removeEventListener(Event.ENTER_FRAME, hookAccessibility);
  1541. initializeAccessibility();
  1542. }
  1543. public function set componentInspectorSetting(_arg1:Boolean):void{
  1544. _inspector = _arg1;
  1545. if (_inspector){
  1546. beforeComponentParameters();
  1547. } else {
  1548. afterComponentParameters();
  1549. };
  1550. }
  1551. override public function set x(_arg1:Number):void{
  1552. move(_arg1, _y);
  1553. }
  1554. public function drawNow():void{
  1555. draw();
  1556. }
  1557. override public function set y(_arg1:Number):void{
  1558. move(_x, _arg1);
  1559. }
  1560. protected function checkLivePreview():Boolean{
  1561. var className:* = null;
  1562. if (parent == null){
  1563. return (false);
  1564. };
  1565. try {
  1566. className = getQualifiedClassName(parent);
  1567. } catch(e:Error) {
  1568. };
  1569. return ((className == "fl.livepreview::LivePreviewParent"));
  1570. }
  1571. protected function focusOutHandler(_arg1:FocusEvent):void{
  1572. if (isOurFocus((_arg1.target as DisplayObject))){
  1573. drawFocus(false);
  1574. isFocused = false;
  1575. };
  1576. }
  1577. public function set mouseFocusEnabled(_arg1:Boolean):void{
  1578. _mouseFocusEnabled = _arg1;
  1579. }
  1580. public function getFocus():InteractiveObject{
  1581. if (stage){
  1582. return (stage.focus);
  1583. };
  1584. return (null);
  1585. }
  1586. protected function validate():void{
  1587. invalidHash = {};
  1588. }
  1589. override public function get height():Number{
  1590. return (_height);
  1591. }
  1592. public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
  1593. invalidHash[_arg1] = true;
  1594. if (_arg2){
  1595. this.callLater(draw);
  1596. };
  1597. }
  1598. public function get enabled():Boolean{
  1599. return (_enabled);
  1600. }
  1601. protected function getScaleX():Number{
  1602. return (super.scaleX);
  1603. }
  1604. protected function getScaleY():Number{
  1605. return (super.scaleY);
  1606. }
  1607. public function get focusEnabled():Boolean{
  1608. return (_focusEnabled);
  1609. }
  1610. protected function afterComponentParameters():void{
  1611. }
  1612. protected function draw():void{
  1613. if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
  1614. if (((isFocused) && (focusManager.showFocusIndicator))){
  1615. drawFocus(true);
  1616. };
  1617. };
  1618. validate();
  1619. }
  1620. protected function configUI():void{
  1621. var _local1:Number;
  1622. var _local2:Number;
  1623. var _local3:Number;
  1624. isLivePreview = checkLivePreview();
  1625. _local1 = rotation;
  1626. rotation = 0;
  1627. _local2 = super.width;
  1628. _local3 = super.height;
  1629. var _local4 = 1;
  1630. super.scaleY = _local4;
  1631. super.scaleX = _local4;
  1632. setSize(_local2, _local3);
  1633. move(super.x, super.y);
  1634. rotation = _local1;
  1635. startWidth = _local2;
  1636. startHeight = _local3;
  1637. if (numChildren > 0){
  1638. removeChildAt(0);
  1639. };
  1640. }
  1641. protected function setScaleX(_arg1:Number):void{
  1642. super.scaleX = _arg1;
  1643. }
  1644. protected function setScaleY(_arg1:Number):void{
  1645. super.scaleY = _arg1;
  1646. }
  1647. private function initializeFocusManager():void{
  1648. if (stage == null){
  1649. addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
  1650. } else {
  1651. createFocusManager();
  1652. };
  1653. }
  1654. public function set focusManager(_arg1:IFocusManager):void{
  1655. UIComponent.focusManagers[this] = _arg1;
  1656. }
  1657. public function clearStyle(_arg1:String):void{
  1658. setStyle(_arg1, null);
  1659. }
  1660. protected function isInvalid(_arg1:String, ... _args):Boolean{
  1661. if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
  1662. return (true);
  1663. };
  1664. while (_args.length > 0) {
  1665. if (invalidHash[_args.pop()]){
  1666. return (true);
  1667. };
  1668. };
  1669. return (false);
  1670. }
  1671. public function setSize(_arg1:Number, _arg2:Number):void{
  1672. _width = _arg1;
  1673. _height = _arg2;
  1674. invalidate(InvalidationType.SIZE);
  1675. dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
  1676. }
  1677. override public function set width(_arg1:Number):void{
  1678. if (_width == _arg1){
  1679. return;
  1680. };
  1681. setSize(_arg1, height);
  1682. }
  1683. public function setFocus():void{
  1684. if (stage){
  1685. stage.focus = this;
  1686. };
  1687. }
  1688. protected function initializeAccessibility():void{
  1689. if (UIComponent.createAccessibilityImplementation != null){
  1690. UIComponent.createAccessibilityImplementation(this);
  1691. };
  1692. }
  1693. public function get focusManager():IFocusManager{
  1694. var _local1:DisplayObject;
  1695. _local1 = this;
  1696. while (_local1) {
  1697. if (UIComponent.focusManagers[_local1] != null){
  1698. return (IFocusManager(UIComponent.focusManagers[_local1]));
  1699. };
  1700. _local1 = _local1.parent;
  1701. };
  1702. return (null);
  1703. }
  1704. override public function get width():Number{
  1705. return (_width);
  1706. }
  1707. public function move(_arg1:Number, _arg2:Number):void{
  1708. _x = _arg1;
  1709. _y = _arg2;
  1710. super.x = Math.round(_arg1);
  1711. super.y = Math.round(_arg2);
  1712. dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
  1713. }
  1714. public function validateNow():void{
  1715. invalidate(InvalidationType.ALL, false);
  1716. draw();
  1717. }
  1718. public function getStyle(_arg1:String):Object{
  1719. return (instanceStyles[_arg1]);
  1720. }
  1721.  
  1722. }
  1723. }//package fl.core
  1724. package fl.core {
  1725.  
  1726. public class InvalidationType {
  1727.  
  1728. public static const SIZE:String = "size";
  1729. public static const ALL:String = "all";
  1730. public static const DATA:String = "data";
  1731. public static const SCROLL:String = "scroll";
  1732. public static const STATE:String = "state";
  1733. public static const STYLES:String = "styles";
  1734. public static const SELECTED:String = "selected";
  1735. public static const RENDERER_STYLES:String = "rendererStyles";
  1736.  
  1737. }
  1738. }//package fl.core
  1739. package fl.transitions.easing {
  1740.  
  1741. public class Strong {
  1742.  
  1743. public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  1744. _arg1 = (_arg1 / _arg4);
  1745. return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
  1746. }
  1747. public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  1748. _arg1 = ((_arg1 / _arg4) - 1);
  1749. return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
  1750. }
  1751. public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  1752. _arg1 = (_arg1 / (_arg4 / 2));
  1753. if (_arg1 < 1){
  1754. return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
  1755. };
  1756. _arg1 = (_arg1 - 2);
  1757. return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
  1758. }
  1759.  
  1760. }
  1761. }//package fl.transitions.easing
  1762. package fl.transitions.easing {
  1763.  
  1764. public class Back {
  1765.  
  1766. public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
  1767. if (!_arg5){
  1768. _arg5 = 1.70158;
  1769. };
  1770. _arg1 = (_arg1 / _arg4);
  1771. return (((((_arg3 * _arg1) * _arg1) * (((_arg5 + 1) * _arg1) - _arg5)) + _arg2));
  1772. }
  1773. public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
  1774. if (!_arg5){
  1775. _arg5 = 1.70158;
  1776. };
  1777. _arg1 = ((_arg1 / _arg4) - 1);
  1778. return (((_arg3 * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 1)) + _arg2));
  1779. }
  1780. public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
  1781. if (!_arg5){
  1782. _arg5 = 1.70158;
  1783. };
  1784. _arg1 = (_arg1 / (_arg4 / 2));
  1785. if (_arg1 < 1){
  1786. _arg5 = (_arg5 * 1.525);
  1787. return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) - _arg5))) + _arg2));
  1788. };
  1789. _arg1 = (_arg1 - 2);
  1790. _arg5 = (_arg5 * 1.525);
  1791. return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 2)) + _arg2));
  1792. }
  1793.  
  1794. }
  1795. }//package fl.transitions.easing
  1796. package fl.transitions {
  1797. import flash.events.*;
  1798.  
  1799. public class TweenEvent extends Event {
  1800.  
  1801. public static const MOTION_START:String = "motionStart";
  1802. public static const MOTION_STOP:String = "motionStop";
  1803. public static const MOTION_FINISH:String = "motionFinish";
  1804. public static const MOTION_CHANGE:String = "motionChange";
  1805. public static const MOTION_RESUME:String = "motionResume";
  1806. public static const MOTION_LOOP:String = "motionLoop";
  1807.  
  1808. public var time:Number = NaN;
  1809. public var position:Number = NaN;
  1810.  
  1811. public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
  1812. super(_arg1, _arg4, _arg5);
  1813. this.time = _arg2;
  1814. this.position = _arg3;
  1815. }
  1816. override public function clone():Event{
  1817. return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
  1818. }
  1819.  
  1820. }
  1821. }//package fl.transitions
  1822. package fl.transitions {
  1823. import flash.display.*;
  1824. import flash.events.*;
  1825. import flash.utils.*;
  1826.  
  1827. public class Tween extends EventDispatcher {
  1828.  
  1829. protected static var _mc:MovieClip = new MovieClip();
  1830.  
  1831. public var isPlaying:Boolean = false;
  1832. public var obj:Object = null;
  1833. public var prop:String = "";
  1834. public var func:Function;
  1835. public var begin:Number = NaN;
  1836. public var change:Number = NaN;
  1837. public var useSeconds:Boolean = false;
  1838. public var prevTime:Number = NaN;
  1839. public var prevPos:Number = NaN;
  1840. public var looping:Boolean = false;
  1841. private var _duration:Number = NaN;
  1842. private var _time:Number = NaN;
  1843. private var _fps:Number = NaN;
  1844. private var _position:Number = NaN;
  1845. private var _startTime:Number = NaN;
  1846. private var _intervalID:uint = 0;
  1847. private var _finish:Number = NaN;
  1848. private var _timer:Timer = null;
  1849.  
  1850. public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
  1851. this.func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
  1852. return ((((_arg3 * _arg1) / _arg4) + _arg2));
  1853. };
  1854. super();
  1855. if (!arguments.length){
  1856. return;
  1857. };
  1858. this.obj = _arg1;
  1859. this.prop = _arg2;
  1860. this.begin = _arg4;
  1861. this.position = _arg4;
  1862. this.duration = _arg6;
  1863. this.useSeconds = _arg7;
  1864. if ((_arg3 is Function)){
  1865. this.func = _arg3;
  1866. };
  1867. this.finish = _arg5;
  1868. this._timer = new Timer(100);
  1869. this.start();
  1870. }
  1871. public function get time():Number{
  1872. return (this._time);
  1873. }
  1874. public function set time(_arg1:Number):void{
  1875. this.prevTime = this._time;
  1876. if (_arg1 > this.duration){
  1877. if (this.looping){
  1878. this.rewind((_arg1 - this._duration));
  1879. this.update();
  1880. this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
  1881. } else {
  1882. if (this.useSeconds){
  1883. this._time = this._duration;
  1884. this.update();
  1885. };
  1886. this.stop();
  1887. this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
  1888. };
  1889. } else {
  1890. if (_arg1 < 0){
  1891. this.rewind();
  1892. this.update();
  1893. } else {
  1894. this._time = _arg1;
  1895. this.update();
  1896. };
  1897. };
  1898. }
  1899. public function get duration():Number{
  1900. return (this._duration);
  1901. }
  1902. public function set duration(_arg1:Number):void{
  1903. this._duration = ((_arg1)<=0) ? Infinity : _arg1;
  1904. }
  1905. public function get FPS():Number{
  1906. return (this._fps);
  1907. }
  1908. public function set FPS(_arg1:Number):void{
  1909. var _local2:Boolean = this.isPlaying;
  1910. this.stopEnterFrame();
  1911. this._fps = _arg1;
  1912. if (_local2){
  1913. this.startEnterFrame();
  1914. };
  1915. }
  1916. public function get position():Number{
  1917. return (this.getPosition(this._time));
  1918. }
  1919. public function set position(_arg1:Number):void{
  1920. this.setPosition(_arg1);
  1921. }
  1922. public function getPosition(_arg1:Number=NaN):Number{
  1923. if (isNaN(_arg1)){
  1924. _arg1 = this._time;
  1925. };
  1926. return (this.func(_arg1, this.begin, this.change, this._duration));
  1927. }
  1928. public function setPosition(_arg1:Number):void{
  1929. this.prevPos = this._position;
  1930. if (this.prop.length){
  1931. this.obj[this.prop] = (this._position = _arg1);
  1932. };
  1933. this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
  1934. }
  1935. public function get finish():Number{
  1936. return ((this.begin + this.change));
  1937. }
  1938. public function set finish(_arg1:Number):void{
  1939. this.change = (_arg1 - this.begin);
  1940. }
  1941. public function continueTo(_arg1:Number, _arg2:Number):void{
  1942. this.begin = this.position;
  1943. this.finish = _arg1;
  1944. if (!isNaN(_arg2)){
  1945. this.duration = _arg2;
  1946. };
  1947. this.start();
  1948. }
  1949. public function yoyo():void{
  1950. this.continueTo(this.begin, this.time);
  1951. }
  1952. protected function startEnterFrame():void{
  1953. var _local1:Number;
  1954. if (isNaN(this._fps)){
  1955. _mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
  1956. } else {
  1957. _local1 = (1000 / this._fps);
  1958. this._timer.delay = _local1;
  1959. this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
  1960. this._timer.start();
  1961. };
  1962. this.isPlaying = true;
  1963. }
  1964. protected function stopEnterFrame():void{
  1965. if (isNaN(this._fps)){
  1966. _mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
  1967. } else {
  1968. this._timer.stop();
  1969. };
  1970. this.isPlaying = false;
  1971. }
  1972. public function start():void{
  1973. this.rewind();
  1974. this.startEnterFrame();
  1975. this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
  1976. }
  1977. public function stop():void{
  1978. this.stopEnterFrame();
  1979. this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
  1980. }
  1981. public function resume():void{
  1982. this.fixTime();
  1983. this.startEnterFrame();
  1984. this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
  1985. }
  1986. public function rewind(_arg1:Number=0):void{
  1987. this._time = _arg1;
  1988. this.fixTime();
  1989. this.update();
  1990. }
  1991. public function fforward():void{
  1992. this.time = this._duration;
  1993. this.fixTime();
  1994. }
  1995. public function nextFrame():void{
  1996. if (this.useSeconds){
  1997. this.time = ((getTimer() - this._startTime) / 1000);
  1998. } else {
  1999. this.time = (this._time + 1);
  2000. };
  2001. }
  2002. protected function onEnterFrame(_arg1:Event):void{
  2003. this.nextFrame();
  2004. }
  2005. protected function timerHandler(_arg1:TimerEvent):void{
  2006. this.nextFrame();
  2007. _arg1.updateAfterEvent();
  2008. }
  2009. public function prevFrame():void{
  2010. if (!this.useSeconds){
  2011. this.time = (this._time - 1);
  2012. };
  2013. }
  2014. private function fixTime():void{
  2015. if (this.useSeconds){
  2016. this._startTime = (getTimer() - (this._time * 1000));
  2017. };
  2018. }
  2019. private function update():void{
  2020. this.setPosition(this.getPosition(this._time));
  2021. }
  2022.  
  2023. }
  2024. }//package fl.transitions
  2025. package fl.controls {
  2026. import flash.display.*;
  2027. import flash.events.*;
  2028. import fl.core.*;
  2029. import fl.managers.*;
  2030. import flash.text.*;
  2031. import fl.events.*;
  2032. import flash.ui.*;
  2033.  
  2034. public class LabelButton extends BaseButton implements IFocusManagerComponent {
  2035.  
  2036. private static var defaultStyles:Object = {
  2037. icon:null,
  2038. upIcon:null,
  2039. downIcon:null,
  2040. overIcon:null,
  2041. disabledIcon:null,
  2042. selectedDisabledIcon:null,
  2043. selectedUpIcon:null,
  2044. selectedDownIcon:null,
  2045. selectedOverIcon:null,
  2046. textFormat:null,
  2047. disabledTextFormat:null,
  2048. textPadding:5,
  2049. embedFonts:false
  2050. };
  2051. public static var createAccessibilityImplementation:Function;
  2052.  
  2053. protected var _labelPlacement:String = "right";
  2054. protected var _toggle:Boolean = false;
  2055. protected var icon:DisplayObject;
  2056. protected var oldMouseState:String;
  2057. protected var mode:String = "center";
  2058. public var textField:TextField;
  2059. protected var _label:String = "Label";
  2060.  
  2061. public function LabelButton(){
  2062. _labelPlacement = ButtonLabelPlacement.RIGHT;
  2063. _toggle = false;
  2064. _label = "Label";
  2065. mode = "center";
  2066. super();
  2067. }
  2068. public static function getStyleDefinition():Object{
  2069. return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
  2070. }
  2071.  
  2072. protected function toggleSelected(_arg1:MouseEvent):void{
  2073. selected = !(selected);
  2074. dispatchEvent(new Event(Event.CHANGE, true));
  2075. }
  2076. public function get labelPlacement():String{
  2077. return (_labelPlacement);
  2078. }
  2079. override protected function keyDownHandler(_arg1:KeyboardEvent):void{
  2080. if (!enabled){
  2081. return;
  2082. };
  2083. if (_arg1.keyCode == Keyboard.SPACE){
  2084. if (oldMouseState == null){
  2085. oldMouseState = mouseState;
  2086. };
  2087. setMouseState("down");
  2088. startPress();
  2089. };
  2090. }
  2091. protected function setEmbedFont(){
  2092. var _local1:Object;
  2093. _local1 = getStyleValue("embedFonts");
  2094. if (_local1 != null){
  2095. textField.embedFonts = _local1;
  2096. };
  2097. }
  2098. override protected function keyUpHandler(_arg1:KeyboardEvent):void{
  2099. if (!enabled){
  2100. return;
  2101. };
  2102. if (_arg1.keyCode == Keyboard.SPACE){
  2103. setMouseState(oldMouseState);
  2104. oldMouseState = null;
  2105. endPress();
  2106. dispatchEvent(new MouseEvent(MouseEvent.CLICK));
  2107. };
  2108. }
  2109. override public function get selected():Boolean{
  2110. return (((_toggle) ? _selected : false));
  2111. }
  2112. public function set labelPlacement(_arg1:String):void{
  2113. _labelPlacement = _arg1;
  2114. invalidate(InvalidationType.SIZE);
  2115. }
  2116. public function set toggle(_arg1:Boolean):void{
  2117. if (((!(_arg1)) && (super.selected))){
  2118. selected = false;
  2119. };
  2120. _toggle = _arg1;
  2121. if (_toggle){
  2122. addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
  2123. } else {
  2124. removeEventListener(MouseEvent.CLICK, toggleSelected);
  2125. };
  2126. invalidate(InvalidationType.STATE);
  2127. }
  2128. public function get label():String{
  2129. return (_label);
  2130. }
  2131. override public function set selected(_arg1:Boolean):void{
  2132. _selected = _arg1;
  2133. if (_toggle){
  2134. invalidate(InvalidationType.STATE);
  2135. };
  2136. }
  2137. override protected function draw():void{
  2138. if (textField.text != _label){
  2139. label = _label;
  2140. };
  2141. if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
  2142. drawBackground();
  2143. drawIcon();
  2144. drawTextFormat();
  2145. invalidate(InvalidationType.SIZE, false);
  2146. };
  2147. if (isInvalid(InvalidationType.SIZE)){
  2148. drawLayout();
  2149. };
  2150. if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
  2151. if (((isFocused) && (focusManager.showFocusIndicator))){
  2152. drawFocus(true);
  2153. };
  2154. };
  2155. validate();
  2156. }
  2157. public function get toggle():Boolean{
  2158. return (_toggle);
  2159. }
  2160. override protected function configUI():void{
  2161. super.configUI();
  2162. textField = new TextField();
  2163. textField.type = TextFieldType.DYNAMIC;
  2164. textField.selectable = false;
  2165. addChild(textField);
  2166. }
  2167. override protected function drawLayout():void{
  2168. var _local1:Number;
  2169. var _local2:String;
  2170. var _local3:Number;
  2171. var _local4:Number;
  2172. var _local5:Number;
  2173. var _local6:Number;
  2174. var _local7:Number;
  2175. var _local8:Number;
  2176. _local1 = Number(getStyleValue("textPadding"));
  2177. _local2 = (((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement);
  2178. textField.height = (textField.textHeight + 4);
  2179. _local3 = (textField.textWidth + 4);
  2180. _local4 = (textField.textHeight + 4);
  2181. _local5 = ((icon)==null) ? 0 : (icon.width + _local1);
  2182. _local6 = ((icon)==null) ? 0 : (icon.height + _local1);
  2183. textField.visible = (label.length > 0);
  2184. if (icon != null){
  2185. icon.x = Math.round(((width - icon.width) / 2));
  2186. icon.y = Math.round(((height - icon.height) / 2));
  2187. };
  2188. if (textField.visible == false){
  2189. textField.width = 0;
  2190. textField.height = 0;
  2191. } else {
  2192. if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
  2193. _local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
  2194. if ((height - 2) > _local4){
  2195. _local8 = _local4;
  2196. } else {
  2197. _local8 = (height - 2);
  2198. };
  2199. _local3 = _local7;
  2200. textField.width = _local3;
  2201. _local4 = _local8;
  2202. textField.height = _local4;
  2203. textField.x = Math.round(((width - _local3) / 2));
  2204. textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
  2205. if (icon != null){
  2206. icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
  2207. };
  2208. } else {
  2209. _local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
  2210. _local3 = _local7;
  2211. textField.width = _local3;
  2212. textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
  2213. textField.y = Math.round(((height - textField.height) / 2));
  2214. if (icon != null){
  2215. icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
  2216. };
  2217. };
  2218. };
  2219. super.drawLayout();
  2220. }
  2221. override protected function initializeAccessibility():void{
  2222. if (LabelButton.createAccessibilityImplementation != null){
  2223. LabelButton.createAccessibilityImplementation(this);
  2224. };
  2225. }
  2226. protected function drawIcon():void{
  2227. var _local1:DisplayObject;
  2228. var _local2:String;
  2229. var _local3:Object;
  2230. _local1 = icon;
  2231. _local2 = ((enabled) ? mouseState : "disabled");
  2232. if (selected){
  2233. _local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
  2234. };
  2235. _local2 = (_local2 + "Icon");
  2236. _local3 = getStyleValue(_local2);
  2237. if (_local3 == null){
  2238. _local3 = getStyleValue("icon");
  2239. };
  2240. if (_local3 != null){
  2241. icon = getDisplayObjectInstance(_local3);
  2242. };
  2243. if (icon != null){
  2244. addChildAt(icon, 1);
  2245. };
  2246. if (((!((_local1 == null))) && (!((_local1 == icon))))){
  2247. removeChild(_local1);
  2248. };
  2249. }
  2250. public function set label(_arg1:String):void{
  2251. _label = _arg1;
  2252. if (textField.text != _label){
  2253. textField.text = _label;
  2254. dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
  2255. };
  2256. invalidate(InvalidationType.SIZE);
  2257. invalidate(InvalidationType.STYLES);
  2258. }
  2259. protected function drawTextFormat():void{
  2260. var _local1:Object;
  2261. var _local2:TextFormat;
  2262. var _local3:TextFormat;
  2263. _local1 = UIComponent.getStyleDefinition();
  2264. _local2 = ((enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat));
  2265. textField.setTextFormat(_local2);
  2266. _local3 = (getStyleValue(((enabled) ? "textFormat" : "disabledTextFormat")) as TextFormat);
  2267. if (_local3 != null){
  2268. textField.setTextFormat(_local3);
  2269. } else {
  2270. _local3 = _local2;
  2271. };
  2272. textField.defaultTextFormat = _local3;
  2273. setEmbedFont();
  2274. }
  2275.  
  2276. }
  2277. }//package fl.controls
  2278. package fl.controls {
  2279. import flash.display.*;
  2280. import flash.events.*;
  2281. import fl.core.*;
  2282. import flash.utils.*;
  2283. import fl.events.*;
  2284.  
  2285. public class BaseButton extends UIComponent {
  2286.  
  2287. private static var defaultStyles:Object = {
  2288. upSkin:"Button_upSkin",
  2289. downSkin:"Button_downSkin",
  2290. overSkin:"Button_overSkin",
  2291. disabledSkin:"Button_disabledSkin",
  2292. selectedDisabledSkin:"Button_selectedDisabledSkin",
  2293. selectedUpSkin:"Button_selectedUpSkin",
  2294. selectedDownSkin:"Button_selectedDownSkin",
  2295. selectedOverSkin:"Button_selectedOverSkin",
  2296. focusRectSkin:null,
  2297. focusRectPadding:null,
  2298. repeatDelay:500,
  2299. repeatInterval:35
  2300. };
  2301.  
  2302. protected var _selected:Boolean = false;
  2303. private var unlockedMouseState:String;
  2304. protected var pressTimer:Timer;
  2305. protected var mouseState:String;
  2306. protected var background:DisplayObject;
  2307. private var _mouseStateLocked:Boolean = false;
  2308. protected var _autoRepeat:Boolean = false;
  2309.  
  2310. public function BaseButton(){
  2311. _selected = false;
  2312. _autoRepeat = false;
  2313. _mouseStateLocked = false;
  2314. super();
  2315. buttonMode = true;
  2316. mouseChildren = false;
  2317. useHandCursor = false;
  2318. setupMouseEvents();
  2319. setMouseState("up");
  2320. pressTimer = new Timer(1, 0);
  2321. pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
  2322. }
  2323. public static function getStyleDefinition():Object{
  2324. return (defaultStyles);
  2325. }
  2326.  
  2327. protected function endPress():void{
  2328. pressTimer.reset();
  2329. }
  2330. public function set mouseStateLocked(_arg1:Boolean):void{
  2331. _mouseStateLocked = _arg1;
  2332. if (_arg1 == false){
  2333. setMouseState(unlockedMouseState);
  2334. } else {
  2335. unlockedMouseState = mouseState;
  2336. };
  2337. }
  2338. public function get autoRepeat():Boolean{
  2339. return (_autoRepeat);
  2340. }
  2341. public function set autoRepeat(_arg1:Boolean):void{
  2342. _autoRepeat = _arg1;
  2343. }
  2344. override public function set enabled(_arg1:Boolean):void{
  2345. super.enabled = _arg1;
  2346. mouseEnabled = _arg1;
  2347. }
  2348. public function get selected():Boolean{
  2349. return (_selected);
  2350. }
  2351. protected function mouseEventHandler(_arg1:MouseEvent):void{
  2352. if (_arg1.type == MouseEvent.MOUSE_DOWN){
  2353. setMouseState("down");
  2354. startPress();
  2355. } else {
  2356. if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
  2357. setMouseState("over");
  2358. endPress();
  2359. } else {
  2360. if (_arg1.type == MouseEvent.ROLL_OUT){
  2361. setMouseState("up");
  2362. endPress();
  2363. };
  2364. };
  2365. };
  2366. }
  2367. public function setMouseState(_arg1:String):void{
  2368. if (_mouseStateLocked){
  2369. unlockedMouseState = _arg1;
  2370. return;
  2371. };
  2372. if (mouseState == _arg1){
  2373. return;
  2374. };
  2375. mouseState = _arg1;
  2376. invalidate(InvalidationType.STATE);
  2377. }
  2378. protected function startPress():void{
  2379. if (_autoRepeat){
  2380. pressTimer.delay = Number(getStyleValue("repeatDelay"));
  2381. pressTimer.start();
  2382. };
  2383. dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
  2384. }
  2385. protected function buttonDown(_arg1:TimerEvent):void{
  2386. if (!_autoRepeat){
  2387. endPress();
  2388. return;
  2389. };
  2390. if (pressTimer.currentCount == 1){
  2391. pressTimer.delay = Number(getStyleValue("repeatInterval"));
  2392. };
  2393. dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
  2394. }
  2395. public function set selected(_arg1:Boolean):void{
  2396. if (_selected == _arg1){
  2397. return;
  2398. };
  2399. _selected = _arg1;
  2400. invalidate(InvalidationType.STATE);
  2401. }
  2402. override public function get enabled():Boolean{
  2403. return (super.enabled);
  2404. }
  2405. override protected function draw():void{
  2406. if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
  2407. drawBackground();
  2408. invalidate(InvalidationType.SIZE, false);
  2409. };
  2410. if (isInvalid(InvalidationType.SIZE)){
  2411. drawLayout();
  2412. };
  2413. super.draw();
  2414. }
  2415. protected function setupMouseEvents():void{
  2416. addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
  2417. addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
  2418. addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
  2419. addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
  2420. }
  2421. protected function drawLayout():void{
  2422. background.width = width;
  2423. background.height = height;
  2424. }
  2425. protected function drawBackground():void{
  2426. var _local1:String;
  2427. var _local2:DisplayObject;
  2428. _local1 = ((enabled) ? mouseState : "disabled");
  2429. if (selected){
  2430. _local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
  2431. };
  2432. _local1 = (_local1 + "Skin");
  2433. _local2 = background;
  2434. background = getDisplayObjectInstance(getStyleValue(_local1));
  2435. addChildAt(background, 0);
  2436. if (((!((_local2 == null))) && (!((_local2 == background))))){
  2437. removeChild(_local2);
  2438. };
  2439. }
  2440.  
  2441. }
  2442. }//package fl.controls
  2443. package fl.controls {
  2444.  
  2445. public class ButtonLabelPlacement {
  2446.  
  2447. public static const TOP:String = "top";
  2448. public static const LEFT:String = "left";
  2449. public static const BOTTOM:String = "bottom";
  2450. public static const RIGHT:String = "right";
  2451.  
  2452. }
  2453. }//package fl.controls
  2454. package fl.controls {
  2455. import flash.display.*;
  2456. import fl.core.*;
  2457. import fl.managers.*;
  2458.  
  2459. public class Button extends LabelButton implements IFocusManagerComponent {
  2460.  
  2461. private static var defaultStyles:Object = {
  2462. emphasizedSkin:"Button_emphasizedSkin",
  2463. emphasizedPadding:2
  2464. };
  2465. public static var createAccessibilityImplementation:Function;
  2466.  
  2467. protected var emphasizedBorder:DisplayObject;
  2468. protected var _emphasized:Boolean = false;
  2469.  
  2470. public function Button(){
  2471. _emphasized = false;
  2472. super();
  2473. }
  2474. public static function getStyleDefinition():Object{
  2475. return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
  2476. }
  2477.  
  2478. override public function drawFocus(_arg1:Boolean):void{
  2479. var _local2:Number;
  2480. var _local3:*;
  2481. super.drawFocus(_arg1);
  2482. if (_arg1){
  2483. _local2 = Number(getStyleValue("emphasizedPadding"));
  2484. if ((((_local2 < 0)) || (!(_emphasized)))){
  2485. _local2 = 0;
  2486. };
  2487. _local3 = getStyleValue("focusRectPadding");
  2488. _local3 = ((_local3)==null) ? 2 : _local3;
  2489. _local3 = (_local3 + _local2);
  2490. uiFocusRect.x = -(_local3);
  2491. uiFocusRect.y = -(_local3);
  2492. uiFocusRect.width = (width + (_local3 * 2));
  2493. uiFocusRect.height = (height + (_local3 * 2));
  2494. };
  2495. }
  2496. public function set emphasized(_arg1:Boolean):void{
  2497. _emphasized = _arg1;
  2498. invalidate(InvalidationType.STYLES);
  2499. }
  2500. override protected function draw():void{
  2501. if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
  2502. drawEmphasized();
  2503. };
  2504. super.draw();
  2505. if (emphasizedBorder != null){
  2506. setChildIndex(emphasizedBorder, (numChildren - 1));
  2507. };
  2508. }
  2509. public function get emphasized():Boolean{
  2510. return (_emphasized);
  2511. }
  2512. override protected function initializeAccessibility():void{
  2513. if (Button.createAccessibilityImplementation != null){
  2514. Button.createAccessibilityImplementation(this);
  2515. };
  2516. }
  2517. protected function drawEmphasized():void{
  2518. var _local1:Object;
  2519. var _local2:Number;
  2520. if (emphasizedBorder != null){
  2521. removeChild(emphasizedBorder);
  2522. };
  2523. emphasizedBorder = null;
  2524. if (!_emphasized){
  2525. return;
  2526. };
  2527. _local1 = getStyleValue("emphasizedSkin");
  2528. if (_local1 != null){
  2529. emphasizedBorder = getDisplayObjectInstance(_local1);
  2530. };
  2531. if (emphasizedBorder != null){
  2532. addChildAt(emphasizedBorder, 0);
  2533. _local2 = Number(getStyleValue("emphasizedPadding"));
  2534. emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
  2535. emphasizedBorder.width = (width + (_local2 * 2));
  2536. emphasizedBorder.height = (height + (_local2 * 2));
  2537. };
  2538. }
  2539.  
  2540. }
  2541. }//package fl.controls
  2542. package {
  2543. import flash.display.*;
  2544.  
  2545. public dynamic class QuickPlayerBackground extends MovieClip {
  2546.  
  2547. }
  2548. }//package
  2549. package {
  2550. import flash.display.*;
  2551.  
  2552. public dynamic class GrayStrip extends MovieClip {
  2553.  
  2554. }
  2555. }//package
  2556. package {
  2557. import flash.text.*;
  2558.  
  2559. public dynamic class Font2 extends Font {
  2560.  
  2561. }
  2562. }//package
  2563. package {
  2564. import flash.display.*;
  2565.  
  2566. public dynamic class TopBottomShadow extends MovieClip {
  2567.  
  2568. }
  2569. }//package
  2570. package {
  2571. import flash.display.*;
  2572.  
  2573. public dynamic class ImageBackground extends MovieClip {
  2574.  
  2575. public function ImageBackground(){
  2576. addFrameScript(0, this.frame1);
  2577. }
  2578. function frame1(){
  2579. stop();
  2580. }
  2581.  
  2582. }
  2583. }//package
  2584. package {
  2585. import flash.display.*;
  2586.  
  2587. public dynamic class image_carousel_item extends MovieClip {
  2588.  
  2589. }
  2590. }//package
  2591. package com.hulu.masthead.view {
  2592. import flash.display.*;
  2593. import flash.events.*;
  2594. import flash.text.*;
  2595.  
  2596. public class MovieShowTimeButton extends MovieClip {
  2597.  
  2598. public var _movieshowtimeHover:MovieClip;
  2599. public var _title:TextField;
  2600.  
  2601. public function MovieShowTimeButton():void{
  2602. super();
  2603. mouseChildren = false;
  2604. this.buttonMode = true;
  2605. this.useHandCursor = true;
  2606. this._movieshowtimeHover.visible = false;
  2607. this.addEventListener(MouseEvent.MOUSE_OVER, this.onHover);
  2608. this.addEventListener(MouseEvent.MOUSE_OUT, this.onOut);
  2609. }
  2610. private function onHover(e:Event):void{
  2611. this._movieshowtimeHover.visible = true;
  2612. }
  2613. private function onOut(e:Event):void{
  2614. this._movieshowtimeHover.visible = false;
  2615. }
  2616.  
  2617. }
  2618. }//package com.hulu.masthead.view
  2619. package com.hulu.masthead.view {
  2620. import flash.display.*;
  2621. import flash.events.*;
  2622. import fl.transitions.*;
  2623. import fl.transitions.easing.*;
  2624.  
  2625. public class QuickPlayButton extends MovieClip {
  2626.  
  2627. public var hover_show:MovieClip;
  2628. public var hover_hide:MovieClip;
  2629. private var _onShow:Function;
  2630. private var _onHide:Function;
  2631. private var _isClicked:Boolean = false;
  2632. private var _tween:Tween;
  2633.  
  2634. public function QuickPlayButton(callbacks:Array){
  2635. super();
  2636. addFrameScript(0, this.frame1, 1, this.frame2);
  2637. mouseChildren = false;
  2638. this._onShow = callbacks[0];
  2639. this._onHide = callbacks[1];
  2640. this[("hover_" + this.currentLabel)].alpha = 0;
  2641. this.addEventListener(MouseEvent.MOUSE_DOWN, this.onClick);
  2642. this.addEventListener(MouseEvent.MOUSE_OVER, this.onOver);
  2643. this.addEventListener(MouseEvent.MOUSE_OUT, this.onOut);
  2644. }
  2645. public function reset(){
  2646. this.gotoAndStop("show");
  2647. this.hover_show.alpha = 0;
  2648. this.hover_show.visible = true;
  2649. }
  2650. public function onClick(event){
  2651. if (this._isClicked == false){
  2652. this._isClicked = true;
  2653. root.dispatchEvent(new Event("stopAutoScroll"));
  2654. };
  2655. if (this.currentLabel == "show"){
  2656. this.gotoAndStop("hide");
  2657. this.hover_hide.visible = true;
  2658. this._onShow();
  2659. } else {
  2660. this.gotoAndStop("show");
  2661. this.hover_show.visible = true;
  2662. this._onHide();
  2663. };
  2664. }
  2665. private function onOver(event:MouseEvent){
  2666. if (((this._tween) && (this._tween.isPlaying))){
  2667. this._tween.fforward();
  2668. };
  2669. var hover:* = this[("hover_" + this.currentLabel)];
  2670. hover.visible = true;
  2671. this._tween = new Tween(hover, "alpha", Strong.easeOut, hover.alpha, 1, 14);
  2672. }
  2673. private function onOut(event:MouseEvent){
  2674. if (((this._tween) && (this._tween.isPlaying))){
  2675. this._tween.fforward();
  2676. };
  2677. var hover:* = this[("hover_" + this.currentLabel)];
  2678. this._tween = new Tween(hover, "alpha", Strong.easeOut, hover.alpha, 0, 14);
  2679. }
  2680. function frame1(){
  2681. stop();
  2682. }
  2683. function frame2(){
  2684. stop();
  2685. }
  2686.  
  2687. }
  2688. }//package com.hulu.masthead.view
  2689. package com.hulu.masthead.view {
  2690. import flash.display.*;
  2691. import flash.events.*;
  2692. import fl.transitions.*;
  2693. import flash.utils.*;
  2694. import fl.motion.easing.*;
  2695.  
  2696. public class AS3QuickPlayer extends Sprite {
  2697.  
  2698. private static var __instance:AS3QuickPlayer;
  2699. private static var __playerHost:String;
  2700. private static var __playerEnv:String;
  2701.  
  2702. private var _player:AS3VideoContainer;
  2703. private var _background:QuickPlayerBackground;
  2704. private var _playerContainer:Sprite;
  2705. private var _playerMask:Sprite;
  2706. private var _closeButton:CloseButton;
  2707. private var _watchInHiResButton:WatchInHiResButton;
  2708. private var _style:Object;
  2709. private var _eid:String;
  2710. private var _playerState:String = "none";
  2711. private var _init:Boolean = false;
  2712. private var _tweens:Array;
  2713. private var _showTween:Tween;
  2714. private var _timeoutId:Number = -1;
  2715.  
  2716. public function AS3QuickPlayer(style:Object, stageWidth:Number, watchHiResCall:Function, eid:String, container:Sprite){
  2717. this._tweens = new Array();
  2718. super();
  2719. this._style = style;
  2720. this._eid = eid;
  2721. this._playerContainer = container;
  2722. this._background = new QuickPlayerBackground();
  2723. this._watchInHiResButton = new WatchInHiResButton(watchHiResCall);
  2724. this._watchInHiResButton.buttonMode = true;
  2725. this._closeButton = new CloseButton();
  2726. this._closeButton.buttonMode = true;
  2727. mouseChildren = true;
  2728. this._playerMask = new Sprite();
  2729. this._playerMask.graphics.beginFill(2298401, 0.5);
  2730. this._playerMask.graphics.drawRect(0, 0, (this._style.QuickPlayer.playerWidth + 1.2), (this._style.QuickPlayer.playerHeight + 1.2));
  2731. this._playerMask.graphics.endFill();
  2732. this._player = new AS3VideoContainer(this._style, this._eid, __playerHost, __playerEnv);
  2733. this._player.addEventListener("onInitializeSucceeded", this.onInitSucc);
  2734. this._player.mask = this._playerMask;
  2735. this.addChild(this._playerMask);
  2736. this.addChild(this._background);
  2737. this.addChild(this._closeButton);
  2738. this.addChild(this._player);
  2739. this.addChild(this._watchInHiResButton);
  2740. this.layoutObjects();
  2741. this.attachEvents();
  2742. }
  2743. public static function getInstance(style:Object, stageWidth:Number, watchHiResCall:Function, eid:String, container:Sprite){
  2744. if (!__instance){
  2745. __instance = new AS3QuickPlayer(style, stageWidth, watchHiResCall, eid, container);
  2746. };
  2747. __instance.update(watchHiResCall, eid, container);
  2748. return (__instance);
  2749. }
  2750. public static function get hasInstance():Boolean{
  2751. return (!((__instance == null)));
  2752. }
  2753. public static function set playerHost(url:String){
  2754. __playerHost = url;
  2755. }
  2756. public static function set playerEnv(env:String){
  2757. __playerEnv = env;
  2758. }
  2759.  
  2760. public function update(watchHiResCall:Function, eid:String, container:Sprite){
  2761. this._playerState = "none";
  2762. if (this._eid != eid){
  2763. this._eid = eid;
  2764. };
  2765. if (null == watchHiResCall){
  2766. this._watchInHiResButton.visible = false;
  2767. } else {
  2768. this._watchInHiResButton.visible = true;
  2769. this._watchInHiResButton.callbacks = watchHiResCall;
  2770. };
  2771. this._playerContainer = container;
  2772. this.layoutObjects();
  2773. }
  2774. public function layoutObjects(){
  2775. this._background.width = this._style.ImageItem.width;
  2776. this._closeButton.x = (this._background.width - this._style.QuickPlayer.closeBtnRightMargin);
  2777. this._closeButton.y = this._style.QuickPlayer.closeBtnTopMargin;
  2778. this._closeButton.light_mc.visible = false;
  2779. this._player.x = ((this._style.ImageItem.width - this._style.QuickPlayer.playerWidth) / 2);
  2780. this._playerMask.x = (this._player.x - 0.2);
  2781. this._player.y = ((-(this._style.QuickPlayer.playerHeight) + this._style.QuickPlayer.playerMarginTop) + this._style.QuickPlayer.playerHeight);
  2782. this._playerMask.y = (this._player.y - 0.2);
  2783. this._watchInHiResButton.x = (this._style.ImageItem.width / 2);
  2784. this._watchInHiResButton.y = (this._style.ImageItem.height - (this._style.QuickPlayer.playerMarginBottom / 2));
  2785. }
  2786. private function attachEvents(){
  2787. this._closeButton.mouseChildren = false;
  2788. this._closeButton.addEventListener(MouseEvent.ROLL_OVER, function (e){
  2789. e.target.light_mc.visible = true;
  2790. });
  2791. this._closeButton.addEventListener(MouseEvent.ROLL_OUT, function (e){
  2792. e.target.light_mc.visible = false;
  2793. });
  2794. this._closeButton.addEventListener(MouseEvent.MOUSE_DOWN, function (e){
  2795. hide(false);
  2796. __instance.dispatchEvent(new Event("closeQuickPlayer"));
  2797. });
  2798. }
  2799. public function pause(){
  2800. this._player.pausePlayer();
  2801. }
  2802. public function play(){
  2803. this._player.playPlayer();
  2804. }
  2805. public function stop(){
  2806. this._player.stopPlayer();
  2807. (this._playerState == "none");
  2808. }
  2809. public function load(eid:String, manual:Boolean){
  2810. this._player.load(eid);
  2811. }
  2812. public function get eid(){
  2813. return (this._eid);
  2814. }
  2815. public function show(hardset:Boolean){
  2816. var hardset:* = hardset;
  2817. this.stopTweens();
  2818. trace(((("SHOW" + hardset) + ":") + this._playerContainer));
  2819. if (!hardset){
  2820. if ((((this._playerState == "none")) && (this._init))){
  2821. };
  2822. this._showTween = new Tween(this._playerContainer, "scaleX", Quartic.easeOut, this._playerContainer.scaleX, 1, 10);
  2823. this._showTween.addEventListener(TweenEvent.MOTION_STOP, function (e){
  2824. if (_timeoutId != -1){
  2825. clearTimeout(_timeoutId);
  2826. _timeoutId = -1;
  2827. };
  2828. });
  2829. this._showTween.addEventListener(TweenEvent.MOTION_FINISH, function (e){
  2830. if (_playerState == "none"){
  2831. _playerState = "playing";
  2832. load(_eid, false);
  2833. } else {
  2834. play();
  2835. };
  2836. });
  2837. this.addTween(this._showTween);
  2838. this.addTween(new Tween(this._playerContainer, "scaleY", Quartic.easeOut, this._playerContainer.scaleY, 1, 10));
  2839. this.addTween(new Tween(this._playerContainer, "alpha", Quartic.easeOut, this.alpha, 1, 10));
  2840. } else {
  2841. var _local3 = this._playerContainer;
  2842. with (_local3) {
  2843. scaleX = 1;
  2844. scaleY = 1;
  2845. alpha = 1;
  2846. };
  2847. };
  2848. }
  2849. public function hide(hardset:Boolean){
  2850. var hardset:* = hardset;
  2851. this.stopTweens();
  2852. this.pause();
  2853. trace(((("HIDE" + hardset) + ":") + this._playerContainer));
  2854. if (!hardset){
  2855. this.addTween(new Tween(this._playerContainer, "scaleX", Quartic.easeOut, this._playerContainer.scaleX, 0, 10));
  2856. this.addTween(new Tween(this._playerContainer, "scaleY", Quartic.easeOut, this._playerContainer.scaleY, 0, 10));
  2857. this.addTween(new Tween(this._playerContainer, "alpha", Quartic.easeOut, this._playerContainer.alpha, 0, 10));
  2858. } else {
  2859. var _local3 = this._playerContainer;
  2860. with (_local3) {
  2861. scaleX = 0;
  2862. scaleY = 0;
  2863. alpha = 0;
  2864. };
  2865. };
  2866. }
  2867. private function stopTweens():void{
  2868. if (this._tweens == null){
  2869. return;
  2870. };
  2871. var i:* = 0;
  2872. while (i < this._tweens.length) {
  2873. if (this._tweens[i] != null){
  2874. this._tweens[i].stop();
  2875. this._tweens[i] = null;
  2876. };
  2877. i++;
  2878. };
  2879. this._tweens = null;
  2880. }
  2881. private function addTween(tween:Tween):void{
  2882. if (this._tweens == null){
  2883. this._tweens = new Array();
  2884. };
  2885. this._tweens.push(tween);
  2886. }
  2887. private function get available(){
  2888. if (((this._playerContainer) && (this._eid))){
  2889. return (true);
  2890. };
  2891. return (false);
  2892. }
  2893. private function onInitSucc(e:Event){
  2894. this._init = true;
  2895. this._playerState = "playing";
  2896. this._player.removeEventListener("onInitializeSucceeded", this.onInitSucc);
  2897. }
  2898.  
  2899. }
  2900. }//package com.hulu.masthead.view
  2901. package com.hulu.masthead.view {
  2902. import flash.display.*;
  2903. import flash.events.*;
  2904. import flash.net.*;
  2905. import fl.transitions.*;
  2906. import flash.utils.*;
  2907. import com.hulu.masthead.utils.*;
  2908. import fl.motion.easing.*;
  2909. import flash.text.*;
  2910.  
  2911. public class MoreBoard extends Sprite {
  2912.  
  2913. public var _moreBackground:ImageBackground;
  2914. public var _caption:TextField;
  2915. public var _btnHideMore:HideMoreButton;
  2916. private var _logoImage:Sprite;
  2917. private var _description:String;
  2918. private var _logoUrl:String;
  2919. private var _style:Object;
  2920. public var _fadeInTween:Tween;
  2921. public var defaultY:Number;
  2922.  
  2923. public function MoreBoard(style:Object, description:String, logoUrl:String){
  2924. super();
  2925. buttonMode = false;
  2926. this.visible = false;
  2927. this._style = style;
  2928. this._description = ((description) || (""));
  2929. this._logoUrl = ((logoUrl) || (""));
  2930. this._moreBackground.mouseChildren = false;
  2931. this.createObjects();
  2932. this.attachEvents();
  2933. }
  2934. private function createObjects(){
  2935. this._caption.autoSize = "left";
  2936. this._caption.setTextFormat(new TextFormat(null, this._style.DetailsOverlay.captionFontSize, null, true));
  2937. this._caption.text = this._description;
  2938. this._caption.cacheAsBitmap = true;
  2939. this._logoImage = new Sprite();
  2940. addChild(this._logoImage);
  2941. if (!this._logoUrl){
  2942. this.layoutObjects((this._btnHideMore.height + this._style.DetailsOverlay.logoTopMargin));
  2943. } else {
  2944. this._logoImage.addChild(Utility.loadImage(this._logoUrl, this.loadSucceed, this.loadError));
  2945. };
  2946. }
  2947. private function attachEvents(){
  2948. var self:* = this;
  2949. this._btnHideMore.onClick = function (){
  2950. slideOut(true);
  2951. };
  2952. }
  2953. private function loadSucceed(event:Event){
  2954. this._logoImage.x = ((this._style.DetailsOverlay.borderWidth - this._logoImage.width) / 2);
  2955. this._logoImage.y = (this._btnHideMore.height + this._style.DetailsOverlay.logoTopMargin);
  2956. this.layoutObjects(((this._logoImage.y + this._logoImage.height) + this._style.DetailsOverlay.logoHeaderMargin));
  2957. }
  2958. private function loadError(event:IOErrorEvent){
  2959. this.layoutObjects((this._btnHideMore.height + this._style.DetailsOverlay.logoTopMargin));
  2960. }
  2961. private function layoutObjects(ystart){
  2962. this._caption.y = (ystart + this._style.DetailsOverlay.headerCaptionMargin);
  2963. }
  2964. public function slideIn(isGradully:Boolean){
  2965. var isGradully:* = isGradully;
  2966. if (isGradully){
  2967. this._fadeInTween = new Tween(this, "y", Quartic.easeOut, y, this.defaultY, 1, true);
  2968. setTimeout(function (){
  2969. _caption.visible = false;
  2970. _caption.visible = true;
  2971. }, 24);
  2972. } else {
  2973. this.y = this.defaultY;
  2974. };
  2975. }
  2976. public function slideOut(isGradully:Boolean){
  2977. if (isGradully){
  2978. this._fadeInTween = new Tween(this, "y", Quartic.easeOut, y, (this.defaultY + this._style.ImageItem.height), 0.8, true);
  2979. } else {
  2980. this.y = (this.defaultY + this._style.ImageItem.height);
  2981. };
  2982. }
  2983. public function turnLight(){
  2984. }
  2985. public function turnDark(){
  2986. }
  2987.  
  2988. }
  2989. }//package com.hulu.masthead.view
  2990. package com.hulu.masthead.view {
  2991. import flash.display.*;
  2992. import flash.events.*;
  2993.  
  2994. public class SliderControl extends Sprite {
  2995.  
  2996. protected var _controller:Object;
  2997. protected var _style:Object;
  2998. protected var _stage:Sprite;
  2999. protected var _currentPage:Number = 0;
  3000. protected var _totalPages:Number = 10;
  3001. protected var _stageWidth:Number;
  3002.  
  3003. public function SliderControl(controller:Object, stage:Sprite){
  3004. super();
  3005. this._controller = controller;
  3006. this._stage = stage;
  3007. this.createObjects();
  3008. this.layoutObjects();
  3009. this.attachEvents();
  3010. }
  3011. public function createObjects(){
  3012. this._style = this._controller.style;
  3013. this._totalPages = this._controller.totalPages;
  3014. }
  3015. protected function layoutObjects(){
  3016. this._stageWidth = this._controller.stageWidth;
  3017. }
  3018. protected function attachEvents(){
  3019. }
  3020. public function enable(){
  3021. this.createSliders();
  3022. this.attachEvents();
  3023. }
  3024. public function disable(){
  3025. }
  3026. protected function createSliders(){
  3027. }
  3028. protected function switchPage(event:MouseEvent){
  3029. }
  3030. protected function endArrowPress(event:MouseEvent){
  3031. }
  3032. protected function over(event:MouseEvent){
  3033. }
  3034. protected function out(event:MouseEvent){
  3035. }
  3036. protected function onResize(event:Event){
  3037. this.layoutObjects();
  3038. }
  3039.  
  3040. }
  3041. }//package com.hulu.masthead.view
  3042. package com.hulu.masthead.view {
  3043. import flash.display.*;
  3044. import flash.events.*;
  3045. import flash.net.*;
  3046. import fl.transitions.*;
  3047. import flash.system.*;
  3048. import com.hulu.masthead.utils.*;
  3049. import fl.motion.easing.*;
  3050. import com.hulu.masthead.controller.*;
  3051.  
  3052. public class MovieShowTimeContainer extends Sprite {
  3053.  
  3054. public static var playerenv:String;
  3055.  
  3056. private const swfPath:String = "/movieshowtime.swf";
  3057.  
  3058. private var _movieShowTimeObj:Object;
  3059. private var _movieShowTimeLdr:Loader;
  3060. private var _data:String = "";
  3061. private var _instance:MovieShowTimeContainer;
  3062. private var _bg:Sprite;
  3063. private var _mask:Sprite;
  3064. private var _zipcodeBeacon:Function;
  3065. private var _buyticketBeacon:Function;
  3066. private var _controller;
  3067. private var _loadingAni:LoadingImage;
  3068. private var _style:Object;
  3069. private var _showTween:Tween;
  3070. private var _hideTween:Tween;
  3071.  
  3072. public function MovieShowTimeContainer(zipcodeBeacon:Function, buyTicketBeacon:Function, con):void{
  3073. super();
  3074. this._controller = con;
  3075. this._style = this._controller.style;
  3076. this._zipcodeBeacon = zipcodeBeacon;
  3077. this._buyticketBeacon = buyTicketBeacon;
  3078. this._bg = new Sprite();
  3079. this._bg.graphics.beginFill(0, 0.5);
  3080. this._bg.graphics.drawRect(0, 0, this._style.ImageItem.width, this._style.ImageItem.height);
  3081. this._bg.graphics.endFill();
  3082. addChild(this._bg);
  3083. this._mask = new Sprite();
  3084. this._mask.graphics.beginFill(0xFF0000, 1);
  3085. this._mask.graphics.drawRect(0, 0, this._style.ImageItem.width, this._style.ImageItem.height);
  3086. this._mask.graphics.endFill();
  3087. addChild(this._mask);
  3088. this.mask = this._mask;
  3089. this._loadingAni = new LoadingImage();
  3090. addChild(this._loadingAni);
  3091. this._loadingAni.clickArea.x = (-(this._controller.stageWidth) / 2);
  3092. this._loadingAni.clickArea.y = (-(this._style.Carousel.height) / 2);
  3093. this._loadingAni.clickArea.width = (this._controller.stageWidth - (this._style.Carousel.leftMargin * 2));
  3094. this._loadingAni.clickArea.height = this._style.ImageItem.height;
  3095. this._loadingAni.x = (this._bg.width / 2);
  3096. this._loadingAni.y = (this._style.Carousel.height / 2);
  3097. this._movieShowTimeLdr = new Loader();
  3098. this._movieShowTimeLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onComplete);
  3099. this._movieShowTimeLdr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onError);
  3100. this._movieShowTimeLdr.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onError);
  3101. this._movieShowTimeLdr.load(new URLRequest(this.swfPath), new LoaderContext(true, new ApplicationDomain()));
  3102. }
  3103. public function showMST():void{
  3104. if (!this._movieShowTimeObj){
  3105. return;
  3106. };
  3107. if (((this._hideTween) && (this._hideTween.isPlaying))){
  3108. this._hideTween.stop();
  3109. this._hideTween = null;
  3110. };
  3111. this._bg.visible = true;
  3112. new Tween(this._movieShowTimeObj, "alpha", Quartic.easeOut, this._movieShowTimeObj.alpha, 1, 10);
  3113. this._showTween = new Tween(this._movieShowTimeObj, "y", Quartic.easeOut, this._movieShowTimeObj.y, 0, 10);
  3114. this._showTween.addEventListener(TweenEvent.MOTION_FINISH, this.onFinishShow);
  3115. }
  3116. private function hideMST(e:Event=null):void{
  3117. if (((this._showTween) && (this._showTween.isPlaying))){
  3118. this._showTween.stop();
  3119. this._showTween = null;
  3120. };
  3121. this._bg.visible = false;
  3122. if (this._controller){
  3123. (this._controller as HuluCarousel).switchNextAutomatic();
  3124. };
  3125. new Tween(this._movieShowTimeObj, "alpha", Quartic.easeOut, 1, 0, 10);
  3126. this._hideTween = new Tween(this._movieShowTimeObj, "y", Quartic.easeOut, this._movieShowTimeObj.y, this._bg.height, 10);
  3127. this._hideTween.addEventListener(TweenEvent.MOTION_FINISH, this.onFinishHide);
  3128. }
  3129. public function set data(v:String):void{
  3130. var v:* = v;
  3131. this._data = v;
  3132. if (this._movieShowTimeObj){
  3133. try {
  3134. this._movieShowTimeObj.movieID = v;
  3135. } catch(e) {
  3136. trace(e);
  3137. };
  3138. };
  3139. }
  3140. private function onFinishShow(e:Event):void{
  3141. if (!this._movieShowTimeObj){
  3142. return;
  3143. };
  3144. this._movieShowTimeObj.alpha = 1;
  3145. this._movieShowTimeObj.y = 0;
  3146. this._showTween = null;
  3147. }
  3148. private function onFinishHide(e:Event):void{
  3149. if (!this._movieShowTimeObj){
  3150. return;
  3151. };
  3152. this._movieShowTimeObj.alpha = 0;
  3153. this._movieShowTimeObj.y = this._bg.height;
  3154. this._hideTween = null;
  3155. }
  3156. private function onComplete(e:Event=null):void{
  3157. var e = e;
  3158. this._loadingAni.visible = false;
  3159. this._movieShowTimeObj = this._movieShowTimeLdr.content;
  3160. try {
  3161. this._movieShowTimeObj.playerenv = playerenv;
  3162. this._movieShowTimeObj.addEventListener("CLICK_CLOSE", this.hideMST);
  3163. if (this._data){
  3164. this._movieShowTimeObj.movieID = this._data;
  3165. };
  3166. this._movieShowTimeObj.setBeaconCallBack(this._zipcodeBeacon, this._buyticketBeacon);
  3167. addChild((this._movieShowTimeObj as DisplayObject));
  3168. } catch(e) {
  3169. trace("zError MovieShowTimeContainer->onComplete");
  3170. };
  3171. }
  3172. private function onError(e:Event):void{
  3173. this._loadingAni.visible = false;
  3174. this._bg.visible = false;
  3175. }
  3176.  
  3177. }
  3178. }//package com.hulu.masthead.view
  3179. package com.hulu.masthead.view {
  3180. import flash.display.*;
  3181. import flash.events.*;
  3182. import fl.transitions.*;
  3183. import fl.transitions.easing.*;
  3184.  
  3185. public class WatchInHiResButton extends MovieClip {
  3186.  
  3187. public var light_mc:MovieClip;
  3188. private var _callbacks:Function;
  3189. private var _tween:Tween;
  3190.  
  3191. public function WatchInHiResButton(callbacks:Function){
  3192. super();
  3193. this.mouseChildren = false;
  3194. this.light_mc.alpha = 0;
  3195. this._callbacks = callbacks;
  3196. this.addEventListener(MouseEvent.MOUSE_DOWN, this.onClicked);
  3197. this.addEventListener(MouseEvent.MOUSE_OVER, this.onOver);
  3198. this.addEventListener(MouseEvent.MOUSE_OUT, this.onOut);
  3199. }
  3200. public function set callbacks(val:Function){
  3201. this._callbacks = val;
  3202. }
  3203. private function onClicked(e){
  3204. if ((this._callbacks is Function)){
  3205. this._callbacks();
  3206. };
  3207. }
  3208. private function onOver(event:MouseEvent){
  3209. if (this._tween){
  3210. this._tween.fforward();
  3211. };
  3212. this._tween = new Tween(this.light_mc, "alpha", Strong.easeOut, this.light_mc.alpha, 1, 14);
  3213. }
  3214. private function onOut(event:MouseEvent){
  3215. if (this._tween){
  3216. this._tween.fforward();
  3217. };
  3218. this._tween = new Tween(this.light_mc, "alpha", Strong.easeOut, this.light_mc.alpha, 0, 14);
  3219. }
  3220.  
  3221. }
  3222. }//package com.hulu.masthead.view
  3223. package com.hulu.masthead.view {
  3224. import flash.display.*;
  3225. import flash.events.*;
  3226. import com.hulu.masthead.utils.*;
  3227. import fl.motion.easing.*;
  3228.  
  3229. public class HuluSliderControl extends SliderControl {
  3230.  
  3231. static var BUTTONSCALE:Number = 170;
  3232.  
  3233. protected var _leftArrow:LeftArrowButton;
  3234. protected var _rightArrow:RightArrowButton;
  3235. private var _jumpButtons:Array;
  3236. private var _jumpButton:JumpButton;
  3237. private var _jumpBtnMargin:Number;
  3238.  
  3239. public function HuluSliderControl(controller:Object, stage:Sprite){
  3240. this._jumpButtons = new Array();
  3241. super(controller, stage);
  3242. }
  3243. private function createArrowButtons(){
  3244. this._leftArrow = new LeftArrowButton();
  3245. this._rightArrow = new RightArrowButton();
  3246. addChild(this._leftArrow);
  3247. addChild(this._rightArrow);
  3248. var _local2 = this._leftArrow;
  3249. with (_local2) {
  3250. buttonMode = true;
  3251. mouseChildren = false;
  3252. graphics.beginFill(0, 0);
  3253. graphics.drawRect((-(_style.SliderControl.buttonPaddingWidth) / 2), (-(_style.SliderControl.buttonPaddingHeight) / 2), _style.SliderControl.buttonPaddingWidth, _style.SliderControl.buttonPaddingHeight);
  3254. graphics.endFill();
  3255. };
  3256. _local2 = this._rightArrow;
  3257. with (_local2) {
  3258. buttonMode = true;
  3259. mouseChildren = false;
  3260. graphics.beginFill(0, 0);
  3261. graphics.drawRect((-(_style.SliderControl.buttonPaddingWidth) / 2), (-(_style.SliderControl.buttonPaddingHeight) / 2), _style.SliderControl.buttonPaddingWidth, _style.SliderControl.buttonPaddingHeight);
  3262. graphics.endFill();
  3263. };
  3264. _local2 = this._leftArrow;
  3265. with (_local2) {
  3266. addEventListener(MouseEvent.MOUSE_DOWN, switchPage);
  3267. addEventListener(MouseEvent.MOUSE_UP, endArrowPress);
  3268. addEventListener(MouseEvent.ROLL_OVER, over);
  3269. addEventListener(MouseEvent.ROLL_OUT, out);
  3270. };
  3271. _local2 = this._rightArrow;
  3272. with (_local2) {
  3273. addEventListener(MouseEvent.MOUSE_DOWN, switchPage);
  3274. addEventListener(MouseEvent.MOUSE_UP, endArrowPress);
  3275. addEventListener(MouseEvent.ROLL_OVER, over);
  3276. addEventListener(MouseEvent.ROLL_OUT, out);
  3277. };
  3278. this._leftArrow.x = _style.SliderControl.buttonLeftMargin;
  3279. this._rightArrow.x = (_stageWidth - _style.SliderControl.buttonLeftMargin);
  3280. this._leftArrow.y = (this._rightArrow.y = _style.SliderControl.buttonHeaderMargin);
  3281. }
  3282. override protected function attachEvents(){
  3283. super.attachEvents();
  3284. _controller.stage.addEventListener("stageResize", onResize);
  3285. addEventListener("resetJumpBtns", this.resetJumpBtns);
  3286. }
  3287. private function resetJumpBtns(event:Event){
  3288. var i:* = 0;
  3289. while (i < this._jumpButtons.length) {
  3290. this._jumpButtons[i].selectedMark.visible = false;
  3291. i++;
  3292. };
  3293. this._jumpButtons[(_controller.currentPage % _controller.totalItems)].selectedMark.visible = true;
  3294. }
  3295. override protected function layoutObjects(){
  3296. var i:* = undefined;
  3297. super.layoutObjects();
  3298. if (((this._leftArrow) && (this._rightArrow))){
  3299. this._leftArrow.x = _style.SliderControl.buttonLeftMargin;
  3300. this._rightArrow.x = (_stageWidth - _style.SliderControl.buttonLeftMargin);
  3301. this._leftArrow.y = (this._rightArrow.y = _style.SliderControl.buttonHeaderMargin);
  3302. };
  3303. if (this._jumpButtons.length > 0){
  3304. i = 0;
  3305. while (i < _totalPages) {
  3306. try {
  3307. var _local2 = this._jumpButtons[i];
  3308. with (_local2) {
  3309. x = (((_stageWidth / 2) - ((_jumpBtnMargin * (_totalPages - 1)) / 2)) + (_jumpBtnMargin * i));
  3310. };
  3311. } catch(e) {
  3312. };
  3313. i = (i + 1);
  3314. };
  3315. };
  3316. }
  3317. override protected function createSliders(){
  3318. this.createArrowButtons();
  3319. this._rightArrow.arrow_mc.alpha = (this._leftArrow.arrow_mc.alpha = 0.4);
  3320. this.createJumpButtons();
  3321. }
  3322. private function createJumpButtons(){
  3323. this._jumpBtnMargin = _style.ImageItem.jumpBtnMargin;
  3324. var i:* = 0;
  3325. while (i < _controller.totalItems) {
  3326. this._jumpButton = new JumpButton();
  3327. this._jumpButtons.push(this._jumpButton);
  3328. addChild(this._jumpButtons[i]);
  3329. var _local2 = this._jumpButtons[i];
  3330. with (_local2) {
  3331. mouseChildren = false;
  3332. buttonMode = true;
  3333. light_mc.visible = true;
  3334. light_mc.alpha = 0;
  3335. selectedMark.visible = false;
  3336. x = (((_stageWidth / 2) - ((_jumpBtnMargin * (_totalPages - 1)) / 2)) + (_jumpBtnMargin * i));
  3337. y = (_style.Carousel.height - (_style.Carousel.baseGradientHeight / 2));
  3338. addEventListener(MouseEvent.MOUSE_DOWN, switchPage);
  3339. addEventListener(MouseEvent.ROLL_OVER, over);
  3340. addEventListener(MouseEvent.ROLL_OUT, out);
  3341. };
  3342. this._jumpButton = null;
  3343. i = (i + 1);
  3344. };
  3345. this._jumpButtons[_controller.currentPage].selectedMark.visible = true;
  3346. }
  3347. override public function disable(){
  3348. this.createJumpButtons();
  3349. }
  3350. override protected function over(event:MouseEvent){
  3351. if ((event.target is JumpButton)){
  3352. event.target.light_mc.alpha = 1;
  3353. } else {
  3354. Utility.tweenTo(event.target.arrow_mc, {
  3355. alpha:1,
  3356. scaleX:1.3,
  3357. scaleY:1.3
  3358. }, Back.easeOut, 9, null);
  3359. };
  3360. }
  3361. override protected function out(event:MouseEvent){
  3362. if ((event.target is JumpButton)){
  3363. event.target.light_mc.alpha = 0;
  3364. } else {
  3365. Utility.tweenTo(event.target.arrow_mc, {
  3366. alpha:0.4,
  3367. scaleX:1,
  3368. scaleY:1
  3369. }, Back.easeOut, 9, null);
  3370. };
  3371. }
  3372. override protected function switchPage(event:MouseEvent){
  3373. var i:*;
  3374. if (_controller.intvAutoscroll != -1){
  3375. dispatchEvent(new Event("stopAutoScroll"));
  3376. };
  3377. if (event.target == this._leftArrow){
  3378. _controller.pageTo((_controller.currentPage - 1), -1);
  3379. } else {
  3380. if (event.target == this._rightArrow){
  3381. _controller.pageTo((_controller.currentPage + 1), 1);
  3382. } else {
  3383. i = 0;
  3384. while (i < this._jumpButtons.length) {
  3385. if (event.target == this._jumpButtons[i]){
  3386. if ((((_controller.totalItems < 4)) && ((_controller.currentPage >= _controller.totalItems)))){
  3387. _controller.pageTo((_controller.totalItems + i), null);
  3388. } else {
  3389. _controller.pageTo(i, null);
  3390. };
  3391. break;
  3392. };
  3393. i++;
  3394. };
  3395. };
  3396. };
  3397. }
  3398.  
  3399. }
  3400. }//package com.hulu.masthead.view
  3401. package com.hulu.masthead.view {
  3402. import flash.display.*;
  3403. import flash.events.*;
  3404. import flash.net.*;
  3405. import com.hulu.masthead.utils.*;
  3406. import com.hulu.masthead.controller.*;
  3407. import flash.external.*;
  3408.  
  3409. public class ImageItem extends Sprite {
  3410.  
  3411. protected static var beaconLoadTraceAllowed:Number = 100;
  3412.  
  3413. protected var _style:Object;
  3414. protected var _data:Object;
  3415. protected var _imageContainer:Sprite;
  3416. protected var _imageClip:Loader;
  3417. protected var _loadState:String = "none";
  3418. protected var _imageUrl:String;
  3419. protected var _linkUrl:String;
  3420. protected var _loadingClip:LoadingImage;
  3421. protected var _controller;
  3422. protected var _bgClip:Sprite;
  3423. protected var _bgLoader:Loader;
  3424. protected var _imageMask:Sprite;
  3425. protected var _id:Number;
  3426. protected var _videoId:Number;
  3427. protected var _showId:Number;
  3428. protected var _mastheadclickBeaconDisabled:Boolean = false;
  3429.  
  3430. public function ImageItem(controller:Object, data:Object, id:Number){
  3431. super();
  3432. this._controller = controller;
  3433. this._style = this._controller.style;
  3434. this._id = id;
  3435. this.initData(data);
  3436. }
  3437. protected function initData(data:Object){
  3438. this._data = data;
  3439. this._imageUrl = this._data["imageUrl"];
  3440. this._linkUrl = this._data["linkUrl"];
  3441. if (((this._data["salesforcePlacementTag"]) && ((this._data["salesforcePlacementTag"].indexOf("http://") >= 0)))){
  3442. this._data["xmlUrl"] = this._data["salesforcePlacementTag"];
  3443. };
  3444. this._videoId = -1;
  3445. if (this._data["videoId"]){
  3446. this._videoId = this._data["videoId"];
  3447. };
  3448. this._showId = -1;
  3449. if (this._data["showId"]){
  3450. this._showId = this._data["showId"];
  3451. };
  3452. }
  3453. public function get videoId():Number{
  3454. return (this._videoId);
  3455. }
  3456. public function set videoId(videoId:Number):void{
  3457. this._videoId = videoId;
  3458. }
  3459. public function get showId():Number{
  3460. return (this._showId);
  3461. }
  3462. public function show(){
  3463. trace(("ImageItem.show: " + this._loadState));
  3464. switch (this._loadState){
  3465. case "none":
  3466. this.createObjects();
  3467. this._loadState = "loading";
  3468. break;
  3469. case "loading":
  3470. break;
  3471. case "loaded":
  3472. this.traceLoadedAnd3rdPartyBeacon();
  3473. break;
  3474. };
  3475. }
  3476. protected function traceLoadedAnd3rdPartyBeacon():void{
  3477. var i:*;
  3478. trace("ImageItem.traceLoadedAnd3rdPartyBeacon");
  3479. var fired:Boolean = this.beaconEventTrace("mastheadload", null);
  3480. this._mastheadclickBeaconDisabled = false;
  3481. if (fired){
  3482. if (this._data["xmlUrl"]){
  3483. for (i in this._data["impressionURLs"]) {
  3484. Utility.callService(Utility.upidReplace(this._data["impressionURLs"][i]));
  3485. };
  3486. };
  3487. };
  3488. }
  3489. protected function createObjects(){
  3490. this._bgClip = new Sprite();
  3491. this._imageContainer = new Sprite();
  3492. this._loadingClip = new LoadingImage();
  3493. this._loadingClip.addEventListener(MouseEvent.MOUSE_DOWN, this.onClick);
  3494. this.layoutLoadingClip();
  3495. addChild(this._bgClip);
  3496. addChild(this._imageContainer);
  3497. addChild(this._loadingClip);
  3498. this.loadImage();
  3499. }
  3500. protected function layoutLoadingClip(){
  3501. }
  3502. public function layoutObjects(){
  3503. this.getRealWidth();
  3504. this.layoutOthers();
  3505. }
  3506. protected function getRealWidth(){
  3507. this.width = this._style.ImageItem.width;
  3508. }
  3509. protected function layoutOthers(){
  3510. }
  3511. protected function attachEvents(){
  3512. this._imageContainer.buttonMode = true;
  3513. this._imageContainer.mouseChildren = false;
  3514. this._imageContainer.addEventListener(MouseEvent.CLICK, this.onClick);
  3515. this._imageContainer.addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
  3516. this._imageContainer.addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
  3517. }
  3518. protected function loadImage(){
  3519. trace(("ImageItem.loadImage " + this._imageUrl));
  3520. this._imageClip = Utility.loadImage(this._imageUrl, this.onImageLoaded, this.ioErrorHandler);
  3521. }
  3522. protected function onImageLoaded(event:Event){
  3523. this.removeLoading();
  3524. }
  3525. protected function removeLoading(){
  3526. this.beaconEventTrace("mastheadload", null);
  3527. this._loadState = "loaded";
  3528. this._imageMask = new Sprite();
  3529. this._imageMask.graphics.beginFill(0, 0);
  3530. this._imageMask.graphics.drawRect(0, 0, this._style.ImageItem.width, this._style.ImageItem.height);
  3531. this._imageMask.graphics.endFill();
  3532. this._imageContainer.addChild(this._imageMask);
  3533. this._imageClip.mask = this._imageMask;
  3534. this._imageContainer.addChild(this._imageClip);
  3535. try {
  3536. this.removeChild(this._loadingClip);
  3537. } catch(e) {
  3538. };
  3539. this._loadingClip = null;
  3540. this.addOthers();
  3541. this.layoutObjects();
  3542. this.attachEvents();
  3543. }
  3544. protected function ioErrorHandler(event:IOErrorEvent){
  3545. }
  3546. protected function addOthers(){
  3547. }
  3548. public function beaconEventTrace(event:String, callback:Function):Boolean{
  3549. if (event == "mastheadload"){
  3550. if (--beaconLoadTraceAllowed < 0){
  3551. return (false);
  3552. };
  3553. } else {
  3554. if (event == "mastheadclick"){
  3555. if (!this._mastheadclickBeaconDisabled){
  3556. this._mastheadclickBeaconDisabled = true;
  3557. } else {
  3558. callback();
  3559. return (false);
  3560. };
  3561. };
  3562. };
  3563. var target:String = escape(this.targetString);
  3564. this.beaconTrace(event, target, callback);
  3565. return (true);
  3566. }
  3567. protected function get targetString():String{
  3568. var tmp:String;
  3569. if (this.linkUrl == null){
  3570. tmp = this._controller.smilHost;
  3571. } else {
  3572. tmp = (((this.linkUrl.indexOf("http://") == 0)) ? this.linkUrl : (this._controller.smilHost + this.linkUrl)).replace(/([^http:])\/\//g, "$1/");
  3573. };
  3574. return (tmp);
  3575. }
  3576. public function beaconMouseClick(url:String, callback:Function){
  3577. var target:String = escape((((url.indexOf("http://") == 0)) ? url : (this._controller.smilHost + url)).replace(/([^http:])\/\//g, "$1/"));
  3578. this.beaconTrace("mastheadclick", target, callback);
  3579. }
  3580. public function beaconTrace(beaconEvent:String, target:String, callback:Function, additionString:String=null, overrideHost:String=null){
  3581. var loader:* = null;
  3582. var url:* = null;
  3583. var request:* = null;
  3584. var beaconEvent:* = beaconEvent;
  3585. var target:* = target;
  3586. var callback:* = callback;
  3587. var additionString = additionString;
  3588. var overrideHost = overrideHost;
  3589. if (Carousel.TYPE != null){
  3590. loader = new URLLoader();
  3591. url = ((((((((overrideHost) || (Utility.getBeaconHost(this._controller.smilHost))) + "/") + beaconEvent) + "?value=") + this._id) + "&") + Utility.getBeaconParams(Carousel.TYPE, target, this._data["mastheadItemId"], this._data["salesforcePlacementTag"]));
  3592. if (additionString != null){
  3593. url = (url + ("&" + additionString));
  3594. };
  3595. request = new URLRequest(url);
  3596. loader.addEventListener(IOErrorEvent.IO_ERROR, function (e){
  3597. trace(e);
  3598. });
  3599. loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (e){
  3600. trace(e);
  3601. });
  3602. if (callback != null){
  3603. loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, callback);
  3604. };
  3605. try {
  3606. loader.load(request);
  3607. } catch(error:Error) {
  3608. trace(error);
  3609. if (callback != null){
  3610. callback();
  3611. };
  3612. };
  3613. } else {
  3614. if (callback != null){
  3615. callback();
  3616. };
  3617. };
  3618. }
  3619. public function beaconAction(params:Object):void{
  3620. var key:* = null;
  3621. var request:* = null;
  3622. var params:* = params;
  3623. var loader:* = new URLLoader();
  3624. var url:* = (((((((Utility.getBeaconHost(this._controller.smilHost) + "/mastheadaction") + "?value=") + this._id) + "&") + Utility.getBeaconParams(Carousel.TYPE, null, this._data["mastheadItemId"], this._data["salesforcePlacementTag"])) + "&mastheadtype=") + ((this._data["swfType"]) || ("default")));
  3625. for (key in params) {
  3626. url = (url + ((("&" + key) + "=") + params[key]));
  3627. };
  3628. request = new URLRequest(url);
  3629. loader.addEventListener(IOErrorEvent.IO_ERROR, function (e){
  3630. });
  3631. loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (e){
  3632. });
  3633. try {
  3634. loader.load(request);
  3635. } catch(error:Error) {
  3636. trace(error);
  3637. };
  3638. }
  3639. public function updateItemData(field:String, val){
  3640. this._data[field] = val;
  3641. }
  3642. public function getItemData(field:String){
  3643. return (this._data[field]);
  3644. }
  3645. public function get linkUrl(){
  3646. return (this._linkUrl);
  3647. }
  3648. public function get jscall(){
  3649. if (this._data.hasOwnProperty("jscall")){
  3650. return (this._data["jscall"]);
  3651. };
  3652. return (null);
  3653. }
  3654. protected function onClick(event:MouseEvent){
  3655. var tmpFun:* = null;
  3656. var clickThroughURLs:* = undefined;
  3657. var event:* = event;
  3658. if (this._data["targetingId"]){
  3659. Utility.saveFSO("MastheadSponsor", "sitelocationOverride", this._data["targetingId"]);
  3660. };
  3661. if (this.jscall != null){
  3662. tmpFun = (("function() {" + this.jscall) + "}");
  3663. ExternalInterface.call(tmpFun);
  3664. };
  3665. if (this._data["clickThroughBeaconURLs"]){
  3666. clickThroughURLs = this._data["clickThroughBeaconURLs"];
  3667. Utility.callServices(clickThroughURLs, function (){
  3668. beaconEventTrace("mastheadclick", function (){
  3669. if (jscall != null){
  3670. } else {
  3671. trace(("goto " + linkUrl));
  3672. navigateToURL(new URLRequest(linkUrl), "_self");
  3673. };
  3674. });
  3675. });
  3676. } else {
  3677. this.beaconEventTrace("mastheadclick", function (){
  3678. if (jscall != null){
  3679. } else {
  3680. trace(("goto " + linkUrl));
  3681. if (linkUrl){
  3682. navigateToURL(new URLRequest(linkUrl), "_self");
  3683. };
  3684. };
  3685. });
  3686. };
  3687. }
  3688. protected function onResize(event:Event){
  3689. this.layoutObjects();
  3690. this._controller.stage.dispatchEvent(new Event("imageResizeFinish"));
  3691. }
  3692. protected function onMouseOver(event:MouseEvent){
  3693. }
  3694. protected function onMouseOut(event:MouseEvent){
  3695. }
  3696. public function get loadState(){
  3697. return (this._loadState);
  3698. }
  3699.  
  3700. }
  3701. }//package com.hulu.masthead.view
  3702. package com.hulu.masthead.view {
  3703. import flash.display.*;
  3704. import flash.events.*;
  3705. import flash.net.*;
  3706. import fl.transitions.*;
  3707. import com.hulu.masthead.model.*;
  3708. import flash.system.*;
  3709. import com.hulu.masthead.utils.*;
  3710. import fl.motion.easing.*;
  3711. import flash.text.*;
  3712. import flash.external.*;
  3713.  
  3714. public class CerebroSalesLogoUnit extends Sprite {
  3715.  
  3716. private var _banner:Sprite;
  3717. private var _currentFrame:Number = -1;
  3718. private var _totalFrame:Number;
  3719. private var _container:HuluImageItem;
  3720. private var _frame:Array;
  3721. private var _ad:Object;
  3722. private var _creative:Object;
  3723. private var _asset:Object;
  3724. private var _isActive:Function;
  3725. private var _updatePosition:Function;
  3726. private var _moveUpLogoUnit:Function;
  3727. private var _auditParameters:TextField;
  3728. private var _auditParameterSeparator:String = "?";
  3729. private var _yStart:Number;
  3730. private var _rotationTimeout:Number = -1;
  3731. private var _primaryAuditHost:String = "t2.hulu.com";
  3732. private var _clickTrackingURL:String = "/v3/adinteraction/click";
  3733. private var _assetImpressionTrackingURL:String = "/v3/revenue/assetimpression";
  3734.  
  3735. public function CerebroSalesLogoUnit(container:HuluImageItem, ad:Object, isActive:Function, updatePosition:Function, moveUpLogoUnit:Function, yStart:Number){
  3736. this._frame = [];
  3737. this._auditParameters = new TextField();
  3738. super();
  3739. this._container = container;
  3740. this._ad = ad;
  3741. this._creative = this._ad["creatives"][0];
  3742. this._asset = this._creative["assets"][0];
  3743. this._isActive = isActive;
  3744. this._yStart = yStart;
  3745. this._updatePosition = updatePosition;
  3746. this._moveUpLogoUnit = moveUpLogoUnit;
  3747. this.loadBanner();
  3748. }
  3749. private static function getCacheBuster():String{
  3750. return (String((new Date().valueOf() + Math.round((Math.random() * 1000)))));
  3751. }
  3752.  
  3753. private function appendAuditParameters(auditParams:Object):void{
  3754. var key:String;
  3755. if (auditParams){
  3756. for (key in auditParams) {
  3757. this.appendSingleAuditParameter(key, auditParams[key]);
  3758. };
  3759. };
  3760. }
  3761. private function appendSingleAuditParameter(key:String, value:String):void{
  3762. this._auditParameters.appendText(this._auditParameterSeparator);
  3763. this._auditParameters.appendText(escape(key));
  3764. this._auditParameters.appendText("=");
  3765. this._auditParameters.appendText(escape(value));
  3766. this._auditParameterSeparator = "&";
  3767. }
  3768. public function get browser():String{
  3769. var detectedBrowser:* = "An unknown browser";
  3770. try {
  3771. detectedBrowser = ExternalInterface.call("eval", "BrowserDetect.browser");
  3772. } catch(e:Error) {
  3773. };
  3774. return (((detectedBrowser) ? detectedBrowser : "An unknown browser"));
  3775. }
  3776. private function loadBanner():void{
  3777. var i:Number;
  3778. this._banner = new Sprite();
  3779. this._banner.mouseChildren = false;
  3780. if (((!((this._asset == null))) && (!((this._asset["format"] == "Tracking Only"))))){
  3781. this._banner.addChild(Utility.loadImage(Utility.upidReplace(this._asset["path"]), this.onImageLoaded, this.ioErrorHandler));
  3782. this.addChild(this._banner);
  3783. this._frame.push(this._banner);
  3784. };
  3785. this.appendSingleAuditParameter("os", Capabilities.os);
  3786. this.appendSingleAuditParameter("flash", Capabilities.version);
  3787. this.appendSingleAuditParameter("pod", "-2");
  3788. this.appendSingleAuditParameter("distro", "hulu");
  3789. this.appendSingleAuditParameter("distroplatform", "hulu");
  3790. this.appendSingleAuditParameter("computerguid", GUID.getComputerGuid());
  3791. this.appendSingleAuditParameter("cb", getCacheBuster());
  3792. this.appendSingleAuditParameter("client", this.browser);
  3793. this.appendSingleAuditParameter("placementId", this._creative["placementId"]);
  3794. this.appendSingleAuditParameter("creativeId", this._creative["creativeId"]);
  3795. this.appendAuditParameters(this._ad["auditParams"]);
  3796. this.appendAuditParameters(this._creative["auditParams"]);
  3797. var impressionURLs:Array = [];
  3798. impressionURLs.push((((("http://" + this._primaryAuditHost) + this._assetImpressionTrackingURL) + this._auditParameters.text) + "&beaconevent=assetimpression"));
  3799. var auditUrls:Array = (this._creative["auditUrls"] as Array);
  3800. if (auditUrls != null){
  3801. i = 0;
  3802. while (i < auditUrls.length) {
  3803. impressionURLs.push(auditUrls[i]["url"]);
  3804. i++;
  3805. };
  3806. };
  3807. var adGroupId:String = this._ad["adGroupId"];
  3808. var metadata:Array = (this._creative["metadata"] as Array);
  3809. if (metadata != null){
  3810. i = 0;
  3811. while (i < metadata.length) {
  3812. if (metadata[i]["key"] == "AdGroupId"){
  3813. adGroupId = metadata[i]["value"];
  3814. } else {
  3815. if (metadata[i]["key"] == "WatchNowOverride"){
  3816. this._container.updateItemData("watchNowOverride", metadata[i]["value"]);
  3817. };
  3818. };
  3819. i++;
  3820. };
  3821. };
  3822. this._container.updateItemData("salesforcePlacementTag", this._creative["placementId"]);
  3823. this._container.updateItemData("adGroupId", adGroupId);
  3824. this._container.updateItemData("impressionURLs", impressionURLs);
  3825. var clickUrl:String = this._creative["clickUrl"];
  3826. if (((!((clickUrl == null))) && ((clickUrl.length > 0)))){
  3827. this.addEventListener(MouseEvent.CLICK, this._container.onSponsorLogoClicked);
  3828. this.buttonMode = true;
  3829. this._container.updateItemData("sponsorLogoClickTracker", (((("http://" + this._primaryAuditHost) + this._clickTrackingURL) + this._auditParameters.text) + "&beaconevent=click&type=Banner"));
  3830. this._container.updateItemData("sponsorTargetURL", clickUrl);
  3831. if ((this._moveUpLogoUnit is Function)){
  3832. this._moveUpLogoUnit();
  3833. };
  3834. } else {
  3835. this._container.updateItemData("sponsorTargetURL", null);
  3836. };
  3837. i = 0;
  3838. while (i < impressionURLs.length) {
  3839. Utility.callService(Utility.upidReplace(impressionURLs[i]));
  3840. i++;
  3841. };
  3842. }
  3843. private function onImageLoaded(e){
  3844. if (this.width <= 234){
  3845. this.x = ((234 - this.width) / 2);
  3846. } else {
  3847. this.x = (234 - this.width);
  3848. };
  3849. }
  3850. private function ioErrorHandler(e){
  3851. trace(e);
  3852. }
  3853.  
  3854. }
  3855. }//package com.hulu.masthead.view
  3856. package com.hulu.masthead.view {
  3857. import flash.display.*;
  3858. import flash.events.*;
  3859. import fl.transitions.*;
  3860. import fl.motion.easing.*;
  3861. import fl.transitions.easing.*;
  3862.  
  3863. public class MediumButton extends MovieClip {
  3864.  
  3865. public var _hover:MovieClip;
  3866. private var _callbacks:Function;
  3867. private var _tween:Tween;
  3868.  
  3869. public function MediumButton(){
  3870. super();
  3871. this._hover.alpha = 0;
  3872. buttonMode = true;
  3873. this.addEventListener(MouseEvent.MOUSE_DOWN, this.onClicked);
  3874. this.addEventListener(MouseEvent.MOUSE_OVER, this.onOver);
  3875. this.addEventListener(MouseEvent.MOUSE_OUT, this.onOut);
  3876. }
  3877. public function set onClick(call:Function){
  3878. this._callbacks = call;
  3879. }
  3880. public function onClicked(e){
  3881. if ((this._callbacks is Function)){
  3882. this._callbacks();
  3883. };
  3884. }
  3885. public function onOver(event:MouseEvent){
  3886. if (this._tween){
  3887. this._tween.fforward();
  3888. };
  3889. this._tween = new Tween(this._hover, "alpha", Strong.easeOut, this._hover.alpha, 1, 12);
  3890. }
  3891. public function onOut(event:MouseEvent){
  3892. if (this._tween){
  3893. this._tween.fforward();
  3894. };
  3895. this._tween = new Tween(this._hover, "alpha", Strong.easeOut, this._hover.alpha, 0, 12);
  3896. }
  3897. public function fadeIn(isGradully:Boolean){
  3898. if (isGradully){
  3899. new Tween(this, "alpha", Quartic.easeOut, alpha, 1, 12);
  3900. } else {
  3901. this.alpha = 1;
  3902. };
  3903. }
  3904.  
  3905. }
  3906. }//package com.hulu.masthead.view
  3907. package com.hulu.masthead.view {
  3908. import flash.display.*;
  3909. import flash.events.*;
  3910. import flash.net.*;
  3911. import fl.transitions.*;
  3912. import flash.utils.*;
  3913. import com.hulu.masthead.utils.*;
  3914. import fl.motion.easing.*;
  3915. import com.hulu.masthead.controller.*;
  3916. import flash.text.*;
  3917. import flash.external.*;
  3918. import flash.geom.*;
  3919. import flash.filters.*;
  3920.  
  3921. public class HuluImageItem extends ImageItem {
  3922.  
  3923. private var _detailsOverlay:DetailsOverlay;
  3924. private var _customQuickPlayButton:Boolean = false;
  3925. private var _quickPlayButton:QuickPlayButton;
  3926. private var _quickPlayer:AS3QuickPlayer;
  3927. private var _quickPlayerContainer:Sprite = null;
  3928. private var _movieShowTimeButton:MovieShowTimeButton;
  3929. private var _movieShowTimeContainer:MovieShowTimeContainer;
  3930. private var _movieShowTimeImpressionBeaconFired:Boolean = false;
  3931. private var _moreLink:MoreLink;
  3932. private var _moreBoardMask:Sprite;
  3933. private var _moreBoard:MoreBoard;
  3934. private var _fadeInTween:Tween;
  3935. private var _fadeOutTween:Tween;
  3936. private var _detailsTimer:Timer;
  3937. private var _realWidth:Number;
  3938. private var _eid:String;
  3939. private var _quickplaySpecialBeaconURL:String = "";
  3940. private var _swfKeyArt:Boolean;
  3941. private var _swfType:String;
  3942. private var _imageLoaded:Boolean = false;
  3943. private var _adXMLLoaded:Boolean = false;
  3944. public var detatailsOverLayClickableLayer:Sprite;
  3945. private var _copyrightTf:TextField;
  3946. private var _quickPlaying:Boolean = false;
  3947.  
  3948. public function HuluImageItem(controller:Object, data:Object, id:Number){
  3949. super(controller, data, id);
  3950. this._swfKeyArt = false;
  3951. if (((_imageUrl) && ((_imageUrl.indexOf(".swf") > 0)))){
  3952. this._swfKeyArt = true;
  3953. this._swfType = data["swfType"];
  3954. if ((((this._swfType == "AnimatedSwf")) && ((_imageUrl.indexOf("hulu_marquis.swf") == -1)))){
  3955. this._swfKeyArt = false;
  3956. };
  3957. };
  3958. _controller.stage.addEventListener("stageResize", onResize);
  3959. if (!_data["xmlUrl"]){
  3960. this._adXMLLoaded = true;
  3961. };
  3962. }
  3963. public function get quickPlayerContainer():Sprite{
  3964. return (this._quickPlayerContainer);
  3965. }
  3966. public function get movieShowtimeContainer():Sprite{
  3967. return (this._movieShowTimeButton);
  3968. }
  3969. override protected function attachEvents(){
  3970. if (!this._swfKeyArt){
  3971. super.attachEvents();
  3972. if (this._swfType == "AnimatedSwf"){
  3973. _imageContainer.mouseChildren = true;
  3974. };
  3975. } else {
  3976. buttonMode = false;
  3977. _imageContainer.mouseChildren = true;
  3978. _imageContainer.addEventListener(MouseEvent.MOUSE_DOWN, function (){
  3979. root.dispatchEvent(new Event("stopAutoScroll"));
  3980. });
  3981. if ((((((this._swfType == "VideoRecommendation")) || ((this._swfType == "ShowRecommendation")))) || ((this._swfType == "HollywoodHeadlines")))){
  3982. _imageContainer.addEventListener(MouseEvent.MOUSE_OVER, function (){
  3983. root.dispatchEvent(new Event("stopAutoScroll"));
  3984. });
  3985. };
  3986. };
  3987. addEventListener("imageAnimationStop", function (e){
  3988. removePlayer();
  3989. tweenFforward();
  3990. });
  3991. }
  3992. override protected function getRealWidth(){
  3993. var alp:Number;
  3994. if (width){
  3995. this._realWidth = Math.max(_style.ImageItem.width, (_controller.stageWidth - (_style.Carousel.leftMargin * 2)));
  3996. if (((!(_data["backgroundUrl"])) || (_data["backgroundColor"]))){
  3997. alp = ((_data["backgroundColor"]) ? 1 : 0);
  3998. if (_loadState != "loaded"){
  3999. alp = 0;
  4000. };
  4001. _bgClip.graphics.clear();
  4002. _bgClip.graphics.beginFill(((_data["backgroundColor"]) || (0)), alp);
  4003. _bgClip.graphics.drawRect(0, 0, this._realWidth, _style.ImageItem.height);
  4004. _bgClip.graphics.endFill();
  4005. _bgClip.width = this._realWidth;
  4006. _bgClip.height = _style.ImageItem.height;
  4007. } else {
  4008. if (_bgLoader){
  4009. _bgClip.graphics.clear();
  4010. _bgLoader.width = this._realWidth;
  4011. _bgLoader.height = _style.ImageItem.height;
  4012. };
  4013. };
  4014. };
  4015. }
  4016. override protected function addOthers(){
  4017. var format:TextFormat;
  4018. var filter:DropShadowFilter;
  4019. if (this._swfType != "AnimatedSwf"){
  4020. if (_data["embed"]){
  4021. this._quickPlayButton.visible = true;
  4022. };
  4023. if (this._detailsOverlay){
  4024. this.setDetailsOverlay();
  4025. };
  4026. if (_data["showtime_movie_ids"]){
  4027. this._movieShowTimeButton.visible = true;
  4028. this.fireShowtimeImpressionBeacon();
  4029. };
  4030. } else {
  4031. if (((((((((this._detailsOverlay) && (this._detailsOverlay.sponsorLogo))) && (_data["linkUrl"]))) && (this.linkUrl))) && (!((this.linkUrl.indexOf("/plus") == -1))))){
  4032. _imageContainer.addChild(this._detailsOverlay.sponsorLogo);
  4033. if (this._detailsOverlay.sponsorLogo.width <= _style.DetailsOverlay.borderWidth){
  4034. this._detailsOverlay.sponsorLogo.x = ((_style.ImageItem.width - _style.DetailsOverlay.borderWidth) - 10);
  4035. } else {
  4036. this._detailsOverlay.sponsorLogo.x = ((_style.ImageItem.width - this._detailsOverlay.sponsorLogo.width) - 10);
  4037. };
  4038. this._detailsOverlay.sponsorLogo.y = ((this.height - _style.DetailsOverlay.salesLogoHeight) - 10);
  4039. };
  4040. };
  4041. if (_data["copyrightInfo"]){
  4042. format = new TextFormat();
  4043. format.font = "Helvetica Neue LT Pro 55 Roman";
  4044. format.size = 8;
  4045. format.color = 0xFFFFFF;
  4046. format.align = TextFormatAlign.RIGHT;
  4047. this._copyrightTf = new TextField();
  4048. this._copyrightTf.antiAliasType = AntiAliasType.ADVANCED;
  4049. this._copyrightTf.defaultTextFormat = format;
  4050. this._copyrightTf.alpha = 0.7;
  4051. this._copyrightTf.embedFonts = true;
  4052. this._copyrightTf.mouseEnabled = false;
  4053. this._copyrightTf.rotation = 90;
  4054. this._copyrightTf.text = _data["copyrightInfo"];
  4055. _imageContainer.addChild(this._copyrightTf);
  4056. this._copyrightTf.width = (_style.ImageItem.height - 6);
  4057. this._copyrightTf.x = _style.ImageItem.width;
  4058. this._copyrightTf.y = 2;
  4059. filter = new DropShadowFilter(1, 90, 0, 1, 3, 3, 0.9, BitmapFilterQuality.HIGH, false, false);
  4060. this._copyrightTf.filters = [filter];
  4061. };
  4062. this.addBackground();
  4063. }
  4064. override protected function createObjects(){
  4065. _bgClip = new Sprite();
  4066. _imageContainer = new Sprite();
  4067. _loadingClip = new LoadingImage();
  4068. _loadingClip.addEventListener(MouseEvent.MOUSE_DOWN, this.onClick);
  4069. if (_data["embed"]){
  4070. this._eid = _data["embed"];
  4071. if (this._eid.indexOf(",") > 0){
  4072. this._quickplaySpecialBeaconURL = this._eid.substr((this._eid.indexOf(",") + 1));
  4073. this._eid = this._eid.substr(0, this._eid.indexOf(","));
  4074. };
  4075. this._quickPlayButton = new QuickPlayButton([this.showQuickPlayer, this.hideQuickPlayer]);
  4076. this._quickPlayButton.y = _style.ImageItem.height;
  4077. this._quickPlayButton.visible = false;
  4078. this._quickPlayButton.buttonMode = true;
  4079. this._quickPlayerContainer = new Sprite();
  4080. this._quickPlayerContainer.y = this._quickPlayButton.y;
  4081. this._quickPlayerContainer.visible = false;
  4082. };
  4083. if (_data["showtime_movie_ids"]){
  4084. this._movieShowTimeButton = new MovieShowTimeButton();
  4085. this._movieShowTimeButton.y = _style.ImageItem.height;
  4086. this._movieShowTimeButton.x = 6;
  4087. this._movieShowTimeButton.visible = false;
  4088. };
  4089. this.layoutLoadingClip();
  4090. addChild(_bgClip);
  4091. addChild(_imageContainer);
  4092. if (!this._swfKeyArt){
  4093. this.detatailsOverLayClickableLayer = new Sprite();
  4094. this.detatailsOverLayClickableLayer.visible = false;
  4095. this._detailsOverlay = new DetailsOverlay(_style, this, _data["title"], _data["description"], _data["logoUrl"], _data["promotionBannerUrl"], _data["xmlUrl"], _data["ad"]);
  4096. this._detailsOverlay.alpha = 0;
  4097. this.detatailsOverLayClickableLayer.alpha = 0;
  4098. this._detailsOverlay.showCallback = this.showDetails;
  4099. if (_data["moreDescription"]){
  4100. this._moreLink = new MoreLink();
  4101. this._moreBoard = new MoreBoard(_style, _data["moreDescription"], _data["moreLogoURL"]);
  4102. this._moreBoardMask = new Sprite();
  4103. this._moreBoardMask.graphics.beginFill(0, 0);
  4104. this._moreBoardMask.graphics.drawRect(0, 0, 2, 2);
  4105. this._moreBoardMask.graphics.endFill();
  4106. this._moreBoardMask.width = this._moreBoard.width;
  4107. this._moreBoardMask.height = _style.ImageItem.height;
  4108. this._moreBoard.mask = this._moreBoardMask;
  4109. this._moreLink.onClick = function (){
  4110. root.dispatchEvent(new Event("stopAutoScroll"));
  4111. _moreBoard.defaultY = 0;
  4112. _moreBoard.slideOut(false);
  4113. _moreBoard.visible = true;
  4114. _moreBoard.slideIn(true);
  4115. };
  4116. this.addChild(this._moreLink);
  4117. this.addChild(this._moreBoard);
  4118. this.addChild(this._moreBoardMask);
  4119. this._moreLink.alpha = 0;
  4120. this._moreLink.visible = true;
  4121. this._moreBoard.visible = false;
  4122. };
  4123. if (this.detatailsOverLayClickableLayer){
  4124. this.addChild(this.detatailsOverLayClickableLayer);
  4125. };
  4126. };
  4127. if (_data["embed"]){
  4128. addChild(this._quickPlayerContainer);
  4129. addChild(this._quickPlayButton);
  4130. };
  4131. if (_data["showtime_movie_ids"]){
  4132. addChild(this._movieShowTimeButton);
  4133. this._movieShowTimeButton.addEventListener(MouseEvent.CLICK, this.showMovieShowTime);
  4134. };
  4135. addChild(_loadingClip);
  4136. loadImage();
  4137. }
  4138. override protected function onImageLoaded(event:Event){
  4139. var event:* = event;
  4140. trace(("HuluImageItem.onImageLoaded: " + [_imageUrl, this._swfType, this._swfKeyArt]));
  4141. if (this._swfKeyArt){
  4142. try {
  4143. _imageClip.content["quickPlay"] = this.quickPlay;
  4144. } catch(e) {
  4145. };
  4146. try {
  4147. _imageClip.content["beaconMouseClick"] = this.beaconMouseClick;
  4148. } catch(e) {
  4149. };
  4150. try {
  4151. _imageClip.content["onSponsorLogoClicked"] = this.onSponsorLogoClicked;
  4152. } catch(e) {
  4153. };
  4154. try {
  4155. _imageClip.content["updateItemData"] = this.updateItemData;
  4156. } catch(e) {
  4157. };
  4158. try {
  4159. _imageClip.content["onADDataReady"] = this.onADDataReady;
  4160. } catch(e) {
  4161. _adXMLLoaded = true;
  4162. };
  4163. try {
  4164. var _local3 = _imageClip.content;
  4165. _local3["setDataFromMasthead"](this._data);
  4166. } catch(e) {
  4167. };
  4168. try {
  4169. _imageClip.content["beaconAction"] = this.beaconAction;
  4170. } catch(e) {
  4171. };
  4172. try {
  4173. _imageClip.content["AnimationSwfCallback"] = this.onAnimationSwfCallback;
  4174. } catch(e) {
  4175. trace("error");
  4176. };
  4177. };
  4178. if (this._swfType == "AnimatedSwf"){
  4179. try {
  4180. _imageClip.content["AnimationSwfCallback"] = this.onAnimationSwfCallback;
  4181. } catch(e) {
  4182. trace("error");
  4183. };
  4184. try {
  4185. _imageClip.content["Callback"] = this.onSwfCallback;
  4186. } catch(e) {
  4187. trace("error");
  4188. };
  4189. try {
  4190. _imageClip.content["onADDataReady"] = this.onADDataReady;
  4191. } catch(e) {
  4192. _adXMLLoaded = true;
  4193. };
  4194. if (!this._swfKeyArt){
  4195. try {
  4196. _local3 = _imageClip.content;
  4197. _local3["setDataFromMasthead"](this._data);
  4198. } catch(e) {
  4199. };
  4200. };
  4201. };
  4202. this._imageLoaded = true;
  4203. this.onImageOrAdXMLLoaded();
  4204. }
  4205. private function onAnimationSwfCallback(options:Object){
  4206. var _local2:Object;
  4207. var _local3:String;
  4208. var _local4:String;
  4209. var _local5:String;
  4210. var _local6:String;
  4211. var _local7:String;
  4212. if (options == null){
  4213. return;
  4214. };
  4215. trace("HuluImageItem.onAnimationSwfCallback");
  4216. trace(options["command"]);
  4217. switch (options["command"]){
  4218. case "animation_end":
  4219. _local2 = {
  4220. showQuickPlay:false,
  4221. showMovieShowTime:false,
  4222. showDetailOverlay:false,
  4223. showAdLogo:true,
  4224. mouseChildren:false
  4225. };
  4226. _local2.showQuickPlay = (options["showQuickPlay"] == true);
  4227. _local2.showMovieShowTime = (options["showMovieShowTime"] == true);
  4228. _local2.showDetailOverlay = (options["showDetailOverlay"] == true);
  4229. _local2.mouseChildren = (options["mouseChildren"] == true);
  4230. _local2.showAdLogo = !((options["showAdLogo"] == false));
  4231. this.onSwfCallback(_local2);
  4232. break;
  4233. case "quickplay":
  4234. this._quickPlayButton.onClick(null);
  4235. break;
  4236. case "movie_show_time":
  4237. this.createMovieShowTime(options["movieId"]);
  4238. break;
  4239. case "open_new_window":
  4240. _local3 = options["url"];
  4241. navigateToURL(new URLRequest(_local3), "_blank");
  4242. break;
  4243. case "track_beacon":
  4244. _local4 = ((options["beacontype"]) || ("mastheadclick"));
  4245. _local5 = options["additionString"];
  4246. _local6 = escape(targetString);
  4247. _local7 = options["overrideHost"];
  4248. beaconTrace(_local4, _local6, null, _local5, _local7);
  4249. break;
  4250. case "goto_watch_page":
  4251. if (this.linkUrl){
  4252. navigateToURL(new URLRequest(this.linkUrl), "_self");
  4253. };
  4254. break;
  4255. case "track_click_ad_logo":
  4256. this.handleSponsorLogoClick();
  4257. break;
  4258. };
  4259. }
  4260. private function onSwfCallback(options:Object=null):void{
  4261. var showQuickPlay:Boolean = (((options == null)) || (!((options["showQuickPlay"] == false))));
  4262. var showMovieShowTime:Boolean = (((options == null)) || (!((options["showMovieShowTime"] == false))));
  4263. var showDetailOverlay:Boolean = (((options == null)) || (!((options["showDetailOverlay"] == false))));
  4264. var mouseChildren:Boolean = (((options == null)) || (!((options["mouseChildren"] == false))));
  4265. var showAdLogo:Boolean = (((options == null)) || (!((options["showAdLogo"] == false))));
  4266. if (((_data["embed"]) && (showQuickPlay))){
  4267. this._quickPlayButton.visible = true;
  4268. };
  4269. if (((_data["showtime_movie_ids"]) && (showMovieShowTime))){
  4270. this._movieShowTimeButton.visible = true;
  4271. this.fireShowtimeImpressionBeacon();
  4272. };
  4273. if (((this._detailsOverlay) && (showDetailOverlay))){
  4274. this.setDetailsOverlay();
  4275. };
  4276. if (!showAdLogo){
  4277. this._detailsOverlay.sponsorLogo.visible = false;
  4278. };
  4279. if (mouseChildren){
  4280. _imageContainer.removeEventListener(MouseEvent.CLICK, this.onClick);
  4281. _imageContainer.removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
  4282. _imageContainer.removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
  4283. _imageContainer.buttonMode = false;
  4284. };
  4285. _imageContainer.mouseChildren = mouseChildren;
  4286. layoutObjects();
  4287. }
  4288. public function onADDataReady():void{
  4289. this._adXMLLoaded = true;
  4290. this.onImageOrAdXMLLoaded();
  4291. }
  4292. private function onImageOrAdXMLLoaded():void{
  4293. if (((this._imageLoaded) && (this._adXMLLoaded))){
  4294. removeLoading();
  4295. };
  4296. }
  4297. override protected function layoutOthers(){
  4298. if (_imageContainer){
  4299. _imageContainer.x = ((this._realWidth - _style.ImageItem.width) / 2);
  4300. };
  4301. if (_loadingClip){
  4302. this.layoutLoadingClip();
  4303. };
  4304. if (this._quickPlayButton){
  4305. this._quickPlayButton.x = (6 + (((_controller.stageWidth - (_style.Carousel.leftMargin * 2)) - _style.ImageItem.width) / 2));
  4306. };
  4307. if (this._movieShowTimeButton){
  4308. this._movieShowTimeButton.x = (6 + (((_controller.stageWidth - (_style.Carousel.leftMargin * 2)) - _style.ImageItem.width) / 2));
  4309. if (this._quickPlayButton){
  4310. this._quickPlayButton.x = (this._movieShowTimeButton.x + 151);
  4311. };
  4312. };
  4313. if (this._quickPlayerContainer){
  4314. this._quickPlayerContainer.x = (((_controller.stageWidth - (_style.Carousel.leftMargin * 2)) - _style.ImageItem.width) / 2);
  4315. };
  4316. if (this._moreLink){
  4317. this._moreBoardMask.x = (this._moreBoard.x = (this._moreLink.x = (this._detailsOverlay.x + _imageContainer.x)));
  4318. this._moreLink.y = ((this._detailsOverlay.y + _style.ImageItem.height) - this._moreLink.height);
  4319. };
  4320. if (this.detatailsOverLayClickableLayer){
  4321. this.detatailsOverLayClickableLayer.x = (this._detailsOverlay.x + _imageContainer.x);
  4322. this.detatailsOverLayClickableLayer.visible = true;
  4323. };
  4324. if (this._movieShowTimeContainer){
  4325. this.layoutMovieShowTime();
  4326. };
  4327. }
  4328. override protected function layoutLoadingClip(){
  4329. _loadingClip.clickArea.x = (-(_controller.stageWidth) / 2);
  4330. _loadingClip.clickArea.y = (-(_style.Carousel.height) / 2);
  4331. _loadingClip.clickArea.width = (_controller.stageWidth - (_style.Carousel.leftMargin * 2));
  4332. _loadingClip.clickArea.height = _style.ImageItem.height;
  4333. _loadingClip.x = (_controller.stageWidth / 2);
  4334. _loadingClip.y = (_style.Carousel.height / 2);
  4335. }
  4336. public function onSponsorLogoClicked(event:MouseEvent=null){
  4337. this.handleSponsorLogoClick();
  4338. }
  4339. private function handleSponsorLogoClick():void{
  4340. var request:URLRequest;
  4341. trace("handleSponsorLogoClick");
  4342. trace(_data["sponsorTargetURL"]);
  4343. root.dispatchEvent(new Event("stopAutoScroll"));
  4344. beaconTrace("mastheadsponsorclick", escape(_data["sponsorTargetURL"]), null);
  4345. if (_data["sponsorLogoClickTracker"] != null){
  4346. Utility.callService(Utility.upidReplace(_data["sponsorLogoClickTracker"]));
  4347. };
  4348. var url:String = _data["sponsorTargetURL"];
  4349. if (url.indexOf("hulu.com/plus") != -1){
  4350. request = new URLRequest(url);
  4351. navigateToURL(request, "_self");
  4352. } else {
  4353. if (ExternalInterface.available){
  4354. ExternalInterface.call("showLink", _data["sponsorTargetURL"]);
  4355. };
  4356. };
  4357. }
  4358. private function addQuickPlayer(){
  4359. var url:* = null;
  4360. url = ((_data["watchPageURL"]) || (this.linkUrl));
  4361. var watchInHiResCall:* = function ():void{
  4362. beaconEventTrace("mastheadclick", function (){
  4363. var tmpFun:String;
  4364. if (((!((url == null))) && (!((url == ""))))){
  4365. navigateToURL(new URLRequest(url), "_self");
  4366. } else {
  4367. if (((!((jscall == null))) && (!((jscall == ""))))){
  4368. tmpFun = (("function() {" + jscall) + "}");
  4369. ExternalInterface.call(tmpFun);
  4370. };
  4371. };
  4372. });
  4373. };
  4374. if (((((this.linkUrl) && ((this.linkUrl.indexOf("watch/") < 0)))) || (("null" == _data["watchPageURL"])))){
  4375. watchInHiResCall = null;
  4376. };
  4377. this._quickPlayer = AS3QuickPlayer.getInstance(_style, _controller.stageWidth, watchInHiResCall, this._eid, this._quickPlayerContainer);
  4378. this._quickPlayer.addEventListener("closeQuickPlayer", function (e){
  4379. if (_quickPlayButton){
  4380. _quickPlayButton.reset();
  4381. };
  4382. });
  4383. this._quickPlayerContainer.addChild(this._quickPlayer);
  4384. this._quickPlayer.y = -(this._quickPlayerContainer.y);
  4385. this._quickPlayerContainer.visible = true;
  4386. }
  4387. private function showMovieShowTime(e:Event):void{
  4388. if (this._quickPlaying){
  4389. this.hideQuickPlayer();
  4390. this._quickPlayButton.reset();
  4391. setTimeout(this.createMovieShowTime, (10000 / stage.frameRate));
  4392. } else {
  4393. this.createMovieShowTime();
  4394. };
  4395. }
  4396. private function createMovieShowTime(movieId:String=null):void{
  4397. if (!this._movieShowTimeContainer){
  4398. this._movieShowTimeContainer = new MovieShowTimeContainer(this.fireShowtimeSearchBeacon, this.fireShowtimeTicketBeacon, _controller);
  4399. this._movieShowTimeContainer.data = ((((_data["showtime_movie_ids"]) || (movieId))) || (""));
  4400. addChild(this._movieShowTimeContainer);
  4401. this.layoutMovieShowTime();
  4402. } else {
  4403. if (movieId != null){
  4404. this._movieShowTimeContainer.data = movieId;
  4405. this._movieShowTimeContainer.showMST();
  4406. } else {
  4407. this._movieShowTimeContainer.showMST();
  4408. };
  4409. this.layoutMovieShowTime();
  4410. };
  4411. (_controller as HuluCarousel).stopAnimation();
  4412. }
  4413. private function layoutMovieShowTime():void{
  4414. this._movieShowTimeContainer.x = (((_controller.stageWidth - (_style.Carousel.leftMargin * 2)) - _style.ImageItem.width) / 2);
  4415. this._movieShowTimeContainer.y = 0;
  4416. }
  4417. private function hideQuickPlayer(){
  4418. if (this._quickPlayer){
  4419. this._quickPlaying = false;
  4420. this._quickPlayer.hide(false);
  4421. this._quickPlayer.soundTransform.volume = 0;
  4422. };
  4423. }
  4424. private function showQuickPlayer(){
  4425. beaconEventTrace("quickplay", null);
  4426. this.fireQuickplaySpecialBeacon();
  4427. if (stage.frameRate != 15){
  4428. stage.frameRate = 15;
  4429. };
  4430. var hasLoaded:* = AS3QuickPlayer.hasInstance;
  4431. if (((!(this._quickPlayer)) || (!(this._quickPlayerContainer.contains(this._quickPlayer))))){
  4432. this.addQuickPlayer();
  4433. };
  4434. if (hasLoaded){
  4435. this._quickPlayer.show(false);
  4436. this._quickPlayer.soundTransform.volume = 1;
  4437. };
  4438. this._quickPlaying = true;
  4439. }
  4440. private function fireQuickplaySpecialBeacon(){
  4441. if (this._quickplaySpecialBeaconURL.length < 1){
  4442. return;
  4443. };
  4444. var sponsorTrackID:String = ((new Date().getTime() + "") + Math.random());
  4445. Utility.callService((this._quickplaySpecialBeaconURL + sponsorTrackID));
  4446. }
  4447. private function fireShowtimeImpressionBeacon():void{
  4448. if (this._movieShowTimeImpressionBeaconFired){
  4449. return;
  4450. };
  4451. this._movieShowTimeImpressionBeaconFired = true;
  4452. var req:String = ((((Utility.getBeaconHost(_controller.smilHost) + "/showtimeimpression?computerguid=") + GUID.getComputerGuid()) + "&cb=") + Math.random());
  4453. req = (req + ("&eid=" + this.eid));
  4454. Utility.callService(req);
  4455. }
  4456. private function fireShowtimeSearchBeacon(movieID:String, zipcode:String=""):void{
  4457. var req:String = ((((Utility.getBeaconHost(_controller.smilHost) + "/showtimesearch?computerguid=") + GUID.getComputerGuid()) + "&cb=") + Math.random());
  4458. req = (req + ("&eid=" + this.eid));
  4459. req = (req + ("&movie_id=" + movieID));
  4460. if (zipcode){
  4461. req = (req + ("&zipcode=" + zipcode));
  4462. };
  4463. Utility.callService(req);
  4464. }
  4465. private function fireShowtimeTicketBeacon(movieID:String, theaterID:String, anchor:String):void{
  4466. var req:String = ((((Utility.getBeaconHost(_controller.smilHost) + "/showtimeticket?computerguid=") + GUID.getComputerGuid()) + "&cb=") + Math.random());
  4467. req = (req + ("&eid=" + this.eid));
  4468. req = (req + ((((("&movie_id=" + movieID) + "&theater_id=") + theaterID) + "&anchor=") + anchor));
  4469. Utility.callService(req);
  4470. }
  4471. public function quickPlay(embedded_id:String, watchPageURL:String){
  4472. var embedded_id:* = embedded_id;
  4473. var watchPageURL:* = watchPageURL;
  4474. this._eid = embedded_id;
  4475. trace(this._eid);
  4476. if (!this._quickPlayerContainer){
  4477. this._quickPlayerContainer = new Sprite();
  4478. addChild(this._quickPlayerContainer);
  4479. this._quickPlayerContainer.y = _style.ImageItem.height;
  4480. this._quickPlayerContainer.visible = false;
  4481. this._quickPlayerContainer.x = (((_controller.stageWidth - (_style.Carousel.leftMargin * 2)) - _style.ImageItem.width) / 2);
  4482. };
  4483. if (!this._quickPlayer){
  4484. this.addQuickPlayer();
  4485. };
  4486. var watchInHiResCall:* = function (){
  4487. beaconEventTrace("mastheadclick", function (){
  4488. navigateToURL(new URLRequest(watchPageURL), "_self");
  4489. });
  4490. };
  4491. this._quickPlayer.update(watchInHiResCall, this._eid, this._quickPlayerContainer);
  4492. this.showQuickPlayer();
  4493. }
  4494. override protected function onClick(event:MouseEvent){
  4495. if (((((this._detailsOverlay) && (this._detailsOverlay.sponsorLogo))) && ((((this._detailsOverlay.sponsorLogo == event.target)) || (this._detailsOverlay.sponsorLogo.contains((event.target as DisplayObject))))))){
  4496. return;
  4497. };
  4498. if (this.brandGroupId != null){
  4499. ExternalInterface.call("setOneShotBrandVar", this.brandGroupId);
  4500. };
  4501. super.onClick(event);
  4502. }
  4503. override protected function onMouseOver(event:MouseEvent){
  4504. if (this._detailsOverlay){
  4505. this._detailsOverlay.turnLight();
  4506. };
  4507. }
  4508. override protected function onMouseOut(event:MouseEvent){
  4509. if (this._detailsOverlay){
  4510. this._detailsOverlay.turnDark();
  4511. };
  4512. }
  4513. private function setDetailsOverlay(){
  4514. this._detailsTimer = new Timer(270, 1);
  4515. this._detailsTimer.addEventListener("timer", function (e:Event){
  4516. _detailsOverlay.fadeIn(true);
  4517. if (_moreLink){
  4518. _moreLink.fadeIn(true);
  4519. };
  4520. });
  4521. if (this.visible){
  4522. this.showDetails(null);
  4523. };
  4524. _imageContainer.addChild(this._detailsOverlay);
  4525. this._detailsOverlay.x = ((_style.ImageItem.width - _style.DetailsOverlay.rightMargin) - _style.DetailsOverlay.borderWidth);
  4526. }
  4527. private function addBackground(){
  4528. if (_data["backgroundUrl"]){
  4529. _bgLoader = new Loader();
  4530. _bgLoader = Utility.loadImage(_data["backgroundUrl"], function (e){
  4531. addChildAt(_bgLoader, 1);
  4532. getRealWidth();
  4533. }, null);
  4534. };
  4535. }
  4536. public function fadeOut(isGradually:Boolean){
  4537. var isGradually:* = isGradually;
  4538. if (this._detailsOverlay){
  4539. this._detailsOverlay.deactive();
  4540. };
  4541. if (!isGradually){
  4542. this.alpha = 0.4;
  4543. } else {
  4544. this._fadeOutTween = new Tween(this, "alpha", Linear.easeOut, this.alpha, 0.4, 28);
  4545. };
  4546. if (this._swfKeyArt){
  4547. try {
  4548. var _local3 = _imageClip.content;
  4549. _local3["onFadeOut"]();
  4550. } catch(e:Error) {
  4551. };
  4552. };
  4553. }
  4554. public function fadeIn(isGradually:Boolean){
  4555. this.tweenFforward();
  4556. if (this._detailsOverlay){
  4557. this._detailsOverlay.alpha = 0;
  4558. if (this._moreLink){
  4559. this._moreLink.alpha = 0;
  4560. };
  4561. if (this._moreBoard){
  4562. this._moreBoard.visible = false;
  4563. };
  4564. };
  4565. if (this.detatailsOverLayClickableLayer){
  4566. this.detatailsOverLayClickableLayer.alpha = 0;
  4567. };
  4568. if (!isGradually){
  4569. this._detailsOverlay.fadeIn(false);
  4570. if (this._moreLink){
  4571. this._moreLink.fadeIn(false);
  4572. };
  4573. this.alpha = 1;
  4574. } else {
  4575. this._fadeInTween = new Tween(this, "alpha", Linear.easeOut, alpha, 1, 28);
  4576. this._fadeInTween.addEventListener(TweenEvent.MOTION_FINISH, this.showDetails);
  4577. };
  4578. }
  4579. private function showDetails(event:TweenEvent){
  4580. if (((!(this._detailsOverlay)) || (!(this._detailsOverlay.visible)))){
  4581. return;
  4582. };
  4583. if (((((!(_style)) || (!(_style.Carousel)))) || (!(_style.Carousel.leftMargin)))){
  4584. return;
  4585. };
  4586. if (!this._detailsTimer){
  4587. return;
  4588. };
  4589. if ((((this._fadeInTween == null)) || (!(this._fadeInTween.isPlaying)))){
  4590. this._detailsTimer.reset();
  4591. this._detailsTimer.start();
  4592. };
  4593. }
  4594. private function tweenFforward(){
  4595. if (((this._fadeInTween) && (this._fadeInTween.isPlaying))){
  4596. this._fadeInTween.removeEventListener(TweenEvent.MOTION_FINISH, this.showDetails);
  4597. this._fadeInTween.fforward();
  4598. };
  4599. if (((this._fadeOutTween) && (this._fadeOutTween.isPlaying))){
  4600. this._fadeOutTween.fforward();
  4601. };
  4602. if (this._detailsTimer){
  4603. this._detailsTimer.reset();
  4604. };
  4605. if (((((this._detailsOverlay) && (this._detailsOverlay._fadeInTween))) && (this._detailsOverlay._fadeInTween.isPlaying))){
  4606. this._detailsOverlay._fadeInTween.fforward();
  4607. this._detailsOverlay.alpha = 0.4;
  4608. if (((this._detailsOverlay._clickableLayerFadeInTween) && (this._detailsOverlay._clickableLayerFadeInTween.isPlaying))){
  4609. this._detailsOverlay._clickableLayerFadeInTween.fforward();
  4610. };
  4611. this.detatailsOverLayClickableLayer.alpha = 0.4;
  4612. };
  4613. }
  4614. public function get eid(){
  4615. return (this._eid);
  4616. }
  4617. public function removePlayer(){
  4618. if (stage.frameRate != 30){
  4619. stage.frameRate = 30;
  4620. };
  4621. if (((((this._quickPlayerContainer) && (this._quickPlayer))) && (this._quickPlayerContainer.contains(this._quickPlayer)))){
  4622. this._quickPlayer.stop();
  4623. if (this._quickPlayButton){
  4624. this._quickPlayButton.reset();
  4625. };
  4626. this._quickPlayerContainer.removeChild(this._quickPlayer);
  4627. this._quickPlayer = null;
  4628. trace("QUICK PLAYER REMOVED");
  4629. };
  4630. }
  4631. public function userLogin(id:Number){
  4632. var id:* = id;
  4633. if (this._swfKeyArt){
  4634. try {
  4635. var _local3 = _imageClip.content;
  4636. _local3["userLogin"](id);
  4637. } catch(e) {
  4638. };
  4639. };
  4640. if (this._detailsOverlay){
  4641. this._detailsOverlay.userLogin(id);
  4642. };
  4643. }
  4644. public function redraw(){
  4645. if (this._swfKeyArt){
  4646. try {
  4647. var _local2 = _imageClip.content;
  4648. _local2["redraw"]();
  4649. } catch(e) {
  4650. };
  4651. };
  4652. }
  4653. override protected function traceLoadedAnd3rdPartyBeacon():void{
  4654. var fired:* = false;
  4655. if (this._swfKeyArt){
  4656. fired = beaconEventTrace("mastheadload", null);
  4657. _mastheadclickBeaconDisabled = false;
  4658. if (fired){
  4659. try {
  4660. var _local2 = _imageClip.content;
  4661. _local2["trackLoadedBeacon"]();
  4662. } catch(e) {
  4663. };
  4664. };
  4665. } else {
  4666. super.traceLoadedAnd3rdPartyBeacon();
  4667. };
  4668. }
  4669. private function get brandGroupId(){
  4670. if (_data["adGroupId"] != null){
  4671. return (_data["adGroupId"]);
  4672. };
  4673. if (this._detailsOverlay){
  4674. if (this._detailsOverlay.sponsorBanner){
  4675. if (this._detailsOverlay.sponsorBanner.brandGroupId != null){
  4676. return (this._detailsOverlay.sponsorBanner.brandGroupId);
  4677. };
  4678. };
  4679. };
  4680. return (null);
  4681. }
  4682. override public function get linkUrl(){
  4683. if (_data["watchNowOverride"] != null){
  4684. return (_data["watchNowOverride"]);
  4685. };
  4686. if (this._detailsOverlay){
  4687. if (this._detailsOverlay.sponsorBanner){
  4688. if (this._detailsOverlay.sponsorBanner.watchNowOverride){
  4689. return (this._detailsOverlay.sponsorBanner.watchNowOverride);
  4690. };
  4691. };
  4692. };
  4693. return (super.linkUrl);
  4694. }
  4695.  
  4696. }
  4697. }//package com.hulu.masthead.view
  4698. package com.hulu.masthead.view {
  4699. import flash.display.*;
  4700. import flash.events.*;
  4701. import flash.net.*;
  4702. import flash.system.*;
  4703. import com.hulu.masthead.utils.*;
  4704. import flash.external.*;
  4705.  
  4706. public class HuluItemsContainer extends ItemsContainer {
  4707.  
  4708. public function HuluItemsContainer(controller:Object){
  4709. super(controller);
  4710. ExternalInterface.addCallback("addFacepile", this.addFacepile);
  4711. }
  4712. override protected function createObjects(itemsModel:Array){
  4713. var obj:ImageItem;
  4714. var i:* = 0;
  4715. while (i < itemsModel.length) {
  4716. _controller.autoScrollCounter.push(((itemsModel[i]["embed"]) ? 1 : -1));
  4717. obj = new HuluImageItem(_controller, itemsModel[i], i);
  4718. addChild(obj);
  4719. _imageItems.push(obj);
  4720. i++;
  4721. };
  4722. if (_showFacepile){
  4723. this.addFacepile();
  4724. };
  4725. }
  4726. public function addFacepile():void{
  4727. var loadUrl:* = null;
  4728. var endIndex:* = 0;
  4729. var urlFacepile:* = null;
  4730. if (!_isFacepileLoaded){
  4731. _isFacepileLoaded = true;
  4732. loadUrl = _controller.stage.loaderInfo.loaderURL;
  4733. endIndex = loadUrl.lastIndexOf("/", loadUrl.length);
  4734. urlFacepile = loadUrl.substr(0, (endIndex + 1));
  4735. urlFacepile = (urlFacepile + "Facepile.swf?v20");
  4736. trace(("Loading: " + urlFacepile));
  4737. _loaderFacepile = new Loader();
  4738. _loaderFacepile.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onLoadFacepileComplete);
  4739. try {
  4740. _loaderFacepile.load(new URLRequest(urlFacepile), new LoaderContext(true, ApplicationDomain.currentDomain));
  4741. } catch(e) {
  4742. trace(("Error: HuluItemsContainer.addFacepile" + e));
  4743. };
  4744. };
  4745. }
  4746. public function preloadObjects(items:Array){
  4747. items.forEach(this.preloadObject);
  4748. }
  4749. private function preloadObject(obj, index:int, array:Array):void{
  4750. if (((obj["imageUrl"]) && (!((obj["type"] == "animationswf"))))){
  4751. Utility.loadImage(obj["imageUrl"], null, null);
  4752. };
  4753. if (obj["logoUrl"]){
  4754. Utility.loadImage(obj["logoUrl"], null, null);
  4755. if (Utility.upidReplace(obj["logoUrl"])){
  4756. Utility.loadImage(Utility.upidReplace(obj["logoUrl"]), null, null);
  4757. };
  4758. };
  4759. }
  4760. protected function onLoadFacepileComplete(event:Event){
  4761. var event:* = event;
  4762. _loaderFacepile.content["baseUrl"] = _controller.stage.loaderInfo.loaderURL;
  4763. _facepile = new Sprite();
  4764. _facepile.addChild(_loaderFacepile);
  4765. var urlVideos:* = ((_loaderFacepile.content["baseUrl"] + "social/masthead_data?limit=10&uid=") + _uid);
  4766. var isFirst:* = true;
  4767. var count:* = 0;
  4768. while (count < _imageItems.length) {
  4769. if ((((_imageItems[count].videoId < 0)) && ((_imageItems[count].showId >= 0)))){
  4770. if (isFirst){
  4771. isFirst = false;
  4772. urlVideos = (urlVideos + "&show_ids=");
  4773. } else {
  4774. urlVideos = (urlVideos + ",");
  4775. };
  4776. urlVideos = (urlVideos + _imageItems[count].showId.toString());
  4777. };
  4778. count = (count + 1);
  4779. };
  4780. isFirst = true;
  4781. count = 0;
  4782. while (count < _imageItems.length) {
  4783. if (_imageItems[count].videoId >= 0){
  4784. if (isFirst){
  4785. isFirst = false;
  4786. urlVideos = (urlVideos + "&video_ids=");
  4787. } else {
  4788. urlVideos = (urlVideos + ",");
  4789. };
  4790. urlVideos = (urlVideos + _imageItems[count].videoId.toString());
  4791. };
  4792. count = (count + 1);
  4793. };
  4794. var loaderVideos:* = new URLLoader();
  4795. loaderVideos.addEventListener(Event.COMPLETE, this.onMastheadDataComplete);
  4796. try {
  4797. loaderVideos.load(new URLRequest(urlVideos));
  4798. } catch(e:ErrorEvent) {
  4799. trace(e);
  4800. };
  4801. }
  4802. protected function onMastheadDataComplete(event:Event){
  4803. var event:* = event;
  4804. var str:* = event.target.data;
  4805. try {
  4806. var _local3 = _loaderFacepile.content;
  4807. _local3["setData"](_uid, str);
  4808. } catch(e) {
  4809. trace(("Error: HuluItemsContainer.oncComplete" + e));
  4810. };
  4811. displayFacepile();
  4812. }
  4813. private function onError(event:Event){
  4814. }
  4815.  
  4816. }
  4817. }//package com.hulu.masthead.view
  4818. package com.hulu.masthead.view {
  4819. import flash.display.*;
  4820. import flash.events.*;
  4821. import flash.net.*;
  4822. import flash.utils.*;
  4823. import fl.motion.easing.*;
  4824. import fl.transitions.easing.*;
  4825. import fl.containers.*;
  4826.  
  4827. public class AS3VideoContainer extends Sprite {
  4828.  
  4829. private var _style:Object;
  4830. private var _player;
  4831. private var _playerLoader:UILoader;
  4832. private var _loadingClip:LoadingImage;
  4833. private var _timer:Timer;
  4834. private var _eid:String;
  4835. private var _playerHost:String;
  4836. private var _env:String;
  4837. private var _playerState:String = "none";
  4838.  
  4839. public function AS3VideoContainer(style:Object, eid:String, playerHost:String, env:String){
  4840. super();
  4841. this._playerHost = ((playerHost) || ("http://www.hulu.com/embed/"));
  4842. this._style = style;
  4843. this._eid = eid;
  4844. this._env = env;
  4845. this.initialize();
  4846. }
  4847. private function initialize():void{
  4848. trace("AS3VideoContainer.initialize");
  4849. this._playerLoader = new UILoader();
  4850. this._playerLoader.addEventListener(Event.COMPLETE, this.onInitializeSucceeded);
  4851. this._loadingClip = new LoadingImage();
  4852. addChild(this._playerLoader);
  4853. addChild(this._loadingClip);
  4854. this._loadingClip.x = ((this._style.QuickPlayer.playerWidth / 2) + 45);
  4855. this._loadingClip.y = (this._style.ImageItem.height / 2);
  4856. var playerURL:String = HuluMasthead.stage.loaderInfo.url;
  4857. var baseURL:String = playerURL.substr(0, playerURL.search(/\/[^\/]*\.swf/));
  4858. var url = (baseURL + "/embedplayer.swf?flaWidth=920&flaHeight=377&stageWidth=512&stageHeight=296");
  4859. url = ((this._playerHost + "site-player/playerembed.swf?extContainer=masthead&env=") + this._env);
  4860. this._playerLoader.load(new URLRequest(url));
  4861. }
  4862. private function onInitializeSucceeded(e:Event):void{
  4863. trace("AS3VideoContainer.onInitializeSucceeded");
  4864. this._player = (e.target as UILoader).content;
  4865. addChild(this._player);
  4866. this._player.addEventListener("player_ready", this.onPlayerReady);
  4867. this._player.initPlayer(true);
  4868. }
  4869. private function onPlayerReady(evt:Event):void{
  4870. trace("AS3VideoContainer.onPlayerReady");
  4871. if (((!((this._loadingClip == null))) && (this.contains(this._loadingClip)))){
  4872. this.removeChild(this._loadingClip);
  4873. this._loadingClip = null;
  4874. };
  4875. dispatchEvent(new Event("onInitializeSucceeded"));
  4876. this._player.setEnablePreroll(false);
  4877. if (this._eid != null){
  4878. this.loadInternal(this._eid);
  4879. };
  4880. }
  4881. private function onInitializeFailed(e:Event):void{
  4882. }
  4883. public function load(eid:String):void{
  4884. trace(("AS3VideoContainer.load " + [eid]));
  4885. if (eid == null){
  4886. return;
  4887. };
  4888. this._eid = eid;
  4889. this._playerState = "play";
  4890. this.loadInternal(eid);
  4891. }
  4892. public function loadInternal(eid:String):void{
  4893. if (eid == null){
  4894. return;
  4895. };
  4896. if (this._player){
  4897. this._player.playVideo(("e:" + eid), 0, 0);
  4898. switch (this._playerState){
  4899. case "stop":
  4900. this.stopPlayer();
  4901. break;
  4902. case "pause":
  4903. this.pausePlayer();
  4904. break;
  4905. };
  4906. };
  4907. }
  4908. public function pausePlayer():void{
  4909. this._playerState = "pause";
  4910. if (this._player){
  4911. this._player.pause();
  4912. };
  4913. }
  4914. public function playPlayer():void{
  4915. this._playerState = "play";
  4916. if (this._player){
  4917. this._player.resume();
  4918. };
  4919. }
  4920. public function stopPlayer():void{
  4921. this._playerState = "stop";
  4922. if (this._player){
  4923. this._player.stop();
  4924. };
  4925. }
  4926.  
  4927. }
  4928. }//package com.hulu.masthead.view
  4929. package com.hulu.masthead.view {
  4930.  
  4931. public dynamic class MoreLink extends MediumButton {
  4932.  
  4933. }
  4934. }//package com.hulu.masthead.view
  4935. package com.hulu.masthead.view {
  4936. import flash.display.*;
  4937. import flash.events.*;
  4938. import flash.net.*;
  4939. import fl.transitions.*;
  4940. import com.hulu.masthead.model.*;
  4941. import com.hulu.masthead.utils.*;
  4942. import fl.motion.easing.*;
  4943.  
  4944. public class SalesLogoUnit extends Sprite {
  4945.  
  4946. private var _banner:Sprite;
  4947. private var _currentFrame:Number = -1;
  4948. private var _totalFrame:Number;
  4949. private var _container:HuluImageItem;
  4950. private var _frame:Array;
  4951. private var _model:Array;
  4952. private var _companionIndex:Number = -1;
  4953. private var _isActive:Function;
  4954. private var _updatePosition:Function;
  4955. private var _moveUpLogoUnit:Function;
  4956. private var _displayed:Array;
  4957. private var _yStart:Number;
  4958. private var _rotationTimeout:Number = -1;
  4959.  
  4960. public function SalesLogoUnit(container:HuluImageItem, model:Array, isActive:Function, updatePosition:Function, moveUpLogoUnit:Function, yStart:Number){
  4961. this._frame = [];
  4962. this._model = [];
  4963. this._displayed = [];
  4964. super();
  4965. this._container = container;
  4966. this._model = model;
  4967. this._isActive = isActive;
  4968. this._totalFrame = this._model.length;
  4969. this._yStart = yStart;
  4970. this._updatePosition = updatePosition;
  4971. this._moveUpLogoUnit = moveUpLogoUnit;
  4972. this.checkToLoadBanner();
  4973. }
  4974. private function checkToLoadBanner(evt=null):void{
  4975. trace(("SalesLogoUnit.checkToLoadBanner " + [UserConfig.getInstance().isUserLoggedIn, UserConfig.getInstance().getUserId()]));
  4976. var containMatureBanner:Boolean;
  4977. var matureBannerIndex:Number = -1;
  4978. var i:int;
  4979. while (i < this._model.length) {
  4980. if (((this._model[i].isMatureRated) && ((this._model[i].duration > 0)))){
  4981. containMatureBanner = true;
  4982. matureBannerIndex = i;
  4983. break;
  4984. };
  4985. i++;
  4986. };
  4987. if (((containMatureBanner) && (UserConfig.getInstance().isUserLoggedIn))){
  4988. if (UserConfig.getInstance().userConfigAvailable){
  4989. if (UserConfig.getInstance().allowMatureContent){
  4990. this.loadBanner(this.randomBanner(true));
  4991. } else {
  4992. this.loadBanner(this.randomBanner(false));
  4993. };
  4994. } else {
  4995. UserConfig.getInstance().addEventListener("userConfigReady", this.checkToLoadBanner);
  4996. UserConfig.getInstance().loadUserConfig();
  4997. };
  4998. } else {
  4999. this.loadBanner(this.randomBanner(false));
  5000. };
  5001. }
  5002. private function randomBanner(allowMatureContent:Boolean):Number{
  5003. var total:Number = 0;
  5004. var range:Array = [0];
  5005. var i:int;
  5006. while (i < this._model.length) {
  5007. if (((!(allowMatureContent)) && (this._model[i].isMatureRated))){
  5008. this._model[i].duration = 0;
  5009. };
  5010. range.push((this._model[i].duration + range[i]));
  5011. total = (total + this._model[i].duration);
  5012. i++;
  5013. };
  5014. if (total <= 0){
  5015. return (-1);
  5016. };
  5017. i = 0;
  5018. while (i < range.length) {
  5019. range[i] = (range[i] / total);
  5020. i++;
  5021. };
  5022. var rand:Number = Math.random();
  5023. i = 0;
  5024. while (i < (range.length - 1)) {
  5025. if (((!(allowMatureContent)) && (this._model[i].isMatureRated))){
  5026. } else {
  5027. if ((((range[i] <= rand)) && ((rand < range[(i + 1)])))){
  5028. return (i);
  5029. };
  5030. };
  5031. i++;
  5032. };
  5033. return (-1);
  5034. }
  5035. private function loadBanner(item:Number):void{
  5036. var i:*;
  5037. if (item < 0){
  5038. return;
  5039. };
  5040. this._companionIndex = item;
  5041. this._banner = new Sprite();
  5042. this._banner.mouseChildren = false;
  5043. this._banner.addChild(Utility.loadImage(Utility.upidReplace(this._model[item].logoURL), this.onImageLoaded, this.ioErrorHandler));
  5044. this.addChild(this._banner);
  5045. this._frame.push(this._banner);
  5046. this._displayed[item] = false;
  5047. this._container.updateItemData("salesforcePlacementTag", this._model[item].placementId);
  5048. this._container.updateItemData("targetingId", this._model[item].targetingId);
  5049. this._container.updateItemData("clickThroughBeaconURLs", this._model[item].clickThroughURLs);
  5050. this._container.updateItemData("impressionURLs", this._model[item].impressionURLs);
  5051. if (this._model[item].sponsorTargetURL.indexOf("http") == 0){
  5052. this.addEventListener(MouseEvent.CLICK, this._container.onSponsorLogoClicked);
  5053. this.buttonMode = true;
  5054. this._container.updateItemData("sponsorTargetURL", this._model[item].sponsorTargetURL);
  5055. if ((this._moveUpLogoUnit is Function)){
  5056. this._moveUpLogoUnit();
  5057. };
  5058. } else {
  5059. this._container.updateItemData("sponsorTargetURL", null);
  5060. };
  5061. for (i in this._model[item].impressionURLs) {
  5062. Utility.callService(Utility.upidReplace(this._model[item].impressionURLs[i]));
  5063. };
  5064. }
  5065. private function onImageLoaded(e){
  5066. if (this.width <= 234){
  5067. this.x = ((234 - this.width) / 2);
  5068. } else {
  5069. this.x = (234 - this.width);
  5070. };
  5071. }
  5072. private function ioErrorHandler(e){
  5073. trace(e);
  5074. }
  5075. public function get watchNowOverride():String{
  5076. if (this._companionIndex == -1){
  5077. return (null);
  5078. };
  5079. return (this._model[this._companionIndex].watchNowOverride);
  5080. }
  5081. public function get brandGroupId():String{
  5082. if (this._companionIndex == -1){
  5083. return (null);
  5084. };
  5085. return (this._model[this._companionIndex].brandGroupId);
  5086. }
  5087. private function onLogoClicked(e){
  5088. }
  5089. public function reset(){
  5090. this.hideAll();
  5091. this._currentFrame = -1;
  5092. }
  5093. private function hideAll(){
  5094. var i:*;
  5095. for (i in this._frame) {
  5096. this._frame[i].visible = false;
  5097. };
  5098. }
  5099.  
  5100. }
  5101. }//package com.hulu.masthead.view
  5102. package com.hulu.masthead.view {
  5103. import flash.display.*;
  5104. import flash.events.*;
  5105. import com.hulu.masthead.utils.*;
  5106. import fl.motion.easing.*;
  5107. import com.hulu.masthead.controller.*;
  5108. import flash.external.*;
  5109.  
  5110. public class ItemsContainer extends Sprite {
  5111.  
  5112. protected var _imageItems:Array;
  5113. protected var _style:Object;
  5114. protected var _controller:Object;
  5115. protected var _currentPage:Number = 0;
  5116. protected var _visiblePages:Number;
  5117. protected var _uid:Number = -1;
  5118. protected var _facepile:Sprite;
  5119. protected var _loaderFacepile:Loader;
  5120. protected var _isFacepileLoaded:Boolean = false;
  5121. protected var _loadFacepile:Boolean = false;
  5122. protected var _showFacepile:Boolean = false;
  5123.  
  5124. public function ItemsContainer(controller:Object){
  5125. this._imageItems = [];
  5126. super();
  5127. this._controller = controller;
  5128. this._style = this._controller.style;
  5129. if (this._loadFacepile){
  5130. this._uid = ExternalInterface.call("Behaviors.getUserId");
  5131. if (((ExternalInterface.call("Behaviors.isFacebookConnected")) && ((this._uid >= 0)))){
  5132. this._showFacepile = true;
  5133. };
  5134. };
  5135. this._controller.stage.addEventListener("stageResize", this.onResize);
  5136. }
  5137. public function addItems(itemsModel:Array){
  5138. this._visiblePages = this._style.Carousel.visiblePages;
  5139. this.createObjects(itemsModel);
  5140. }
  5141. public function show(startpage:Number){
  5142. this._currentPage = startpage;
  5143. this._imageItems[this._currentPage].show();
  5144. this.layoutItem();
  5145. this.displayFacepile();
  5146. }
  5147. public function displayFacepile(){
  5148. if (((this._showFacepile) && (this._facepile))){
  5149. var _local2 = this._loaderFacepile.content;
  5150. _local2["clearDisplay"]();
  5151. if ((((this._imageItems[this._currentPage].videoId >= 0)) || ((this._imageItems[this._currentPage].showId >= 0)))){
  5152. if (this._imageItems[this._currentPage].contains(this._facepile)){
  5153. try {
  5154. this._imageItems[this._currentPage].removeChild(this._facepile);
  5155. } catch(e) {
  5156. trace(("Error: 1 ItemsContainer.showFacepile " + e));
  5157. };
  5158. };
  5159. this._imageItems[this._currentPage].addChild(this._facepile);
  5160. if ((((this._imageItems[this._currentPage].quickPlayerContainer == null)) && ((this._imageItems[this._currentPage].movieShowtimeContainer == null)))){
  5161. try {
  5162. if (this._imageItems[this._currentPage].videoId >= 0){
  5163. _local2 = this._loaderFacepile.content;
  5164. _local2["display"](this._imageItems[this._currentPage].videoId, "video");
  5165. } else {
  5166. _local2 = this._loaderFacepile.content;
  5167. _local2["display"](this._imageItems[this._currentPage].showId, "show");
  5168. };
  5169. } catch(e) {
  5170. trace(("Error: 2 ItemsContainer.showFacepile " + e));
  5171. };
  5172. };
  5173. };
  5174. this.layoutFacepile();
  5175. };
  5176. }
  5177. protected function createObjects(itemsModel:Array){
  5178. var obj:ImageItem;
  5179. var i:* = 0;
  5180. while (i < itemsModel.length) {
  5181. obj = new ImageItem(this._controller, itemsModel[i], i);
  5182. addChild(obj);
  5183. this._imageItems.push(obj);
  5184. i++;
  5185. };
  5186. }
  5187. public function layoutItem(){
  5188. var itemPerchWidth:Number = (this._imageItems[this._currentPage].width + this._style.Carousel.gutterWidth);
  5189. this._imageItems[this._currentPage].x = this._style.Carousel.leftMargin;
  5190. }
  5191. public function layoutFacepile(){
  5192. var widthImage:Number = Math.max(this._style.ImageItem.width, (this._controller.stageWidth - (this._style.Carousel.leftMargin * 2)));
  5193. this._facepile.x = ((widthImage - this._style.ImageItem.width) / 2);
  5194. this._facepile.y = (this._style.ImageItem.height - 55);
  5195. }
  5196. public function get imageItems(){
  5197. return (this._imageItems);
  5198. }
  5199. public function userLogin(id:Number){
  5200. var i:* = 0;
  5201. var id:* = id;
  5202. if (id < 0){
  5203. this._showFacepile = false;
  5204. if (this._facepile){
  5205. i = 0;
  5206. while (i < this._imageItems.length) {
  5207. try {
  5208. this._imageItems[i].removeChild(this._facepile);
  5209. } catch(e) {
  5210. trace(("Error: ItemsContainer.imageItems " + e));
  5211. };
  5212. i = (i + 1);
  5213. };
  5214. try {
  5215. this._facepile.removeChild(this._loaderFacepile);
  5216. } catch(e) {
  5217. trace(("Error: ItemsContainer.imageItems " + e));
  5218. };
  5219. this._facepile = null;
  5220. this._loaderFacepile = null;
  5221. };
  5222. this._isFacepileLoaded = false;
  5223. } else {
  5224. this._uid = ExternalInterface.call("Behaviors.getUserId");
  5225. this._showFacepile = true;
  5226. };
  5227. }
  5228. public function onResize(event:Event){
  5229. this.layoutItem();
  5230. }
  5231.  
  5232. }
  5233. }//package com.hulu.masthead.view
  5234. package com.hulu.masthead.view {
  5235.  
  5236. public dynamic class HideMoreButton extends MediumButton {
  5237.  
  5238. }
  5239. }//package com.hulu.masthead.view
  5240. package com.hulu.masthead.view {
  5241. import flash.display.*;
  5242. import flash.events.*;
  5243. import fl.transitions.*;
  5244. import com.hulu.masthead.model.*;
  5245. import com.hulu.masthead.utils.*;
  5246. import fl.motion.easing.*;
  5247. import fl.transitions.easing.*;
  5248. import flash.text.*;
  5249.  
  5250. public class DetailsOverlay extends Sprite {
  5251.  
  5252. public var _header:TextField;
  5253. public var _caption:TextField;
  5254. private var _watchButton:WatchButton;
  5255. private var _logoImage:Sprite;
  5256. private var _promotation:Sprite;
  5257. private var _title:String;
  5258. private var _description:String;
  5259. private var _logoUrl:String;
  5260. private var _xmlUrl:String;
  5261. private var _style:Object;
  5262. private var _isActive:Boolean;
  5263. private var _container:HuluImageItem;
  5264. private var _logoUnit:Sprite;
  5265. private var _promotionUrl:String;
  5266. private var _promotionLoaded:Boolean = false;
  5267. private var _logoUnitOntop:Boolean = false;
  5268. private var _ad:Object;
  5269. public var _fadeInTween:Tween;
  5270. public var _clickableLayerFadeInTween:Tween;
  5271. public var showCallback:Function;
  5272.  
  5273. public function DetailsOverlay(style:Object, container:HuluImageItem, title:String, description:String, logoUrl:String, promotionUrl:String, xmlUrl:String, ad:Object){
  5274. super();
  5275. this.visible = false;
  5276. this._style = style;
  5277. this._container = container;
  5278. this._title = ((title) || (""));
  5279. this._description = ((description) || (""));
  5280. this._logoUrl = ((logoUrl) || (""));
  5281. this._xmlUrl = ((xmlUrl) || (""));
  5282. this._promotionUrl = ((promotionUrl) || (""));
  5283. this._ad = ad;
  5284. this.createObjects();
  5285. this.layoutObjects(this._style.DetailsOverlay.logoTopMargin);
  5286. }
  5287. private function createObjects(){
  5288. var salesLogo:* = null;
  5289. var self:* = undefined;
  5290. this._header.autoSize = "left";
  5291. this._caption.autoSize = "left";
  5292. this._header.setTextFormat(new TextFormat(null, this._style.DetailsOverlay.titleFontSize, null, true));
  5293. this._caption.setTextFormat(new TextFormat(null, this._style.DetailsOverlay.captionFontSize, null, true));
  5294. this._header.text = this._title;
  5295. this._caption.text = this._description;
  5296. this._header.cacheAsBitmap = true;
  5297. this._caption.cacheAsBitmap = true;
  5298. this._watchButton = new WatchButton();
  5299. this._watchButton.light_mc.alpha = 0;
  5300. this._logoImage = new Sprite();
  5301. this._promotation = new Sprite();
  5302. addChild(this._logoImage);
  5303. addChild(this._promotation);
  5304. addChild(this._watchButton);
  5305. if (this._ad != null){
  5306. this._isActive = true;
  5307. this._logoUnit = new Sprite();
  5308. this._logoUnit.graphics.beginFill(0, 0);
  5309. this._logoUnit.graphics.drawRect(0, 0, this._style.DetailsOverlay.borderWidth, this._style.DetailsOverlay.salesLogoHeight);
  5310. this._logoUnit.graphics.endFill();
  5311. salesLogo = new CerebroSalesLogoUnit(this._container, this._ad, this.isActive, this.layoutObjects, this.moveUpLogoUnit, this._style.DetailsOverlay.logoTopMargin);
  5312. this._logoUnit.addChild(salesLogo);
  5313. this._logoImage.addChild(Utility.loadImage(this._logoUrl, this.loadSucceed, this.loadError));
  5314. if (this._promotionUrl != ""){
  5315. this._promotation.addChild(Utility.loadImage(this._promotionUrl, this.promotionLoaded, null));
  5316. };
  5317. if (!!(this._container.getItemData("sponsorTargetURL"))){
  5318. if (!this._logoUnitOntop){
  5319. this._logoUnitOntop = true;
  5320. this._container.detatailsOverLayClickableLayer.addChild(this._logoUnit);
  5321. };
  5322. } else {
  5323. if (!this._logoUnitOntop){
  5324. addChild(this._logoUnit);
  5325. };
  5326. };
  5327. this._container.onADDataReady();
  5328. this.visible = true;
  5329. } else {
  5330. if (!this._xmlUrl){
  5331. if (!this._logoUrl){
  5332. this.visible = true;
  5333. this.layoutObjects(this._style.DetailsOverlay.logoTopMargin);
  5334. } else {
  5335. this._logoImage.addChild(Utility.loadImage(this._logoUrl, this.loadSucceed, this.loadError));
  5336. if (this._promotionUrl != ""){
  5337. this._promotation.addChild(Utility.loadImage(this._promotionUrl, this.promotionLoaded, null));
  5338. };
  5339. };
  5340. this._container.onADDataReady();
  5341. } else {
  5342. self = this;
  5343. this._isActive = true;
  5344. new MastheadXML(this._xmlUrl, function (model){
  5345. var salesLogo:SalesLogoUnit;
  5346. _logoUnit = new Sprite();
  5347. _logoUnit.graphics.beginFill(0, 0);
  5348. _logoUnit.graphics.drawRect(0, 0, _style.DetailsOverlay.borderWidth, _style.DetailsOverlay.salesLogoHeight);
  5349. _logoUnit.graphics.endFill();
  5350. if (((!(!(model))) && ((model.length > 0)))){
  5351. salesLogo = new SalesLogoUnit(_container, model, self.isActive, self.layoutObjects, self.moveUpLogoUnit, _style.DetailsOverlay.logoTopMargin);
  5352. _logoUnit.addChild(salesLogo);
  5353. } else {
  5354. _container.updateItemData("salesforcePlacementTag", null);
  5355. _container.updateItemData("xmlUrl", null);
  5356. };
  5357. _logoImage.addChild(Utility.loadImage(_logoUrl, loadSucceed, loadError));
  5358. if (_promotionUrl != ""){
  5359. _promotation.addChild(Utility.loadImage(_promotionUrl, promotionLoaded, null));
  5360. };
  5361. if (!!(_container.getItemData("sponsorTargetURL"))){
  5362. if (!_logoUnitOntop){
  5363. _logoUnitOntop = true;
  5364. _container.detatailsOverLayClickableLayer.addChild(_logoUnit);
  5365. };
  5366. } else {
  5367. if (!_logoUnitOntop){
  5368. self.addChild(_logoUnit);
  5369. };
  5370. };
  5371. _container.onADDataReady();
  5372. });
  5373. this.visible = true;
  5374. };
  5375. };
  5376. }
  5377. private function promotionLoaded(e:Event):void{
  5378. this._promotation.x = ((this._style.DetailsOverlay.borderWidth - this._promotation.width) / 2);
  5379. this._promotation.y = this._style.DetailsOverlay.logoTopMargin;
  5380. this._logoImage.y = ((this._promotation.y + this._promotation.height) + this._style.DetailsOverlay.promoPadding);
  5381. this._promotionLoaded = true;
  5382. if (((!(!(this._xmlUrl))) || (!((this._ad == null))))){
  5383. this._logoUnit.y = (this._style.ImageItem.height - this._style.DetailsOverlay.salesLogoHeight);
  5384. };
  5385. this.layoutObjects(((this._logoImage.y + this._logoImage.height) + this._style.DetailsOverlay.logoHeaderMargin));
  5386. }
  5387. public function loadSucceed(event:Event){
  5388. this._logoImage.x = ((this._style.DetailsOverlay.borderWidth - this._logoImage.width) / 2);
  5389. this._logoImage.y = this._style.DetailsOverlay.logoTopMargin;
  5390. if (this._promotionLoaded){
  5391. this._logoImage.y = ((this._promotation.y + this._promotation.height) + this._style.DetailsOverlay.promoPadding);
  5392. };
  5393. if (((!(!(this._xmlUrl))) || (!((this._ad == null))))){
  5394. this._logoUnit.y = (this._style.ImageItem.height - this._style.DetailsOverlay.salesLogoHeight);
  5395. };
  5396. this.layoutObjects(((this._logoImage.y + this._logoImage.height) + this._style.DetailsOverlay.logoHeaderMargin));
  5397. this.visible = true;
  5398. this.showCallback(null);
  5399. }
  5400. private function loadError(event:IOErrorEvent){
  5401. if (((!(!(this._xmlUrl))) || (!((this._ad == null))))){
  5402. this._logoUnit.y = (this._style.ImageItem.height - this._style.DetailsOverlay.salesLogoHeight);
  5403. };
  5404. this.layoutObjects(this._style.DetailsOverlay.logoTopMargin);
  5405. this.visible = true;
  5406. this.showCallback(null);
  5407. }
  5408. public function layoutObjects(ystart){
  5409. this._header.y = ystart;
  5410. this._caption.y = ((this._header.y + this._header.height) + this._style.DetailsOverlay.headerCaptionMargin);
  5411. this._watchButton.y = ((this._caption.y + this._caption.height) + this._style.DetailsOverlay.captionWatchBtnMargin);
  5412. if ((this._watchButton.y + this._watchButton.height) > this._style.ImageItem.height){
  5413. this._watchButton.y = (this._style.ImageItem.height - this._watchButton.height);
  5414. };
  5415. this._watchButton.x = ((this.width - this._watchButton.width) - this._style.DetailsOverlay.watchBtnRightMargin);
  5416. }
  5417. public function fadeIn(isGradully:Boolean){
  5418. if (isGradully){
  5419. this._fadeInTween = new Tween(this, "alpha", Quartic.easeOut, alpha, 1, 120);
  5420. if (!!(this._container.getItemData("sponsorTargetURL"))){
  5421. this._clickableLayerFadeInTween = new Tween(this._container.detatailsOverLayClickableLayer, "alpha", Quartic.easeOut, alpha, 1, 120);
  5422. };
  5423. } else {
  5424. this.alpha = 1;
  5425. this._container.detatailsOverLayClickableLayer.alpha = 1;
  5426. };
  5427. this._isActive = true;
  5428. }
  5429. public function turnLight(){
  5430. new Tween(this._watchButton.light_mc, "alpha", Back.easeOut, 0, 1, 12, false);
  5431. }
  5432. public function turnDark(){
  5433. new Tween(this._watchButton.light_mc, "alpha", Back.easeOut, 1, 0, 12, false);
  5434. }
  5435. public function isActive(){
  5436. return (this._isActive);
  5437. }
  5438. public function moveUpLogoUnit(){
  5439. if (this._logoUnitOntop){
  5440. return;
  5441. };
  5442. this._logoUnitOntop = true;
  5443. if (this.contains(this._logoUnit)){
  5444. this.removeChild(this._logoUnit);
  5445. };
  5446. this._container.detatailsOverLayClickableLayer.addChild(this._logoUnit);
  5447. }
  5448. public function deactive(){
  5449. this._isActive = false;
  5450. }
  5451. public function get sponsorLogo():Sprite{
  5452. return (this._logoUnit);
  5453. }
  5454. public function get sponsorBanner():SalesLogoUnit{
  5455. if (this._logoUnit){
  5456. if (this._logoUnit.numChildren > 0){
  5457. if (this._logoUnit.getChildAt(0)){
  5458. return ((this._logoUnit.getChildAt(0) as SalesLogoUnit));
  5459. };
  5460. };
  5461. };
  5462. return (null);
  5463. }
  5464. public function userLogin(id:Number){
  5465. }
  5466.  
  5467. }
  5468. }//package com.hulu.masthead.view
  5469. package com.hulu.masthead.utils {
  5470. import flash.display.*;
  5471. import flash.events.*;
  5472. import flash.net.*;
  5473. import fl.transitions.*;
  5474. import flash.utils.*;
  5475. import flash.system.*;
  5476.  
  5477. public class Utility {
  5478.  
  5479. private static var disableFSO:Boolean = false;
  5480.  
  5481. public static function setTimeOut(func:Function, delay:Number){
  5482. var repeatTime:Number = ((arguments[2]) || (1));
  5483. var timer:Timer = new Timer(delay, repeatTime);
  5484. timer.addEventListener("timer", func);
  5485. timer.start();
  5486. }
  5487. public static function loadImage(url:String, init:Function, error:Function):Loader{
  5488. var url:* = url;
  5489. var init:* = init;
  5490. var error:* = error;
  5491. var request:* = new URLRequest(url);
  5492. var loader:* = new Loader();
  5493. try {
  5494. if (((url) && ((url.indexOf(".swf") > 0)))){
  5495. loader.load(new URLRequest(url), new LoaderContext(true, new ApplicationDomain()));
  5496. } else {
  5497. loader.load(request);
  5498. };
  5499. } catch(e) {
  5500. trace(e);
  5501. };
  5502. if (init != null){
  5503. loader.contentLoaderInfo.addEventListener(Event.COMPLETE, init);
  5504. };
  5505. if (error == null){
  5506. error = function (event:IOErrorEvent){
  5507. };
  5508. };
  5509. loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, error);
  5510. loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, function (e){
  5511. });
  5512. loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (e){
  5513. });
  5514. return (loader);
  5515. }
  5516. public static function tweenTo(myObject:Object, atrributeObj:Object, tween:Function, frame:Number, afterFun:Function){
  5517. var i:*;
  5518. var myTween:Tween;
  5519. for (i in atrributeObj) {
  5520. myTween = new Tween(myObject, i, tween, myObject[i], atrributeObj[i], frame, false);
  5521. if (arguments[4]){
  5522. myTween.addEventListener(TweenEvent.MOTION_FINISH, arguments[4]);
  5523. };
  5524. };
  5525. }
  5526. public static function smilHostFromClip(baseUrl:String):String{
  5527. var hostArray:Array = baseUrl.split("/");
  5528. var host = ([hostArray[0], hostArray[1], hostArray[2]].join("/") + "/");
  5529. var smilHost:String = "";
  5530. if (host.indexOf("file://") != -1){
  5531. smilHost = "http://www.qa.hulu.com/";
  5532. } else {
  5533. if (((!((host.indexOf("www.hulu.com") == -1))) || (!((host.indexOf("origin-www.hulu.com") == -1))))){
  5534. smilHost = "http://www.hulu.com/";
  5535. } else {
  5536. if (((((!((host.indexOf("staging.hulu.com") == -1))) || (!((host.indexOf("origin-qa-www.hulu.com") == -1))))) || (!((host.indexOf("www.qa.hulu.com") == -1))))){
  5537. smilHost = "http://www.qa.hulu.com/";
  5538. } else {
  5539. smilHost = host;
  5540. };
  5541. };
  5542. };
  5543. return (smilHost);
  5544. }
  5545. public static function playerHostFromClip(baseUrl:String):String{
  5546. var hostArray:Array = baseUrl.split("/");
  5547. var host = ([hostArray[0], hostArray[1], hostArray[2]].join("/") + "/");
  5548. var smilHost:String = "";
  5549. if (((!((host.indexOf("file://") == -1))) || (!((host.indexOf("demo.staging.hulu.com") == -1))))){
  5550. smilHost = "http://player.dev.hulu.com/";
  5551. } else {
  5552. if (((!((host.indexOf("www.hulu.com") == -1))) || (!((host.indexOf("origin-www.hulu.com") == -1))))){
  5553. smilHost = "http://player.hulu.com/";
  5554. } else {
  5555. if (((((!((host.indexOf("staging.hulu.com") == -1))) || (!((host.indexOf("origin-qa-www.hulu.com") == -1))))) || (!((host.indexOf("www.qa.hulu.com") == -1))))){
  5556. smilHost = "http://player.qa.hulu.com/";
  5557. } else {
  5558. smilHost = host;
  5559. };
  5560. };
  5561. };
  5562. return (smilHost);
  5563. }
  5564. public static function playerEnvFromClip(baseUrl:String):String{
  5565. var hostArray:Array = baseUrl.split("/");
  5566. var host = ([hostArray[0], hostArray[1], hostArray[2]].join("/") + "/");
  5567. var env:String = "";
  5568. if (((!((host.indexOf("file://") == -1))) || (!((host.indexOf("demo.staging.hulu.com") == -1))))){
  5569. env = "dev";
  5570. } else {
  5571. if (((!((host.indexOf("www.hulu.com") == -1))) || (!((host.indexOf("origin-www.hulu.com") == -1))))){
  5572. env = "prod";
  5573. } else {
  5574. if (((((!((host.indexOf("staging.hulu.com") == -1))) || (!((host.indexOf("origin-qa-www.hulu.com") == -1))))) || (!((host.indexOf("www.qa.hulu.com") == -1))))){
  5575. env = "qa";
  5576. } else {
  5577. env = "prod";
  5578. };
  5579. };
  5580. };
  5581. return (env);
  5582. }
  5583. public static function getBeaconHost(baseUrl:String):String{
  5584. if (baseUrl.indexOf("http://www.hulu.com") == 0){
  5585. return ("http://t2.hulu.com/v3/siteinteraction");
  5586. };
  5587. return ("http://t2.qa.hulu.com/v3/siteinteraction");
  5588. }
  5589. public static function getBeaconParams(type:String, linkUrl:String, mastheadItemId:String, salesforceid:String):String{
  5590. var type:* = type;
  5591. var linkUrl:* = linkUrl;
  5592. var mastheadItemId:* = mastheadItemId;
  5593. var salesforceid:* = salesforceid;
  5594. var param:* = [["param", type], ["target", linkUrl], ["computerguid", GUID.getComputerGuid()], ["cb", Math.random()]];
  5595. if (((!(!(salesforceid))) && ((salesforceid.indexOf("http://") < 0)))){
  5596. param.push(["salesforceid", escape(salesforceid)]);
  5597. };
  5598. if (!!(mastheadItemId)){
  5599. param.push(["mastheaditemid", mastheadItemId]);
  5600. };
  5601. param.forEach(function (e, idx, arr){
  5602. arr[idx] = e.join("=");
  5603. });
  5604. return (param.join("&"));
  5605. }
  5606. public static function deepCopy(source:Object){
  5607. var myBA:ByteArray = new ByteArray();
  5608. myBA.writeObject(source);
  5609. myBA.position = 0;
  5610. return (myBA.readObject());
  5611. }
  5612. public static function upidReplace(originalURL:String):String{
  5613. return (originalURL.replace("${upid}", Math.random()));
  5614. }
  5615. public static function callService(url:String){
  5616. var url:* = url;
  5617. var loader:* = new URLLoader();
  5618. var serviceRequest:* = new URLRequest(url);
  5619. loader.addEventListener(IOErrorEvent.IO_ERROR, function (event:IOErrorEvent){
  5620. trace(("ioErrorHandler: " + event));
  5621. });
  5622. loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (event:SecurityErrorEvent){
  5623. trace(("securityErrorHandler: " + event));
  5624. });
  5625. trace(("callService: " + url));
  5626. try {
  5627. loader.load(serviceRequest);
  5628. } catch(error:Error) {
  5629. trace(error);
  5630. };
  5631. }
  5632. public static function callServiceAndRun(url:String, callback:Function){
  5633. var url:* = url;
  5634. var callback:* = callback;
  5635. var loader:* = new URLLoader();
  5636. var serviceRequest:* = new URLRequest(url);
  5637. loader.addEventListener(IOErrorEvent.IO_ERROR, function (event:IOErrorEvent){
  5638. trace(("ioErrorHandler: " + event));
  5639. if (callback != null){
  5640. callback();
  5641. };
  5642. });
  5643. loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (event:SecurityErrorEvent){
  5644. trace(("securityErrorHandler: " + event));
  5645. if (callback != null){
  5646. callback();
  5647. };
  5648. });
  5649. if (callback != null){
  5650. loader.addEventListener(Event.OPEN, function (){
  5651. callback();
  5652. });
  5653. };
  5654. trace((("callServiceAndRun: " + url) + callback));
  5655. try {
  5656. loader.load(serviceRequest);
  5657. } catch(error:Error) {
  5658. trace(error);
  5659. if (callback != null){
  5660. callback();
  5661. };
  5662. };
  5663. }
  5664. public static function callServices(urls:Array, callback:Function){
  5665. var url:* = null;
  5666. var urls:* = urls;
  5667. var callback:* = callback;
  5668. if (urls.length > 0){
  5669. url = urls.shift();
  5670. callServiceAndRun(upidReplace(url), function (){
  5671. callServices(urls, callback);
  5672. });
  5673. } else {
  5674. callback();
  5675. };
  5676. }
  5677. public static function saveFSO(objname:String, field:String, val:Object){
  5678. var so:* = null;
  5679. var objname:* = objname;
  5680. var field:* = field;
  5681. var val:* = val;
  5682. if (disableFSO){
  5683. return;
  5684. };
  5685. SharedObject.defaultObjectEncoding = ObjectEncoding.AMF0;
  5686. try {
  5687. so = SharedObject.getLocal(objname, "/");
  5688. so.setProperty(field, val);
  5689. so.flush();
  5690. } catch(e) {
  5691. disableFSO = true;
  5692. };
  5693. }
  5694.  
  5695. }
  5696. }//package com.hulu.masthead.utils
  5697. package com.hulu.masthead.utils {
  5698. import flash.net.*;
  5699. import flash.system.*;
  5700.  
  5701. public class GUID {
  5702.  
  5703. public static var savedGUID:String;
  5704. static var counter = 0;
  5705. static var hexcase = 0;
  5706. static var b64pad = "";
  5707. static var chrsz = 8;
  5708.  
  5709. public static function getNewGUID(){
  5710. var _loc1:* = new Date();
  5711. var _loc4:* = _loc1.getTime();
  5712. var _loc3:* = (Math.random() * Number.MAX_VALUE);
  5713. var _loc2:* = Capabilities.serverString;
  5714. counter = ++GUID.counter;
  5715. return (GUID.hex_md5((((_loc4 + _loc2) + _loc3) + GUID.counter)).toUpperCase());
  5716. }
  5717. public static function getComputerGuid(){
  5718. var errorCode:* = undefined;
  5719. var so:* = null;
  5720. SharedObject.defaultObjectEncoding = ObjectEncoding.AMF0;
  5721. errorCode = "00000000000000000000000000000000";
  5722. try {
  5723. if (!savedGUID){
  5724. so = SharedObject.getLocal("BeaconService", "/");
  5725. savedGUID = so.data["computerguid"];
  5726. if (((!(savedGUID)) || (!((savedGUID.length == 32))))){
  5727. savedGUID = GUID.getNewGUID();
  5728. so.setProperty("computerguid", savedGUID);
  5729. so.flush();
  5730. };
  5731. };
  5732. } catch(e) {
  5733. savedGUID = errorCode;
  5734. };
  5735. return (savedGUID);
  5736. }
  5737. static function hex_md5(s){
  5738. return (GUID.binl2hex(GUID.core_md5(GUID.str2binl(s), (s.length * GUID.chrsz))));
  5739. }
  5740. static function b64_md5(s){
  5741. return (GUID.binl2b64(GUID.core_md5(GUID.str2binl(s), (s.length * GUID.chrsz))));
  5742. }
  5743. static function str_md5(s){
  5744. return (GUID.binl2str(GUID.core_md5(GUID.str2binl(s), (s.length * GUID.chrsz))));
  5745. }
  5746. static function hex_hmac_md5(key, data){
  5747. return (GUID.binl2hex(GUID.core_hmac_md5(key, data)));
  5748. }
  5749. static function b64_hmac_md5(key, data){
  5750. return (GUID.binl2b64(GUID.core_hmac_md5(key, data)));
  5751. }
  5752. static function str_hmac_md5(key, data){
  5753. return (GUID.binl2str(GUID.core_hmac_md5(key, data)));
  5754. }
  5755. static function md5_vm_test(){
  5756. return ((GUID.hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"));
  5757. }
  5758. static function core_md5(x, len){
  5759. var _loc10:*;
  5760. var _loc9:*;
  5761. var _loc8:*;
  5762. var _loc7:*;
  5763. x[(len >> 5)] = (x[(len >> 5)] | (128 << (len % 32)));
  5764. x[((((len + 64) >>> 9) << 4) + 14)] = len;
  5765. var _loc4:* = 1732584193;
  5766. var _loc3:* = -271733879;
  5767. var _loc2:* = -1732584194;
  5768. var _loc1:* = 271733878;
  5769. var _loc5:* = 0;
  5770. while (_loc5 < x.length) {
  5771. _loc10 = _loc4;
  5772. _loc9 = _loc3;
  5773. _loc8 = _loc2;
  5774. _loc7 = _loc1;
  5775. _loc4 = GUID.md5_ff(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 0)], 7, -680876936);
  5776. _loc1 = GUID.md5_ff(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 1)], 12, -389564586);
  5777. _loc2 = GUID.md5_ff(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 2)], 17, 606105819);
  5778. _loc3 = GUID.md5_ff(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 3)], 22, -1044525330);
  5779. _loc4 = GUID.md5_ff(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 4)], 7, -176418897);
  5780. _loc1 = GUID.md5_ff(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 5)], 12, 1200080426);
  5781. _loc2 = GUID.md5_ff(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 6)], 17, -1473231341);
  5782. _loc3 = GUID.md5_ff(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 7)], 22, -45705983);
  5783. _loc4 = GUID.md5_ff(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 8)], 7, 1770035416);
  5784. _loc1 = GUID.md5_ff(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 9)], 12, -1958414417);
  5785. _loc2 = GUID.md5_ff(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 10)], 17, -42063);
  5786. _loc3 = GUID.md5_ff(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 11)], 22, -1990404162);
  5787. _loc4 = GUID.md5_ff(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 12)], 7, 1804603682);
  5788. _loc1 = GUID.md5_ff(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 13)], 12, -40341101);
  5789. _loc2 = GUID.md5_ff(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 14)], 17, -1502002290);
  5790. _loc3 = GUID.md5_ff(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 15)], 22, 1236535329);
  5791. _loc4 = GUID.md5_gg(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 1)], 5, -165796510);
  5792. _loc1 = GUID.md5_gg(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 6)], 9, -1069501632);
  5793. _loc2 = GUID.md5_gg(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 11)], 14, 643717713);
  5794. _loc3 = GUID.md5_gg(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 0)], 20, -373897302);
  5795. _loc4 = GUID.md5_gg(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 5)], 5, -701558691);
  5796. _loc1 = GUID.md5_gg(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 10)], 9, 38016083);
  5797. _loc2 = GUID.md5_gg(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 15)], 14, -660478335);
  5798. _loc3 = GUID.md5_gg(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 4)], 20, -405537848);
  5799. _loc4 = GUID.md5_gg(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 9)], 5, 568446438);
  5800. _loc1 = GUID.md5_gg(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 14)], 9, -1019803690);
  5801. _loc2 = GUID.md5_gg(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 3)], 14, -187363961);
  5802. _loc3 = GUID.md5_gg(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 8)], 20, 1163531501);
  5803. _loc4 = GUID.md5_gg(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 13)], 5, -1444681467);
  5804. _loc1 = GUID.md5_gg(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 2)], 9, -51403784);
  5805. _loc2 = GUID.md5_gg(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 7)], 14, 1735328473);
  5806. _loc3 = GUID.md5_gg(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 12)], 20, -1926607734);
  5807. _loc4 = GUID.md5_hh(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 5)], 4, -378558);
  5808. _loc1 = GUID.md5_hh(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 8)], 11, -2022574463);
  5809. _loc2 = GUID.md5_hh(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 11)], 16, 1839030562);
  5810. _loc3 = GUID.md5_hh(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 14)], 23, -35309556);
  5811. _loc4 = GUID.md5_hh(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 1)], 4, -1530992060);
  5812. _loc1 = GUID.md5_hh(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 4)], 11, 1272893353);
  5813. _loc2 = GUID.md5_hh(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 7)], 16, -155497632);
  5814. _loc3 = GUID.md5_hh(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 10)], 23, -1094730640);
  5815. _loc4 = GUID.md5_hh(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 13)], 4, 681279174);
  5816. _loc1 = GUID.md5_hh(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 0)], 11, -358537222);
  5817. _loc2 = GUID.md5_hh(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 3)], 16, -722521979);
  5818. _loc3 = GUID.md5_hh(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 6)], 23, 76029189);
  5819. _loc4 = GUID.md5_hh(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 9)], 4, -640364487);
  5820. _loc1 = GUID.md5_hh(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 12)], 11, -421815835);
  5821. _loc2 = GUID.md5_hh(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 15)], 16, 530742520);
  5822. _loc3 = GUID.md5_hh(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 2)], 23, -995338651);
  5823. _loc4 = GUID.md5_ii(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 0)], 6, -198630844);
  5824. _loc1 = GUID.md5_ii(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 7)], 10, 1126891415);
  5825. _loc2 = GUID.md5_ii(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 14)], 15, -1416354905);
  5826. _loc3 = GUID.md5_ii(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 5)], 21, -57434055);
  5827. _loc4 = GUID.md5_ii(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 12)], 6, 1700485571);
  5828. _loc1 = GUID.md5_ii(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 3)], 10, -1894986606);
  5829. _loc2 = GUID.md5_ii(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 10)], 15, -1051523);
  5830. _loc3 = GUID.md5_ii(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 1)], 21, -2054922799);
  5831. _loc4 = GUID.md5_ii(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 8)], 6, 1873313359);
  5832. _loc1 = GUID.md5_ii(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 15)], 10, -30611744);
  5833. _loc2 = GUID.md5_ii(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 6)], 15, -1560198380);
  5834. _loc3 = GUID.md5_ii(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 13)], 21, 1309151649);
  5835. _loc4 = GUID.md5_ii(_loc4, _loc3, _loc2, _loc1, x[(_loc5 + 4)], 6, -145523070);
  5836. _loc1 = GUID.md5_ii(_loc1, _loc4, _loc3, _loc2, x[(_loc5 + 11)], 10, -1120210379);
  5837. _loc2 = GUID.md5_ii(_loc2, _loc1, _loc4, _loc3, x[(_loc5 + 2)], 15, 718787259);
  5838. _loc3 = GUID.md5_ii(_loc3, _loc2, _loc1, _loc4, x[(_loc5 + 9)], 21, -343485551);
  5839. _loc4 = GUID.safe_add(_loc4, _loc10);
  5840. _loc3 = GUID.safe_add(_loc3, _loc9);
  5841. _loc2 = GUID.safe_add(_loc2, _loc8);
  5842. _loc1 = GUID.safe_add(_loc1, _loc7);
  5843. _loc5 = (_loc5 + 16);
  5844. };
  5845. return (new Array(_loc4, _loc3, _loc2, _loc1));
  5846. }
  5847. static function md5_cmn(q, a, b, x, s, t){
  5848. return (GUID.safe_add(GUID.bit_rol(GUID.safe_add(GUID.safe_add(a, q), GUID.safe_add(x, t)), s), b));
  5849. }
  5850. static function md5_ff(a, b, c, d, x, s, t){
  5851. return (GUID.md5_cmn(((b & c) | (b ^ (0xFFFFFED8 & d))), a, b, x, s, t));
  5852. }
  5853. static function md5_gg(a, b, c, d, x, s, t){
  5854. return (GUID.md5_cmn(((b & d) | ((c & d) ^ 0xFFFFFED8)), a, b, x, s, t));
  5855. }
  5856. static function md5_hh(a, b, c, d, x, s, t){
  5857. return (GUID.md5_cmn(((b ^ c) ^ d), a, b, x, s, t));
  5858. }
  5859. static function md5_ii(a, b, c, d, x, s, t){
  5860. return (GUID.md5_cmn(((c ^ b) | (d ^ 0xFFFFFED8)), a, b, x, s, t));
  5861. }
  5862. static function core_hmac_md5(key, data){
  5863. var _loc2:* = GUID.str2binl(key);
  5864. if (_loc2.length > 16){
  5865. _loc2 = GUID.core_md5(_loc2, (key.length * GUID.chrsz));
  5866. };
  5867. var _loc3:* = new Array(16);
  5868. var _loc4:* = new Array(16);
  5869. var _loc1:* = 0;
  5870. while (_loc1 < 16) {
  5871. _loc3[_loc1] = (_loc2[_loc1] ^ 0x36363636);
  5872. _loc4[_loc1] = (_loc2[_loc1] ^ 0x5C5C5C5C);
  5873. _loc1++;
  5874. };
  5875. var _loc5:* = GUID.core_md5(_loc3.concat(GUID.str2binl(data)), (0x0200 + (data.length * GUID.chrsz)));
  5876. return (GUID.core_md5(_loc4.concat(_loc5), 640));
  5877. }
  5878. static function safe_add(x, y){
  5879. var _loc1:* = ((x & 0xFFFF) + (y & 0xFFFF));
  5880. var _loc2:* = (((x >> 16) + (y >> 16)) + (_loc1 >> 16));
  5881. return (((_loc2 << 16) | (_loc1 & 0xFFFF)));
  5882. }
  5883. static function bit_rol(num, cnt){
  5884. return (((num << cnt) | (num >>> (32 - cnt))));
  5885. }
  5886. static function str2binl(str){
  5887. var _loc3:* = new Array();
  5888. var _loc4:* = ((1 << GUID.chrsz) - 1);
  5889. var _loc1:* = 0;
  5890. while (_loc1 < (str.length * GUID.chrsz)) {
  5891. _loc3[(_loc1 >> 5)] = (_loc3[(_loc1 >> 5)] | ((str.charCodeAt((_loc1 / GUID.chrsz)) & _loc4) << (_loc1 % 32)));
  5892. _loc1 = (_loc1 + GUID.chrsz);
  5893. };
  5894. return (_loc3);
  5895. }
  5896. static function binl2str(bin){
  5897. var _loc3:* = "";
  5898. var _loc4:* = ((1 << GUID.chrsz) - 1);
  5899. var _loc1:* = 0;
  5900. while (_loc1 < (bin.length * 32)) {
  5901. _loc3 = (_loc3 + String.fromCharCode(((bin[(_loc1 >> 5)] >>> (_loc1 % 32)) & _loc4)));
  5902. _loc1 = (_loc1 + GUID.chrsz);
  5903. };
  5904. return (_loc3);
  5905. }
  5906. static function binl2hex(binarray){
  5907. var _loc3:* = ((GUID.hexcase) ? "0123456789ABCDEF" : "0123456789abcdef");
  5908. var _loc4:* = "";
  5909. var _loc1:* = 0;
  5910. while (_loc1 < (binarray.length * 4)) {
  5911. _loc4 = (_loc4 + (_loc3.charAt(((binarray[(_loc1 >> 2)] >> (((_loc1 % 4) * 8) + 4)) & 15)) + _loc3.charAt(((binarray[(_loc1 >> 2)] >> ((_loc1 % 4) * 8)) & 15))));
  5912. _loc1++;
  5913. };
  5914. return (_loc4);
  5915. }
  5916. static function binl2b64(binarray){
  5917. var _loc5:*;
  5918. var _loc1:*;
  5919. var _loc6:* = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
  5920. var _loc4:* = "";
  5921. var _loc2:* = 0;
  5922. while (_loc2 < (binarray.length * 4)) {
  5923. _loc5 = (((((binarray[(_loc2 >> 2)] >> (8 * (_loc2 % 4))) & 0xFF) << 16) | (((binarray[((_loc2 + 1) >> 2)] >> (8 * ((_loc2 + 1) % 4))) & 0xFF) << 8)) | ((binarray[((_loc2 + 2) >> 2)] >> (8 * ((_loc2 + 2) % 4))) & 0xFF));
  5924. _loc1 = 0;
  5925. while (_loc1 < 4) {
  5926. if (((_loc2 * 8) + (_loc1 * 6)) > (binarray.length * 32)){
  5927. _loc4 = (_loc4 + GUID.b64pad);
  5928. } else {
  5929. _loc4 = (_loc4 + _loc6.charAt(((_loc5 >> (6 * (3 - _loc1))) & 63)));
  5930. };
  5931. _loc1++;
  5932. };
  5933. _loc2 = (_loc2 + 3);
  5934. };
  5935. return (_loc4);
  5936. }
  5937.  
  5938. }
  5939. }//package com.hulu.masthead.utils
  5940. package com.hulu.masthead.controller {
  5941. import flash.display.*;
  5942. import flash.events.*;
  5943. import com.adobe.serialization.json.*;
  5944. import flash.net.*;
  5945. import fl.transitions.*;
  5946. import com.hulu.masthead.view.*;
  5947. import com.hulu.masthead.model.*;
  5948. import flash.utils.*;
  5949. import com.hulu.masthead.utils.*;
  5950. import fl.motion.easing.*;
  5951. import flash.external.*;
  5952.  
  5953. public class HuluCarousel extends Carousel {
  5954.  
  5955. public static var SCROLL_INTERVAL = 15000;
  5956.  
  5957. private var _animationTween1:Tween;
  5958. private var _animationTween2:Tween;
  5959. private var _animationTween3:Tween;
  5960. private var _animationTween4:Tween;
  5961. private var _extraImage:HuluImageItem;
  5962. private var _currentVideoEid:String;
  5963. public var autoScrollCounter:Array;
  5964. private var dataType:Array;
  5965.  
  5966. public function HuluCarousel(stage:Sprite, style:Object){
  5967. this.autoScrollCounter = [];
  5968. this.dataType = ["backgroundUrl", "description", "logoUrl", "imageUrl", "linkUrl", "title", "backgroundColor", "embed", "moreDescription", "moreLogoURL", "salesforcePlacementTag", "watchPageURL", "type", "collection_id", "playlist_id", "fsoName", "copyrightInfo", "showtime_movie_ids", "promotionBannerUrl", "mastheadItemId", "videoId", "showId"];
  5969. _section = ((stage.loaderInfo.parameters["section"])!=undefined) ? true : false;
  5970. super(stage, style);
  5971. }
  5972. override protected function setStageModel(){
  5973. _stageWidth = Math.max(_stage.stage.stageWidth, _style.Carousel.width);
  5974. _zeroOffset = ((_stage.stage.stageWidth - _style.Carousel.width) / 2);
  5975. _stageWidth = (_oldWidth = _stage.stage.stageWidth);
  5976. _stage.x = -(_zeroOffset);
  5977. _stage.stage.scaleMode = StageScaleMode.NO_SCALE;
  5978. _stage.addEventListener("imageResizeFinish", this.resize);
  5979. _stage.addEventListener("stopAutoScroll", this.stopAutoScroll);
  5980. _stage.stage.addEventListener(Event.RESIZE, this.onResize);
  5981. this.onResize(null);
  5982. }
  5983. private function getFeedbackInfoFromFSO(so:SharedObject, userId:Number):String{
  5984. var queue:Array;
  5985. var a:Array;
  5986. var o:Object;
  5987. var info:Object = so.data["userAdFeedback"];
  5988. if (((!((info == null))) && (!((info[userId] == null))))){
  5989. queue = info[userId];
  5990. a = new Array();
  5991. for each (o in queue) {
  5992. a.push(((o.id + ",") + o.score));
  5993. };
  5994. return (a.join("|"));
  5995. };
  5996. return ("");
  5997. }
  5998. private function getUserAdState(so:SharedObject, userId:Number):String{
  5999. var info:Object = so.data["userAdState"];
  6000. if (((!((info == null))) && (!((info[userId] == null))))){
  6001. return (info[userId]);
  6002. };
  6003. return ("");
  6004. }
  6005. private function getEnvironment():String{
  6006. if (ExternalInterface.call("function(){ return window.location.hostname;}") == "www.hulu.com"){
  6007. return ("prod");
  6008. };
  6009. trace("qa");
  6010. return ("qa");
  6011. }
  6012. private function getSiteSharedObject():SharedObject{
  6013. SharedObject.defaultObjectEncoding = ObjectEncoding.AMF0;
  6014. var so:SharedObject = SharedObject.getLocal("NewSitePlayer", "/");
  6015. so.objectEncoding = ObjectEncoding.AMF0;
  6016. return (so);
  6017. }
  6018. private function getQueryStringParameters():Object{
  6019. var parameterSplit:*;
  6020. var parameter:String;
  6021. var queryStringParameters:Object = {};
  6022. var queryString:String = ExternalInterface.call("function(){ return window.location.search.substring(1);}");
  6023. if (queryString != null){
  6024. for each (parameter in queryString.split("&")) {
  6025. parameter = parameter.replace(/^\s+|\s+$/gs, "");
  6026. parameterSplit = parameter.split("=");
  6027. queryStringParameters[unescape(parameterSplit[0])] = unescape(parameterSplit[1]);
  6028. };
  6029. };
  6030. return (queryStringParameters);
  6031. }
  6032. private function constructCerebroMastheadRequest(){
  6033. var queryStringParameters:Object;
  6034. var mastheadRequestXML:XML = new XML("<AdRequest></AdRequest>");
  6035. var distributor:XMLList = new XMLList("<Distributor></Distributor>");
  6036. var visitor:XMLList = new XMLList("<Visitor></Visitor>");
  6037. var keyValues:XMLList = new XMLList("<KeyValues></KeyValues>");
  6038. var siteLocation:XMLList = new XMLList("<SiteLocation><VideoPlayer><VideoAsset></VideoAsset></VideoPlayer></SiteLocation>");
  6039. var diagnostics:XMLList = new XMLList("<Diagnostics></Diagnostics>");
  6040. var currentUserConfig:UserConfig = UserConfig.getInstance();
  6041. mastheadRequestXML.@Pod = 0;
  6042. mastheadRequestXML.@ResponseType = "JSON";
  6043. distributor.@Name = "hulu";
  6044. distributor.@Platform = "hulu";
  6045. visitor.@ComputerGuid = GUID.getComputerGuid();
  6046. visitor.@PlanId = (currentUserConfig.getPlanId() as Number);
  6047. var userId:Number = (currentUserConfig.getUserId() as Number);
  6048. visitor.@UserId = userId;
  6049. var so:SharedObject = this.getSiteSharedObject();
  6050. visitor.@State = this.getUserAdState(so, userId);
  6051. visitor.@AdFeedback = this.getFeedbackInfoFromFSO(so, userId);
  6052. siteLocation.@Path = ("/Masthead/" + TYPE);
  6053. var environment:String = this.getEnvironment();
  6054. keyValues.appendChild(new XML((("<KeyValue Key=\"env\" Value=\"" + environment) + "\"></KeyValue>")));
  6055. keyValues.appendChild(new XML("<KeyValue Key=\"version\" Value=\"Voltron\"></KeyValue>"));
  6056. mastheadRequestXML.appendChild(distributor);
  6057. mastheadRequestXML.appendChild(visitor);
  6058. mastheadRequestXML.appendChild(keyValues);
  6059. mastheadRequestXML.appendChild(siteLocation);
  6060. if (environment != "prod"){
  6061. queryStringParameters = this.getQueryStringParameters();
  6062. if (queryStringParameters["overrideMastheadItems"] != null){
  6063. diagnostics.@MastheadItemIds = queryStringParameters["overrideMastheadItems"];
  6064. };
  6065. if (queryStringParameters["overrideAdUnits"] != null){
  6066. diagnostics.@AdUnitIds = queryStringParameters["overrideAdUnits"];
  6067. };
  6068. mastheadRequestXML.appendChild(diagnostics);
  6069. };
  6070. _urlRequest = new URLRequest("http://p.hulu.com/masthead");
  6071. _urlRequest.data = mastheadRequestXML;
  6072. _urlRequest.method = URLRequestMethod.POST;
  6073. }
  6074. override protected function attachEvents(){
  6075. var url:* = null;
  6076. var pageURL:* = null;
  6077. _smilHost = Utility.smilHostFromClip(_stage.loaderInfo.url);
  6078. AS3QuickPlayer.playerHost = _smilHost;
  6079. MovieShowTimeContainer.playerenv = (AS3QuickPlayer.playerEnv = Utility.playerEnvFromClip(_stage.loaderInfo.url));
  6080. ExternalInterface.addCallback("getTime", this.getTime);
  6081. ExternalInterface.addCallback("stopAnimation", this.stopAnimation);
  6082. ExternalInterface.addCallback("startAnimation", this.switchNextAutomatic);
  6083. ExternalInterface.addCallback("userLogin", this.userLogin);
  6084. if (_section){
  6085. TYPE = ((_stage.loaderInfo.parameters["section"]) || ("home"));
  6086. if (_stage.loaderInfo.parameters["useCerebro"] == "true"){
  6087. this.constructCerebroMastheadRequest();
  6088. } else {
  6089. url = _smilHost;
  6090. url = (url + "home/featured");
  6091. if (_stage.loaderInfo.parameters["section"]){
  6092. url = (url + ("/" + _stage.loaderInfo.parameters["section"]));
  6093. };
  6094. if (_stage.loaderInfo.parameters["local"] != null){
  6095. url = _stage.loaderInfo.parameters["local"];
  6096. };
  6097. if (UserConfig.getInstance().isPlusUser()){
  6098. url = (url + "?p=1");
  6099. };
  6100. _urlRequest = new URLRequest(url);
  6101. };
  6102. _urlLoader = new URLLoader();
  6103. _urlLoader.addEventListener(Event.COMPLETE, this.onComplete);
  6104. _urlLoader.addEventListener(IOErrorEvent.IO_ERROR, this.onError);
  6105. _urlLoader.addEventListener(NetStatusEvent.NET_STATUS, function (e){
  6106. });
  6107. _urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (e){
  6108. });
  6109. try {
  6110. _urlLoader.load(_urlRequest);
  6111. } catch(error) {
  6112. };
  6113. ExternalInterface.call("ready");
  6114. ExternalInterface.call("Masthead.ready");
  6115. } else {
  6116. pageURL = String(ExternalInterface.call("function(){ return location.href || window.location.href;}"));
  6117. if (pageURL.indexOf("http://") == 0){
  6118. TYPE = ((pageURL.split("http://")[1].split("/")[1]) || ("home"));
  6119. if (TYPE){
  6120. TYPE = TYPE.split("?")[0];
  6121. };
  6122. } else {
  6123. if (pageURL.indexOf("https://") == 0){
  6124. TYPE = ((pageURL.split("https://")[1].split("/")[1]) || ("home"));
  6125. if (TYPE){
  6126. TYPE = TYPE.split("?")[0];
  6127. };
  6128. };
  6129. };
  6130. super.attachEvents();
  6131. };
  6132. if (TYPE != null){
  6133. TYPE = TYPE.replace("/", "");
  6134. };
  6135. _stage.stage.addEventListener(Event.MOUSE_LEAVE, this.onMouseLeave);
  6136. }
  6137. private function onMouseLeave(event:Event){
  6138. this.observeMouseMove(false);
  6139. _stage.stage.addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
  6140. }
  6141. public function onMouseOver(event:Event){
  6142. _stage.stage.removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
  6143. if (!this.checkMousePos(null)){
  6144. this.observeMouseMove(true);
  6145. };
  6146. }
  6147. private function checkMousePos(event:MouseEvent){
  6148. if (_stage.stage.mouseY > 130){
  6149. this.observeMouseMove(false);
  6150. if (_stage.stage.mouseY < _stage.stage.height){
  6151. if (ExternalInterface.available){
  6152. ExternalInterface.call("ChannelDock.close");
  6153. };
  6154. };
  6155. } else {
  6156. return (false);
  6157. };
  6158. return (true);
  6159. }
  6160. public function observeMouseMove(val:Boolean){
  6161. if (val){
  6162. if (!_stage.stage.hasEventListener(MouseEvent.MOUSE_MOVE)){
  6163. _stage.stage.addEventListener(MouseEvent.MOUSE_MOVE, this.checkMousePos);
  6164. };
  6165. } else {
  6166. if (_stage.stage.hasEventListener(MouseEvent.MOUSE_MOVE)){
  6167. _stage.stage.removeEventListener(MouseEvent.MOUSE_MOVE, this.checkMousePos);
  6168. };
  6169. };
  6170. }
  6171. private function flushFSO(fso:SharedObject):void{
  6172. var fso:* = fso;
  6173. try {
  6174. fso.flush();
  6175. } catch(e) {
  6176. };
  6177. }
  6178. private function verifyItemByFsoName(item:Object):Boolean{
  6179. var fsoName:* = undefined;
  6180. var fso:* = undefined;
  6181. var now:* = NaN;
  6182. var token_birth:* = NaN;
  6183. var MAX_TOKEN_LIFE:* = NaN;
  6184. var userId:* = NaN;
  6185. var fsoType:* = null;
  6186. var token_life:* = NaN;
  6187. var item:* = item;
  6188. if (item.hasOwnProperty("fsoName")){
  6189. fsoName = item.fsoName.toUpperCase();
  6190. fso = SharedObject.getLocal(fsoName, "/");
  6191. now = new Date().valueOf();
  6192. token_birth = Number(fso.data.token_birth);
  6193. if (fsoName == "FPT"){
  6194. MAX_TOKEN_LIFE = (((48 * 60) * 60) * 1000);
  6195. if (((!(isNaN(token_birth))) && (((now - token_birth) < MAX_TOKEN_LIFE)))){
  6196. return (true);
  6197. };
  6198. } else {
  6199. if (fsoName.indexOf("USER_CAP_") != -1){
  6200. trace(("verifyItemByFsoName USER_CAP_ " + [UserConfig.getInstance().isUserLoggedIn]));
  6201. userId = UserConfig.getInstance().getUserId();
  6202. fsoType = fsoName.split("_CAP_")[1].split("_")[0];
  6203. token_life = ((((Number(fsoName.split("_CAP_")[1].split("_")[1]) * 24) * 60) * 60) * 1000);
  6204. trace(("verifyItemByFsoName userId " + [fso.data[userId]]));
  6205. if (fso.data.hasOwnProperty(userId)){
  6206. trace("1");
  6207. if (fso.data[userId].hasOwnProperty(fsoType)){
  6208. trace("2");
  6209. token_birth = Number(fso.data[userId][fsoType].token_birth);
  6210. if (((!(isNaN(token_birth))) && (((now - token_birth) > token_life)))){
  6211. trace("3");
  6212. fso.data[userId][fsoType].token_birth = now;
  6213. this.flushFSO(fso);
  6214. return (true);
  6215. };
  6216. trace("4");
  6217. return (false);
  6218. var _slot1:* = e;
  6219. trace("5");
  6220. fso.data[userId][fsoType].token_birth = now;
  6221. flushFSO(fso);
  6222. return (true);
  6223. };
  6224. trace("6");
  6225. fso.data[userId][fsoType] = {};
  6226. fso.data[userId][fsoType].token_birth = now;
  6227. this.flushFSO(fso);
  6228. return (true);
  6229. };
  6230. trace("7");
  6231. trace("verifyItemByFsoName -- no user id");
  6232. fso.data[userId] = {};
  6233. fso.data[userId][fsoType] = {};
  6234. fso.data[userId][fsoType].token_birth = now;
  6235. this.flushFSO(fso);
  6236. return (true);
  6237. };
  6238. };
  6239. return (false);
  6240. };
  6241. return (true);
  6242. }
  6243. private function verifyItems(itemsModel:Array):Array{
  6244. var item:Object;
  6245. var lowerCaseType:String;
  6246. var res:Array = [];
  6247. var i:int;
  6248. while (i < itemsModel.length) {
  6249. item = itemsModel[i];
  6250. if (!item.hasOwnProperty("type")){
  6251. item["type"] = "default";
  6252. };
  6253. if ((((item.swfType == "AnimatedSwf")) && ((item.imageUrl == null)))){
  6254. } else {
  6255. if (!this.verifyItemByFsoName(item)){
  6256. } else {
  6257. if (!this.verifyItembyLinkURL(item.linkUrl)){
  6258. } else {
  6259. lowerCaseType = item.type.toLowerCase();
  6260. if (lowerCaseType == "recommendation"){
  6261. res.push(item);
  6262. } else {
  6263. if (lowerCaseType == "collection"){
  6264. if (item.hasOwnProperty("collection_id")){
  6265. res.push(item);
  6266. };
  6267. } else {
  6268. if (lowerCaseType == "playlist"){
  6269. if (item.hasOwnProperty("playlist_id")){
  6270. res.push(item);
  6271. };
  6272. } else {
  6273. res.push(item);
  6274. };
  6275. };
  6276. };
  6277. };
  6278. };
  6279. };
  6280. i++;
  6281. };
  6282. return (res);
  6283. }
  6284. private function verifyItembyLinkURL(linkURL:String):Boolean{
  6285. var linkURL:* = linkURL;
  6286. if (((ExternalInterface.available) && (!((linkURL == null))))){
  6287. return (!(ExternalInterface.call("isIgnoredMasthead", linkURL)));
  6288. var _slot1:* = e;
  6289. };
  6290. return (true);
  6291. }
  6292. private function regularItems(itemsModel:Array){
  6293. var item:Object;
  6294. var url:String;
  6295. var baseURL:String;
  6296. var i:int;
  6297. while (i < itemsModel.length) {
  6298. item = itemsModel[i];
  6299. if (!item.hasOwnProperty("type")){
  6300. item["type"] = "default";
  6301. };
  6302. url = stage.loaderInfo.url;
  6303. baseURL = url.substr(0, url.search(/\/[^\/]*\.swf/));
  6304. trace(("HuluCarousel.regularItems: " + item.type));
  6305. switch (item.type.toLowerCase()){
  6306. case "recommendation":
  6307. item.imageUrl = (baseURL + "/ShowRecommendation.swf");
  6308. item.swfType = "ShowRecommendation";
  6309. break;
  6310. case "collection":
  6311. item.imageUrl = (baseURL + "/VideoRecommendationV2.swf");
  6312. item.swfType = "VideoRecommendation";
  6313. break;
  6314. case "playlist":
  6315. item.imageUrl = (baseURL + "/VideoRecommendationV3.swf");
  6316. item.swfType = "VideoRecommendation";
  6317. break;
  6318. case "hollywood":
  6319. item.imageUrl = (baseURL + "/HollywoodHeadlines.swf");
  6320. item.swfType = "HollywoodHeadlines";
  6321. break;
  6322. case "hollywood_playlist":
  6323. item.imageUrl = (baseURL + "/HollywoodHeadlinesV2.swf");
  6324. item.swfType = "HollywoodHeadlines";
  6325. break;
  6326. case "animationswf":
  6327. item.swfType = "AnimatedSwf";
  6328. break;
  6329. };
  6330. i++;
  6331. };
  6332. return (itemsModel);
  6333. }
  6334. override protected function onComplete(event:Event){
  6335. var str:* = undefined;
  6336. var ary:* = null;
  6337. var itemsModel:* = null;
  6338. var i:* = undefined;
  6339. var event:* = event;
  6340. if (_stage.loaderInfo.parameters["useCerebro"] == "true"){
  6341. this.onCompleteCerebro(event);
  6342. } else {
  6343. try {
  6344. str = event.target.data.split(/Masthead\.update\s*\(\s*\[\s*\{\s*/)[1].split(/\s*\}\s*\]\s*\)/)[0];
  6345. ary = str.split(/\}\s*,\s*\{/g);
  6346. itemsModel = [];
  6347. i = 0;
  6348. while (i < ary.length) {
  6349. itemsModel.push(this.stringToObject(ary[i]));
  6350. i = (i + 1);
  6351. };
  6352. itemsModel = this.regularItems(itemsModel);
  6353. itemsModel = this.verifyItems(itemsModel);
  6354. super.addCarouselItem(itemsModel);
  6355. this.preloadObjects(itemsModel);
  6356. } catch(e) {
  6357. trace(e.toString());
  6358. };
  6359. };
  6360. }
  6361. private function onCompleteCerebro(event:Event){
  6362. var str:* = undefined;
  6363. var ary:* = null;
  6364. var itemsModel:* = null;
  6365. var i:* = undefined;
  6366. var event:* = event;
  6367. try {
  6368. str = event.target.data.split(/Masthead\.update\s*\(/)[1].split(/\)\s*;/)[0];
  6369. ary = (JSON.decode(str, true) as Array);
  6370. itemsModel = [];
  6371. i = 0;
  6372. while (i < ary.length) {
  6373. itemsModel.push(this.postprocessMastheadItem(ary[i]));
  6374. i = (i + 1);
  6375. };
  6376. itemsModel = this.regularItems(itemsModel);
  6377. itemsModel = this.verifyItems(itemsModel);
  6378. super.addCarouselItem(itemsModel);
  6379. this.preloadObjects(itemsModel);
  6380. } catch(e) {
  6381. trace(e.toString());
  6382. };
  6383. }
  6384. override protected function addCarouselItem(itemsModel:Array){
  6385. itemsModel = this.regularItems(itemsModel);
  6386. itemsModel = this.verifyItems(itemsModel);
  6387. super.addCarouselItem(itemsModel);
  6388. this.preloadObjects(itemsModel);
  6389. }
  6390. override protected function onError(error:IOErrorEvent){
  6391. var error:* = error;
  6392. var timer:* = new Timer(2000, 1);
  6393. timer.addEventListener("timer", function (){
  6394. try {
  6395. _urlLoader.load(_urlRequest);
  6396. } catch(error) {
  6397. };
  6398. });
  6399. timer.start();
  6400. }
  6401. private function postprocessMastheadItem(mastheadItem:Object):Object{
  6402. var index:Number;
  6403. if (mastheadItem.hasOwnProperty("linkUrl")){
  6404. index = mastheadItem["linkUrl"].indexOf("javascript:");
  6405. if (index == 0){
  6406. mastheadItem["jscall"] = mastheadItem["linkUrl"].substring(11);
  6407. mastheadItem["linkUrl"] = "";
  6408. };
  6409. };
  6410. var url:String = stage.loaderInfo.url;
  6411. var baseURL:String = url.substr(0, url.search(/\/[^\/]*\.swf/));
  6412. if (((((mastheadItem["linkUrl"]) && (!((mastheadItem["linkUrl"].substr(0, 7) == "http://"))))) && (!((mastheadItem["linkUrl"].substr(0, 8) == "https://"))))){
  6413. mastheadItem["linkUrl"] = (baseURL + mastheadItem["linkUrl"]);
  6414. };
  6415. if (((((((mastheadItem["watchPageURL"]) && (!((mastheadItem["watchPageURL"].substr(0, 7) == "http://"))))) && (!((mastheadItem["linkUrl"].substr(0, 8) == "https://"))))) && (!(("null" == mastheadItem["watchPageURL"]))))){
  6416. mastheadItem["watchPageURL"] = (baseURL + mastheadItem["watchPageURL"]);
  6417. };
  6418. return (mastheadItem);
  6419. }
  6420. private function stringToObject(str:String):Object{
  6421. var d:* = undefined;
  6422. var str:* = str;
  6423. var unicodePattern:* = /\u([a-e,0-9,A-E]{1,4})/g;
  6424. var escPattern:* = /\\([\",\\,\',n,t,r,b,f])/g;
  6425. var unicodeRepFN:* = function (){
  6426. return (String.fromCharCode(parseInt(("0x" + arguments[1]))));
  6427. };
  6428. var escRepFN:* = function (){
  6429. switch (arguments[1]){
  6430. case "n":
  6431. return ("\n");
  6432. case "t":
  6433. return ("\t");
  6434. case "r":
  6435. return ("\r");
  6436. case "f":
  6437. return ("\f");
  6438. case "b":
  6439. return ("\b");
  6440. default:
  6441. return (arguments[1]);
  6442. };
  6443. };
  6444. var obj:* = new Object();
  6445. var ary:* = str.replace(/\\\"/g, "\\u0022").split("\"");
  6446. var aryLength:* = (ary.length - 1);
  6447. var i:* = 0;
  6448. while (i < aryLength) {
  6449. for each (d in this.dataType) {
  6450. if (ary[i].indexOf(d) != -1){
  6451. obj[d] = ary[(i + 1)];
  6452. obj[d] = obj[d].replace(unicodePattern, unicodeRepFN).replace(escPattern, escRepFN);
  6453. };
  6454. };
  6455. i = (i + 2);
  6456. };
  6457. this.postprocessMastheadItem(obj);
  6458. return (obj);
  6459. }
  6460. override protected function checkItemLength(itemsModel:Array):Array{
  6461. _totalItems = itemsModel.length;
  6462. if ((((itemsModel.length == 2)) || ((itemsModel.length == 3)))){
  6463. return (itemsModel.concat(itemsModel));
  6464. };
  6465. return (itemsModel);
  6466. }
  6467. override protected function createKeyArts(){
  6468. _itemsContainer = new HuluItemsContainer(this);
  6469. _imageItems = _itemsContainer.imageItems;
  6470. _sliderControl = new HuluSliderControl(this, _stage);
  6471. _sliderControl.addEventListener("stopAutoScroll", this.stopAutoScroll);
  6472. }
  6473. override protected function layoutObjects(){
  6474. if (_loadingClip){
  6475. layoutLoadingClip();
  6476. };
  6477. _itemDistance = Math.max(_style.ImageItem.width, (_stageWidth - (_style.SliderControl.buttonPaddingWidth * 2)));
  6478. _background.width = _stage.stage.stageWidth;
  6479. if (_foreground){
  6480. _foreground.width = _stage.stage.stageWidth;
  6481. };
  6482. }
  6483. override protected function addBackground(){
  6484. _stageWidth = Math.max(_stage.stage.stageWidth, _style.Carousel.width);
  6485. _background = new Sprite();
  6486. _loadingClip = new LoadingImage();
  6487. _stage.addChild(_background);
  6488. layoutLoadingClip();
  6489. var bg:ImageBackground = new ImageBackground();
  6490. bg.height = _style.ImageItem.height;
  6491. var grayStrip:GrayStrip = new GrayStrip();
  6492. grayStrip.y = (_style.Carousel.height - grayStrip.height);
  6493. _background.addChild(bg);
  6494. _background.addChild(grayStrip);
  6495. _background.width = _stage.stage.stageWidth;
  6496. _stage.addChild(_loadingClip);
  6497. }
  6498. override protected function addForeground(){
  6499. var topShadow:TopBottomShadow = new TopBottomShadow();
  6500. var bottomShadow:TopBottomShadow = new TopBottomShadow();
  6501. bottomShadow.rotation = 180;
  6502. bottomShadow.y = (_style.Carousel.height - _style.Carousel.baseGradientHeight);
  6503. bottomShadow.x = 1;
  6504. _foreground.addChild(topShadow);
  6505. _foreground.addChild(bottomShadow);
  6506. _foreground.mouseEnabled = false;
  6507. _foreground.mouseChildren = false;
  6508. }
  6509. override public function pageTo(id:Number, argu){
  6510. if (_currentPage == id){
  6511. return;
  6512. };
  6513. id = ((id + _totalPages) % _totalPages);
  6514. var newNextItemId:Number = ((id + 1) % _totalPages);
  6515. var newPrevItemId:Number = (((id - 1) + _totalPages) % _totalPages);
  6516. var nextItemId:Number = ((_currentPage + 1) % _totalPages);
  6517. var prevItemId:Number = (((_currentPage - 1) + _totalPages) % _totalPages);
  6518. _imageItems[prevItemId].visible = (_imageItems[_currentPage].visible = (_imageItems[nextItemId].visible = false));
  6519. _imageItems[newPrevItemId].visible = (_imageItems[id].visible = (_imageItems[newNextItemId].visible = true));
  6520. _imageItems[_currentPage].dispatchEvent(new Event("imageAnimationStop"));
  6521. if (this._extraImage){
  6522. this._extraImage = null;
  6523. };
  6524. showItems(id);
  6525. var currentX:Number = NaN;
  6526. var direction:Number = ((argu) || (((id - _currentPage) / Math.abs((id - _currentPage)))));
  6527. if (((!((this._animationTween1 == null))) && (this._animationTween1.isPlaying))){
  6528. this._extraImage = _imageItems[(((id - (2 * direction)) + _totalPages) % _totalPages)];
  6529. currentX = _imageItems[_currentPage].x;
  6530. if (Math.abs(currentX) > (_style.Carousel.leftMargin + _itemDistance)){
  6531. currentX = (currentX - (direction * _itemDistance));
  6532. };
  6533. this._animationTween1.fforward();
  6534. this._animationTween2.fforward();
  6535. this._animationTween3.fforward();
  6536. if (this._animationTween4){
  6537. this._animationTween4.fforward();
  6538. };
  6539. };
  6540. if (currentX){
  6541. _imageItems[id].x = (currentX + (_itemDistance * direction));
  6542. this._extraImage.visible = true;
  6543. this._extraImage.fadeOut(true);
  6544. this._extraImage.x = (currentX - (direction * _itemDistance));
  6545. } else {
  6546. _imageItems[id].x = (_imageItems[_currentPage].x + (_itemDistance * direction));
  6547. };
  6548. _imageItems[newPrevItemId].x = (_imageItems[id].x - _itemDistance);
  6549. _imageItems[newNextItemId].x = (_imageItems[id].x + _itemDistance);
  6550. _imageItems[id].fadeIn(true);
  6551. _imageItems[newNextItemId].fadeOut(true);
  6552. _imageItems[newPrevItemId].fadeOut(true);
  6553. if (((this._animationTween1) && (this._animationTween1.hasEventListener(TweenEvent.MOTION_FINISH)))){
  6554. this._animationTween1.removeEventListener(TweenEvent.MOTION_FINISH, this.redraw);
  6555. };
  6556. this._animationTween1 = new Tween(_imageItems[id], "x", Quartic.easeOut, _imageItems[id].x, _style.Carousel.leftMargin, 45);
  6557. this._animationTween2 = new Tween(_imageItems[newNextItemId], "x", Quartic.easeOut, _imageItems[newNextItemId].x, (_style.Carousel.leftMargin + _itemDistance), 45);
  6558. this._animationTween3 = new Tween(_imageItems[newPrevItemId], "x", Quartic.easeOut, _imageItems[newPrevItemId].x, (_style.Carousel.leftMargin - _itemDistance), 45);
  6559. if (this._extraImage){
  6560. this._animationTween4 = new Tween(this._extraImage, "x", Quartic.easeOut, this._extraImage.x, (_style.Carousel.leftMargin - ((2 * _itemDistance) * direction)), 45);
  6561. };
  6562. _currentPage = id;
  6563. this._animationTween1.addEventListener(TweenEvent.MOTION_FINISH, this.redraw);
  6564. _sliderControl.dispatchEvent(new Event("resetJumpBtns"));
  6565. }
  6566. private function redraw(e:TweenEvent):void{
  6567. _imageItems[_currentPage].redraw();
  6568. }
  6569. override public function switchNextAutomatic(){
  6570. if (_intvAutoscroll != -1){
  6571. clearInterval(_intvAutoscroll);
  6572. };
  6573. _intvAutoscroll = setInterval(function (){
  6574. pageTo((_currentPage + 1), 1);
  6575. }, SCROLL_INTERVAL);
  6576. }
  6577. override protected function stopAutoScroll(event:Event){
  6578. if (_intvAutoscroll == -1){
  6579. return;
  6580. };
  6581. clearInterval(_intvAutoscroll);
  6582. _intvAutoscroll = -1;
  6583. }
  6584. public function stopAnimation(){
  6585. this.stopAutoScroll(null);
  6586. }
  6587. private function onResize(event:Event){
  6588. _newWidth = _stage.stage.stageWidth;
  6589. _zeroOffset = (_zeroOffset + ((_newWidth - _oldWidth) / 2));
  6590. _stage.x = -(_zeroOffset);
  6591. _oldWidth = _newWidth;
  6592. _stageWidth = Math.max(_newWidth, _style.Carousel.width);
  6593. this.layoutObjects();
  6594. _stage.dispatchEvent(new Event("stageResize"));
  6595. }
  6596. override protected function resize(event:Event){
  6597. if (((this._animationTween1) && (this._animationTween1.isPlaying))){
  6598. this._animationTween1.fforward();
  6599. this._animationTween2.fforward();
  6600. this._animationTween3.fforward();
  6601. if (this._animationTween4){
  6602. this._animationTween4.fforward();
  6603. };
  6604. };
  6605. _sliderControl.dispatchEvent(new Event("resetJumpBtns"));
  6606. var imageDistance:* = Math.max(_style.ImageItem.width, (_stageWidth - (_style.Carousel.leftMargin * 2)));
  6607. _imageItems[_currentPage].x = _style.Carousel.leftMargin;
  6608. _imageItems[((_currentPage + 1) % _totalPages)].x = (_imageItems[currentPage].x + imageDistance);
  6609. _imageItems[(((_currentPage - 1) + _totalPages) % _totalPages)].x = (_imageItems[currentPage].x - imageDistance);
  6610. }
  6611. private function preloadObjects(itemsModel:Array):void{
  6612. if (_itemsContainer){
  6613. _itemsContainer.preloadObjects(itemsModel);
  6614. };
  6615. }
  6616.  
  6617. }
  6618. }//package com.hulu.masthead.controller
  6619. package com.hulu.masthead.controller {
  6620. import flash.display.*;
  6621. import flash.events.*;
  6622. import flash.net.*;
  6623. import com.hulu.masthead.view.*;
  6624. import flash.utils.*;
  6625. import flash.external.*;
  6626.  
  6627. public class Carousel {
  6628.  
  6629. public static var TYPE:String;
  6630.  
  6631. protected var _stage:Sprite;
  6632. protected var _itemsContainer;
  6633. protected var _sliderControl;
  6634. protected var _background:Sprite;
  6635. protected var _foreground:Sprite;
  6636. protected var _loadingClip;
  6637. protected var _imageItems:Array;
  6638. protected var _imageMask:Sprite;
  6639. protected var _style:Object;
  6640. protected var _urlRequest:URLRequest;
  6641. protected var _urlLoader:URLLoader;
  6642. protected var _intvAutoscroll:Number = -1;
  6643. protected var _intvReqJSON:Number = -1;
  6644. protected var _section:Boolean;
  6645. protected var _smilHost:String;
  6646. protected var _currentPage:Number = 0;
  6647. protected var _totalPages:Number = 5;
  6648. protected var _stageWidth:Number;
  6649. protected var _newWidth:Number;
  6650. protected var _oldWidth:Number;
  6651. protected var _zeroOffset:Number = 0;
  6652. protected var _itemDistance:Number;
  6653. protected var _totalItems:Number;
  6654.  
  6655. public function Carousel(stage:Sprite, style:Object){
  6656. super();
  6657. this._stage = stage;
  6658. this._style = style;
  6659. this.addBackground();
  6660. this.setStageModel();
  6661. this.attachEvents();
  6662. }
  6663. protected function setStageModel(){
  6664. }
  6665. public function createObjects(){
  6666. this.createKeyArts();
  6667. this._foreground = new Sprite();
  6668. this._stage.addChild(this._itemsContainer);
  6669. this._stage.addChild(this._sliderControl);
  6670. this._stage.addChild(this._foreground);
  6671. this.addForeground();
  6672. }
  6673. protected function createKeyArts(){
  6674. this._itemsContainer = new ItemsContainer(this);
  6675. this._imageItems = this._itemsContainer.imageItems;
  6676. this._sliderControl = new SliderControl(this, this._stage);
  6677. }
  6678. protected function addBackground(){
  6679. }
  6680. protected function addForeground(){
  6681. }
  6682. protected function layoutObjects(){
  6683. }
  6684. protected function layoutLoadingClip(){
  6685. this._loadingClip.x = (this._style.Carousel.leftMargin + (this._stageWidth / 2));
  6686. this._loadingClip.y = (this._style.Carousel.height / 2);
  6687. }
  6688. protected function attachEvents(){
  6689. ExternalInterface.addCallback("getTime", this.getTime);
  6690. ExternalInterface.addCallback("addCarouselItem", this.addCarouselItem);
  6691. ExternalInterface.addCallback("userLogin", this.userLogin);
  6692. if (ExternalInterface.available){
  6693. ExternalInterface.call("ready");
  6694. if (this._intvReqJSON != -1){
  6695. clearInterval(this._intvReqJSON);
  6696. this._intvReqJSON = -1;
  6697. };
  6698. ExternalInterface.call("Masthead.ready");
  6699. this._intvReqJSON = setInterval(function (){
  6700. ExternalInterface.call("Masthead.ready");
  6701. }, 2000);
  6702. };
  6703. }
  6704. protected function onComplete(event:Event){
  6705. }
  6706. protected function onError(event:IOErrorEvent){
  6707. trace("load failed");
  6708. }
  6709. protected function addCarouselItem(itemsModel:Array){
  6710. if ((((this._intvReqJSON == -1)) && ((this._section == false)))){
  6711. return;
  6712. };
  6713. clearInterval(this._intvReqJSON);
  6714. this._intvReqJSON = -1;
  6715. if (this._loadingClip){
  6716. this._stage.removeChild(this._loadingClip);
  6717. this._loadingClip = null;
  6718. };
  6719. itemsModel = this.checkItemLength(itemsModel);
  6720. this._totalPages = ((itemsModel.length - this._style.Carousel.visiblePages) + 1);
  6721. this.createObjects();
  6722. this.layoutObjects();
  6723. this._itemsContainer.addItems(itemsModel);
  6724. this.showItems(0);
  6725. if (this._totalPages > 1){
  6726. this.switchNextAutomatic();
  6727. this._sliderControl.enable();
  6728. } else {
  6729. this._sliderControl.disable();
  6730. };
  6731. }
  6732. protected function userLogin(id:Number=-1){
  6733. if (this._imageItems == null){
  6734. return;
  6735. };
  6736. var i:int;
  6737. while (i < this._imageItems.length) {
  6738. this._imageItems[i].userLogin(id);
  6739. i++;
  6740. };
  6741. this._itemsContainer.userLogin(id);
  6742. }
  6743. protected function getTime(){
  6744. var serverTimeLoader:* = new URLLoader();
  6745. var request:* = new URLRequest(("http://assets.hulu.com/time?" + Math.random()));
  6746. serverTimeLoader.addEventListener(Event.COMPLETE, this.completeHandler);
  6747. serverTimeLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.securityErrorHandler);
  6748. serverTimeLoader.addEventListener(IOErrorEvent.IO_ERROR, this.ioErrorHandler);
  6749. try {
  6750. serverTimeLoader.load(request);
  6751. } catch(error:Error) {
  6752. onServerTimeUnavailable();
  6753. };
  6754. }
  6755. protected function onServerTimeUnavailable(){
  6756. ExternalInterface.call("setServerTime", Math.round((new Date().getTime() / 1000)));
  6757. }
  6758. protected function completeHandler(event:Event):void{
  6759. var loader:URLLoader = URLLoader(event.target);
  6760. var serverTime:Number = parseInt(new XML(loader.data)["time"]);
  6761. if (isNaN(serverTime)){
  6762. this.onServerTimeUnavailable();
  6763. } else {
  6764. ExternalInterface.call("setServerTime", serverTime);
  6765. };
  6766. }
  6767. protected function securityErrorHandler(event:SecurityErrorEvent):void{
  6768. this.onServerTimeUnavailable();
  6769. }
  6770. protected function ioErrorHandler(event:IOErrorEvent):void{
  6771. this.onServerTimeUnavailable();
  6772. }
  6773. protected function checkItemLength(itemsModel:Array):Array{
  6774. this._totalItems = itemsModel.length;
  6775. return (itemsModel);
  6776. }
  6777. public function showItems(startpage:Number){
  6778. this._itemsContainer.show(startpage);
  6779. }
  6780. public function switchNextAutomatic(){
  6781. }
  6782. protected function stopAutoScroll(event:Event){
  6783. }
  6784. public function pageTo(id:Number, argu){
  6785. if (this._currentPage == id){
  6786. return;
  6787. };
  6788. trace(id);
  6789. this._currentPage = id;
  6790. }
  6791. protected function resize(event:Event){
  6792. }
  6793. public function get style(){
  6794. return (this._style);
  6795. }
  6796. public function get totalPages(){
  6797. return (this._totalPages);
  6798. }
  6799. public function get zeroOffset(){
  6800. return (this._zeroOffset);
  6801. }
  6802. public function get stageWidth(){
  6803. return (this._stageWidth);
  6804. }
  6805. public function get stage(){
  6806. return (this._stage);
  6807. }
  6808. public function get currentPage(){
  6809. return (this._currentPage);
  6810. }
  6811. public function get intvAutoscroll(){
  6812. return (this._intvAutoscroll);
  6813. }
  6814. public function get smilHost(){
  6815. return (this._smilHost);
  6816. }
  6817. public function get totalItems(){
  6818. return (this._totalItems);
  6819. }
  6820.  
  6821. }
  6822. }//package com.hulu.masthead.controller
  6823. package com.hulu.masthead.model {
  6824. import flash.display.*;
  6825. import flash.events.*;
  6826. import flash.net.*;
  6827. import flash.external.*;
  6828.  
  6829. public class UserConfig extends Sprite {
  6830.  
  6831. private static var _instance:UserConfig;
  6832.  
  6833. private var _config:Object;
  6834. private var _loader:URLLoader;
  6835.  
  6836. public function UserConfig(){
  6837. super();
  6838. trace("UserConfig.UserConfig");
  6839. this._config = null;
  6840. }
  6841. public static function getInstance():UserConfig{
  6842. if (_instance == null){
  6843. _instance = new (UserConfig)();
  6844. };
  6845. return (_instance);
  6846. }
  6847.  
  6848. public function loadUserConfig(){
  6849. trace("UserConfig.loadUserConfig");
  6850. var url:* = ("http://www.hulu.com/users/age_check/" + this.getUserId());
  6851. var request:* = new URLRequest(url);
  6852. if (this._loader != null){
  6853. this._loader.close();
  6854. this._loader.removeEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  6855. this._loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
  6856. this._loader.removeEventListener(Event.COMPLETE, this.loaderCompleteHandler);
  6857. };
  6858. this._loader = new URLLoader();
  6859. this._loader.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  6860. this._loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
  6861. this._loader.addEventListener(Event.COMPLETE, this.loaderCompleteHandler);
  6862. try {
  6863. this._loader.load(request);
  6864. } catch(e) {
  6865. errorHandler(null);
  6866. };
  6867. }
  6868. private function errorHandler(e):void{
  6869. trace("UserConfig.errorHandler");
  6870. this._config = {ao:"not-ok"};
  6871. dispatchEvent(new Event("userConfigReady"));
  6872. }
  6873. private function loaderCompleteHandler(event:Event):void{
  6874. var xml:* = undefined;
  6875. var event:* = event;
  6876. trace(("UserConfig.loaderCompleteHandler " + this._loader.data));
  6877. try {
  6878. xml = new XML(this._loader.data);
  6879. this._config = {};
  6880. this._config.ao = xml["ao"];
  6881. } catch(e:TypeError) {
  6882. };
  6883. dispatchEvent(new Event("userConfigReady"));
  6884. }
  6885. public function get userConfigAvailable():Boolean{
  6886. return (!((this._config == null)));
  6887. }
  6888. public function get allowMatureContent():Boolean{
  6889. if (this._config.ao == "ok"){
  6890. return (true);
  6891. };
  6892. return (false);
  6893. _slot1 = e;
  6894. return (false);
  6895. }
  6896. public function get isUserLoggedIn():Boolean{
  6897. return ((this.getUserId() > 0));
  6898. }
  6899. public function getUserId(){
  6900. var uid:* = ExternalInterface.call("getUserId");
  6901. if ((((typeof(uid) == "undefined")) || ((uid <= 0)))){
  6902. uid = -1;
  6903. };
  6904. return (uid);
  6905. }
  6906. public function getPlanId(){
  6907. var planId:* = ExternalInterface.call("getUserPlanId");
  6908. if ((((typeof(planId) == "undefined")) || ((planId <= 0)))){
  6909. planId = -1;
  6910. };
  6911. return (planId);
  6912. }
  6913. public function isPlusUser():Boolean{
  6914. return (ExternalInterface.call("Behaviors.isPlusUser"));
  6915. _slot1 = e;
  6916. return (false);
  6917. }
  6918.  
  6919. }
  6920. }//package com.hulu.masthead.model
  6921. package com.hulu.masthead.model {
  6922.  
  6923. public class CompanionItem {
  6924.  
  6925. public var isMatureRated:Boolean;
  6926. public var logoURL:String = "";
  6927. public var watchNowOverride:String = null;
  6928. public var width:Number = 185;
  6929. public var height:Number = 50;
  6930. public var impressionURLs:Array;
  6931. public var clickThroughURLs:Array;
  6932. public var sponsorTargetURL:String = "";
  6933. public var placementId:String = "";
  6934. public var targetingId:String = "";
  6935. public var brandGroupId:String = null;
  6936. public var duration:Number = -1;
  6937.  
  6938. public function CompanionItem(xmlData:XML){
  6939. var item:XML;
  6940. var settingsList:XMLList;
  6941. this.impressionURLs = [];
  6942. this.clickThroughURLs = [];
  6943. super();
  6944. trace(("CompanionItem.CompanionItem " + xmlData["Settings"]));
  6945. this.logoURL = ((this.logoURL) || (xmlData["URL"]));
  6946. this.isMatureRated = false;
  6947. if (((xmlData["Settings"]) && (xmlData["Settings"]["Rated"]))){
  6948. if (xmlData["Settings"]["Rated"].toString().toLowerCase().indexOf("mature") != -1){
  6949. this.isMatureRated = true;
  6950. };
  6951. };
  6952. if (((xmlData["Settings"]) && (xmlData["Settings"].hasOwnProperty("BrandGroupId")))){
  6953. this.brandGroupId = xmlData["Settings"]["BrandGroupId"];
  6954. };
  6955. if (((xmlData["Settings"]) && (xmlData["Settings"].hasOwnProperty("WatchNowOverride")))){
  6956. trace("CompanionItem.CompanionItem 1");
  6957. trace(xmlData["Settings"]["WatchNowOverride"]);
  6958. this.watchNowOverride = xmlData["Settings"]["WatchNowOverride"];
  6959. };
  6960. this.width = ((xmlData.attribute("width")) || (this.width));
  6961. this.height = ((xmlData.attribute("height")) || (this.height));
  6962. if (xmlData["Impression"]){
  6963. for each (item in xmlData["Impression"].children()) {
  6964. this.impressionURLs.push(item.toString());
  6965. };
  6966. };
  6967. if (xmlData["TrackingEvents"]){
  6968. for each (item in xmlData["TrackingEvents"].children()) {
  6969. if (((item["URL"]) && ((item["URL"].toString().indexOf("http") == 0)))){
  6970. this.clickThroughURLs.push(item["URL"].toString());
  6971. };
  6972. };
  6973. };
  6974. if (xmlData["CompanionClickThrough"]){
  6975. this.sponsorTargetURL = ((xmlData["CompanionClickThrough"]["URL"].toString()) || (this.sponsorTargetURL));
  6976. };
  6977. if (xmlData["Settings"]){
  6978. settingsList = xmlData["Settings"];
  6979. this.targetingId = ((settingsList["TargetingId"]) || (this.targetingId));
  6980. this.placementId = ((settingsList["PlacementId"]) || (this.placementId));
  6981. this.duration = ((parseFloat(settingsList["Rotation"])) || (this.duration));
  6982. if (((UserConfig.getInstance().isPlusUser()) && (!(isNaN(parseFloat(settingsList["PlusRotation"])))))){
  6983. this.duration = parseFloat(settingsList["PlusRotation"]);
  6984. };
  6985. };
  6986. }
  6987. }
  6988. }//package com.hulu.masthead.model
  6989. package com.hulu.masthead.model {
  6990.  
  6991. public class Style {
  6992.  
  6993. public static var Carousel:Object = {
  6994. width:0,
  6995. height:0,
  6996. visiblePages:0,
  6997. gutterWidth:0,
  6998. leftMargin:0
  6999. };
  7000. public static var SliderControl:Object = {
  7001. buttonPaddingWidth:0,
  7002. buttonPaddingHeight:0,
  7003. buttonLeftMargin:0,
  7004. buttonHeaderMargin:0
  7005. };
  7006. public static var ImageItem:Object = {
  7007. width:0,
  7008. height:0
  7009. };
  7010.  
  7011. }
  7012. }//package com.hulu.masthead.model
  7013. package com.hulu.masthead.model {
  7014. import flash.events.*;
  7015. import flash.net.*;
  7016.  
  7017. public class MastheadXML {
  7018.  
  7019. private var _callback:Function;
  7020. private var externalXML:XML;
  7021. private var loader:URLLoader;
  7022.  
  7023. public function MastheadXML(url:String, callback:Function){
  7024. var url:* = url;
  7025. var callback:* = callback;
  7026. super();
  7027. trace(("MastheadXML.MastheadXML " + url));
  7028. this._callback = callback;
  7029. var request:* = new URLRequest(url);
  7030. this.loader = new URLLoader();
  7031. try {
  7032. this.loader.load(request);
  7033. } catch(e) {
  7034. errorHandler(null);
  7035. };
  7036. this.loader.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
  7037. this.loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.errorHandler);
  7038. this.loader.addEventListener(Event.COMPLETE, this.loaderCompleteHandler);
  7039. }
  7040. private function loaderCompleteHandler(event:Event):void{
  7041. var event:* = event;
  7042. try {
  7043. this.externalXML = new XML(this.loader.data);
  7044. this.readNodes(this.externalXML);
  7045. } catch(e:TypeError) {
  7046. trace(("Could not parse the XML file." + e));
  7047. _callback(null);
  7048. };
  7049. }
  7050. private function readNodes(node:XML):void{
  7051. var item:* = null;
  7052. var contentList:* = null;
  7053. var companionItem:* = null;
  7054. var node:* = node;
  7055. try {
  7056. contentList = node.Ad.InLine.CompanionAds.elements();
  7057. } catch(e) {
  7058. trace(e);
  7059. };
  7060. var companionItems:* = [];
  7061. for each (item in contentList) {
  7062. companionItem = new CompanionItem(item);
  7063. if (companionItem.duration > 0){
  7064. companionItems.push(companionItem);
  7065. };
  7066. };
  7067. this._callback(companionItems);
  7068. }
  7069. private function errorHandler(e):void{
  7070. trace("Could not access the XML file.");
  7071. this._callback(null);
  7072. }
  7073.  
  7074. }
  7075. }//package com.hulu.masthead.model
  7076. package com.hulu.masthead.model {
  7077.  
  7078. public final class HuluStyle extends Style {
  7079.  
  7080. public var Carousel:Object;
  7081. public var SliderControl:Object;
  7082. public var ImageItem:Object;
  7083. public var DetailsOverlay:Object;
  7084. public var QuickPlayer:Object;
  7085.  
  7086. public function HuluStyle(){
  7087. this.Carousel = {
  7088. width:920,
  7089. height:377,
  7090. visiblePages:1,
  7091. gutterWidth:0,
  7092. leftMargin:60,
  7093. baseGradientHeight:27
  7094. };
  7095. this.SliderControl = {
  7096. buttonPaddingWidth:60,
  7097. buttonPaddingHeight:350,
  7098. buttonLeftMargin:30,
  7099. buttonHeaderMargin:175
  7100. };
  7101. this.ImageItem = {
  7102. width:800,
  7103. height:350,
  7104. jumpBtnMargin:20
  7105. };
  7106. this.DetailsOverlay = {
  7107. borderWidth:234,
  7108. logoWidth:204,
  7109. rightMargin:25,
  7110. bottomMargin:25,
  7111. logoTopMargin:25,
  7112. logoLeftMargin:15,
  7113. logoRightMargin:15,
  7114. logoHeaderMargin:20,
  7115. headerCaptionMargin:4,
  7116. captionWatchBtnMargin:10,
  7117. watchBtnRightMargin:15,
  7118. textLeftMargin:24,
  7119. textRightMargin:15,
  7120. titleFontSize:15,
  7121. captionFontSize:13,
  7122. salesLogoHeight:60,
  7123. promoPadding:5
  7124. };
  7125. this.QuickPlayer = {
  7126. backgroundColor:0x222222,
  7127. backgroundAlpha:0.9,
  7128. playerWidth:0x0200,
  7129. playerHeight:288,
  7130. playerMarginBottom:34,
  7131. playerMarginTop:20,
  7132. closeBtnRightMargin:25,
  7133. closeBtnTopMargin:10,
  7134. playButtonWidth:94,
  7135. playButtonHeight:82
  7136. };
  7137. super();
  7138. }
  7139. }
  7140. }//package com.hulu.masthead.model
  7141. package com.adobe.serialization.json {
  7142.  
  7143. public class JSONToken {
  7144.  
  7145. private var _type:int;
  7146. private var _value:Object;
  7147.  
  7148. public function JSONToken(type:int=-1, value:Object=null){
  7149. super();
  7150. this._type = type;
  7151. this._value = value;
  7152. }
  7153. public function get type():int{
  7154. return (this._type);
  7155. }
  7156. public function set type(value:int):void{
  7157. this._type = value;
  7158. }
  7159. public function get value():Object{
  7160. return (this._value);
  7161. }
  7162. public function set value(v:Object):void{
  7163. this._value = v;
  7164. }
  7165.  
  7166. }
  7167. }//package com.adobe.serialization.json
  7168. package com.adobe.serialization.json {
  7169.  
  7170. public class JSONDecoder {
  7171.  
  7172. private var strict:Boolean;
  7173. private var value;
  7174. private var tokenizer:JSONTokenizer;
  7175. private var token:JSONToken;
  7176.  
  7177. public function JSONDecoder(s:String, strict:Boolean){
  7178. super();
  7179. this.strict = strict;
  7180. this.tokenizer = new JSONTokenizer(s, strict);
  7181. this.nextToken();
  7182. this.value = this.parseValue();
  7183. if (((strict) && (!((this.nextToken() == null))))){
  7184. this.tokenizer.parseError("Unexpected characters left in input stream");
  7185. };
  7186. }
  7187. public function getValue(){
  7188. return (this.value);
  7189. }
  7190. private function nextToken():JSONToken{
  7191. return ((this.token = this.tokenizer.getNextToken()));
  7192. }
  7193. private function parseArray():Array{
  7194. var a:Array = new Array();
  7195. this.nextToken();
  7196. if (this.token.type == JSONTokenType.RIGHT_BRACKET){
  7197. return (a);
  7198. };
  7199. if (((!(this.strict)) && ((this.token.type == JSONTokenType.COMMA)))){
  7200. this.nextToken();
  7201. if (this.token.type == JSONTokenType.RIGHT_BRACKET){
  7202. return (a);
  7203. };
  7204. this.tokenizer.parseError(("Leading commas are not supported. Expecting ']' but found " + this.token.value));
  7205. };
  7206. a.push(this.parseValue());
  7207. this.nextToken();
  7208. if (this.token.type == JSONTokenType.RIGHT_BRACKET){
  7209. return (a);
  7210. };
  7211. if (this.token.type == JSONTokenType.COMMA){
  7212. this.nextToken();
  7213. if (!this.strict){
  7214. if (this.token.type == JSONTokenType.RIGHT_BRACKET){
  7215. return (a);
  7216. };
  7217. };
  7218. } else {
  7219. this.tokenizer.parseError(("Expecting ] or , but found " + this.token.value));
  7220. };
  7221. //unresolved jump
  7222. }
  7223. private function parseObject():Object{
  7224. var key:String;
  7225. var o:Object = new Object();
  7226. this.nextToken();
  7227. if (this.token.type == JSONTokenType.RIGHT_BRACE){
  7228. return (o);
  7229. };
  7230. if (((!(this.strict)) && ((this.token.type == JSONTokenType.COMMA)))){
  7231. this.nextToken();
  7232. if (this.token.type == JSONTokenType.RIGHT_BRACE){
  7233. return (o);
  7234. };
  7235. this.tokenizer.parseError(("Leading commas are not supported. Expecting '}' but found " + this.token.value));
  7236. };
  7237. if (this.token.type == JSONTokenType.STRING){
  7238. key = String(this.token.value);
  7239. this.nextToken();
  7240. if (this.token.type == JSONTokenType.COLON){
  7241. this.nextToken();
  7242. o[key] = this.parseValue();
  7243. this.nextToken();
  7244. if (this.token.type == JSONTokenType.RIGHT_BRACE){
  7245. return (o);
  7246. };
  7247. if (this.token.type == JSONTokenType.COMMA){
  7248. this.nextToken();
  7249. if (!this.strict){
  7250. if (this.token.type == JSONTokenType.RIGHT_BRACE){
  7251. return (o);
  7252. };
  7253. };
  7254. } else {
  7255. this.tokenizer.parseError(("Expecting } or , but found " + this.token.value));
  7256. };
  7257. } else {
  7258. this.tokenizer.parseError(("Expecting : but found " + this.token.value));
  7259. };
  7260. } else {
  7261. this.tokenizer.parseError(("Expecting string but found " + this.token.value));
  7262. };
  7263. //unresolved jump
  7264. }
  7265. private function parseValue():Object{
  7266. if (this.token == null){
  7267. this.tokenizer.parseError("Unexpected end of input");
  7268. };
  7269. switch (this.token.type){
  7270. case JSONTokenType.LEFT_BRACE:
  7271. return (this.parseObject());
  7272. case JSONTokenType.LEFT_BRACKET:
  7273. return (this.parseArray());
  7274. case JSONTokenType.STRING:
  7275. case JSONTokenType.NUMBER:
  7276. case JSONTokenType.TRUE:
  7277. case JSONTokenType.FALSE:
  7278. case JSONTokenType.NULL:
  7279. return (this.token.value);
  7280. case JSONTokenType.NAN:
  7281. if (!this.strict){
  7282. return (this.token.value);
  7283. };
  7284. this.tokenizer.parseError(("Unexpected " + this.token.value));
  7285. default:
  7286. this.tokenizer.parseError(("Unexpected " + this.token.value));
  7287. };
  7288. return (null);
  7289. }
  7290.  
  7291. }
  7292. }//package com.adobe.serialization.json
  7293. package com.adobe.serialization.json {
  7294.  
  7295. public class JSONTokenType {
  7296.  
  7297. public static const UNKNOWN:int = -1;
  7298. public static const COMMA:int = 0;
  7299. public static const LEFT_BRACE:int = 1;
  7300. public static const RIGHT_BRACE:int = 2;
  7301. public static const LEFT_BRACKET:int = 3;
  7302. public static const RIGHT_BRACKET:int = 4;
  7303. public static const COLON:int = 6;
  7304. public static const TRUE:int = 7;
  7305. public static const FALSE:int = 8;
  7306. public static const NULL:int = 9;
  7307. public static const STRING:int = 10;
  7308. public static const NUMBER:int = 11;
  7309. public static const NAN:int = 12;
  7310.  
  7311. }
  7312. }//package com.adobe.serialization.json
  7313. package com.adobe.serialization.json {
  7314.  
  7315. public class JSON {
  7316.  
  7317. public static function encode(o:Object):String{
  7318. return (new JSONEncoder(o).getString());
  7319. }
  7320. public static function decode(s:String, strict:Boolean=true){
  7321. return (new JSONDecoder(s, strict).getValue());
  7322. }
  7323.  
  7324. }
  7325. }//package com.adobe.serialization.json
  7326. package com.adobe.serialization.json {
  7327. import flash.utils.*;
  7328.  
  7329. public class JSONEncoder {
  7330.  
  7331. private var jsonString:String;
  7332.  
  7333. public function JSONEncoder(value){
  7334. super();
  7335. this.jsonString = this.convertToString(value);
  7336. }
  7337. public function getString():String{
  7338. return (this.jsonString);
  7339. }
  7340. private function convertToString(value):String{
  7341. if ((value is String)){
  7342. return (this.escapeString((value as String)));
  7343. };
  7344. if ((value is Number)){
  7345. return (((isFinite((value as Number))) ? value.toString() : "null"));
  7346. };
  7347. if ((value is Boolean)){
  7348. return (((value) ? "true" : "false"));
  7349. };
  7350. if ((value is Array)){
  7351. return (this.arrayToString((value as Array)));
  7352. };
  7353. if ((((value is Object)) && (!((value == null))))){
  7354. return (this.objectToString(value));
  7355. };
  7356. return ("null");
  7357. }
  7358. private function escapeString(str:String):String{
  7359. var ch:String;
  7360. var hexCode:String;
  7361. var zeroPad:String;
  7362. var s:String = "";
  7363. var len:Number = str.length;
  7364. var i:int;
  7365. while (i < len) {
  7366. ch = str.charAt(i);
  7367. switch (ch){
  7368. case "\"":
  7369. s = (s + "\\\"");
  7370. break;
  7371. case "\\":
  7372. s = (s + "\\\\");
  7373. break;
  7374. case "\b":
  7375. s = (s + "\\b");
  7376. break;
  7377. case "\f":
  7378. s = (s + "\\f");
  7379. break;
  7380. case "\n":
  7381. s = (s + "\\n");
  7382. break;
  7383. case "\r":
  7384. s = (s + "\\r");
  7385. break;
  7386. case "\t":
  7387. s = (s + "\\t");
  7388. break;
  7389. default:
  7390. if (ch < " "){
  7391. hexCode = ch.charCodeAt(0).toString(16);
  7392. zeroPad = (((hexCode.length == 2)) ? "00" : "000");
  7393. s = (s + (("\\u" + zeroPad) + hexCode));
  7394. } else {
  7395. s = (s + ch);
  7396. };
  7397. };
  7398. i++;
  7399. };
  7400. return ((("\"" + s) + "\""));
  7401. }
  7402. private function arrayToString(a:Array):String{
  7403. var s:String = "";
  7404. var i:int;
  7405. while (i < a.length) {
  7406. if (s.length > 0){
  7407. s = (s + ",");
  7408. };
  7409. s = (s + this.convertToString(a[i]));
  7410. i++;
  7411. };
  7412. return ((("[" + s) + "]"));
  7413. }
  7414. private function objectToString(o:Object):String{
  7415. var value:* = null;
  7416. var key:* = null;
  7417. var v:* = null;
  7418. var o:* = o;
  7419. var s:* = "";
  7420. var classInfo:* = describeType(o);
  7421. if (classInfo.@name.toString() == "Object"){
  7422. for (key in o) {
  7423. value = o[key];
  7424. if ((value is Function)){
  7425. } else {
  7426. if (s.length > 0){
  7427. s = (s + ",");
  7428. };
  7429. s = (s + ((this.escapeString(key) + ":") + this.convertToString(value)));
  7430. };
  7431. };
  7432. } else {
  7433. var _local3:int;
  7434. var _local6:int;
  7435. var _local7:* = classInfo..*;
  7436. var _local5 = new XMLList("");
  7437. for each (var _local8 in classInfo..*) {
  7438. var _local9 = _local8;
  7439. with (_local9) {
  7440. if ((((name() == "variable")) || ((((name() == "accessor")) && ((attribute("access").charAt(0) == "r")))))){
  7441. _local5[_local6] = _local8;
  7442. };
  7443. };
  7444. };
  7445. var _local4:* = _local5;
  7446. for each (v in _local5) {
  7447. if (((v.metadata) && ((v.metadata.(@name == "Transient").length() > 0)))){
  7448. } else {
  7449. if (s.length > 0){
  7450. s = (s + ",");
  7451. };
  7452. s = (s + ((this.escapeString(v.@name.toString()) + ":") + this.convertToString(o[v.@name])));
  7453. };
  7454. };
  7455. };
  7456. return ((("{" + s) + "}"));
  7457. }
  7458.  
  7459. }
  7460. }//package com.adobe.serialization.json
  7461. package com.adobe.serialization.json {
  7462.  
  7463. public class JSONTokenizer {
  7464.  
  7465. private var strict:Boolean;
  7466. private var obj:Object;
  7467. private var jsonString:String;
  7468. private var loc:int;
  7469. private var ch:String;
  7470. private var controlCharsRegExp:RegExp;
  7471.  
  7472. public function JSONTokenizer(s:String, strict:Boolean){
  7473. this.controlCharsRegExp = /[\x00-\x1F]/;
  7474. super();
  7475. this.jsonString = s;
  7476. this.strict = strict;
  7477. this.loc = 0;
  7478. this.nextChar();
  7479. }
  7480. public function getNextToken():JSONToken{
  7481. var _local2:String;
  7482. var _local3:String;
  7483. var _local4:String;
  7484. var _local5:String;
  7485. var token:JSONToken = new JSONToken();
  7486. this.skipIgnored();
  7487. switch (this.ch){
  7488. case "{":
  7489. token.type = JSONTokenType.LEFT_BRACE;
  7490. token.value = "{";
  7491. this.nextChar();
  7492. break;
  7493. case "}":
  7494. token.type = JSONTokenType.RIGHT_BRACE;
  7495. token.value = "}";
  7496. this.nextChar();
  7497. break;
  7498. case "[":
  7499. token.type = JSONTokenType.LEFT_BRACKET;
  7500. token.value = "[";
  7501. this.nextChar();
  7502. break;
  7503. case "]":
  7504. token.type = JSONTokenType.RIGHT_BRACKET;
  7505. token.value = "]";
  7506. this.nextChar();
  7507. break;
  7508. case ",":
  7509. token.type = JSONTokenType.COMMA;
  7510. token.value = ",";
  7511. this.nextChar();
  7512. break;
  7513. case ":":
  7514. token.type = JSONTokenType.COLON;
  7515. token.value = ":";
  7516. this.nextChar();
  7517. break;
  7518. case "t":
  7519. _local2 = ((("t" + this.nextChar()) + this.nextChar()) + this.nextChar());
  7520. if (_local2 == "true"){
  7521. token.type = JSONTokenType.TRUE;
  7522. token.value = true;
  7523. this.nextChar();
  7524. } else {
  7525. this.parseError(("Expecting 'true' but found " + _local2));
  7526. };
  7527. break;
  7528. case "f":
  7529. _local3 = (((("f" + this.nextChar()) + this.nextChar()) + this.nextChar()) + this.nextChar());
  7530. if (_local3 == "false"){
  7531. token.type = JSONTokenType.FALSE;
  7532. token.value = false;
  7533. this.nextChar();
  7534. } else {
  7535. this.parseError(("Expecting 'false' but found " + _local3));
  7536. };
  7537. break;
  7538. case "n":
  7539. _local4 = ((("n" + this.nextChar()) + this.nextChar()) + this.nextChar());
  7540. if (_local4 == "null"){
  7541. token.type = JSONTokenType.NULL;
  7542. token.value = null;
  7543. this.nextChar();
  7544. } else {
  7545. this.parseError(("Expecting 'null' but found " + _local4));
  7546. };
  7547. break;
  7548. case "N":
  7549. _local5 = (("N" + this.nextChar()) + this.nextChar());
  7550. if (_local5 == "NaN"){
  7551. token.type = JSONTokenType.NAN;
  7552. token.value = NaN;
  7553. this.nextChar();
  7554. } else {
  7555. this.parseError(("Expecting 'NaN' but found " + _local5));
  7556. };
  7557. break;
  7558. case "\"":
  7559. token = this.readString();
  7560. break;
  7561. default:
  7562. if (((this.isDigit(this.ch)) || ((this.ch == "-")))){
  7563. token = this.readNumber();
  7564. } else {
  7565. if (this.ch == ""){
  7566. return (null);
  7567. };
  7568. this.parseError((("Unexpected " + this.ch) + " encountered"));
  7569. };
  7570. };
  7571. return (token);
  7572. }
  7573. private function readString():JSONToken{
  7574. var backspaceCount:int;
  7575. var backspaceIndex:int;
  7576. var quoteIndex:int = this.loc;
  7577. do {
  7578. quoteIndex = this.jsonString.indexOf("\"", quoteIndex);
  7579. if (quoteIndex >= 0){
  7580. backspaceCount = 0;
  7581. backspaceIndex = (quoteIndex - 1);
  7582. while (this.jsonString.charAt(backspaceIndex) == "\\") {
  7583. backspaceCount++;
  7584. backspaceIndex--;
  7585. };
  7586. if ((backspaceCount % 2) == 0){
  7587. break;
  7588. };
  7589. quoteIndex++;
  7590. } else {
  7591. this.parseError("Unterminated string literal");
  7592. };
  7593. } while (true);
  7594. var token:JSONToken = new JSONToken();
  7595. token.type = JSONTokenType.STRING;
  7596. token.value = this.unescapeString(this.jsonString.substr(this.loc, (quoteIndex - this.loc)));
  7597. this.loc = (quoteIndex + 1);
  7598. this.nextChar();
  7599. return (token);
  7600. }
  7601. public function unescapeString(input:String):String{
  7602. var afterBackslashIndex:int;
  7603. var escapedChar:String;
  7604. var _local8:String;
  7605. var i:int;
  7606. var possibleHexChar:String;
  7607. if (((this.strict) && (this.controlCharsRegExp.test(input)))){
  7608. this.parseError("String contains unescaped control character (0x00-0x1F)");
  7609. };
  7610. var result:String = "";
  7611. var backslashIndex:int;
  7612. var nextSubstringStartPosition:int;
  7613. var len:int = input.length;
  7614. do {
  7615. backslashIndex = input.indexOf("\\", nextSubstringStartPosition);
  7616. if (backslashIndex >= 0){
  7617. result = (result + input.substr(nextSubstringStartPosition, (backslashIndex - nextSubstringStartPosition)));
  7618. nextSubstringStartPosition = (backslashIndex + 2);
  7619. afterBackslashIndex = (backslashIndex + 1);
  7620. escapedChar = input.charAt(afterBackslashIndex);
  7621. switch (escapedChar){
  7622. case "\"":
  7623. result = (result + "\"");
  7624. break;
  7625. case "'":
  7626. result = (result + "'");
  7627. break;
  7628. case "\\":
  7629. result = (result + "\\");
  7630. break;
  7631. case "n":
  7632. result = (result + "\n");
  7633. break;
  7634. case "r":
  7635. result = (result + "\r");
  7636. break;
  7637. case "t":
  7638. result = (result + "\t");
  7639. break;
  7640. case "u":
  7641. _local8 = "";
  7642. if ((nextSubstringStartPosition + 4) > len){
  7643. this.parseError("Unexpected end of input. Expecting 4 hex digits after \\u.");
  7644. };
  7645. i = nextSubstringStartPosition;
  7646. while (i < (nextSubstringStartPosition + 4)) {
  7647. possibleHexChar = input.charAt(i);
  7648. if (!this.isHexDigit(possibleHexChar)){
  7649. this.parseError(("Excepted a hex digit, but found: " + possibleHexChar));
  7650. };
  7651. _local8 = (_local8 + possibleHexChar);
  7652. i++;
  7653. };
  7654. result = (result + String.fromCharCode(parseInt(_local8, 16)));
  7655. nextSubstringStartPosition = (nextSubstringStartPosition + 4);
  7656. break;
  7657. case "f":
  7658. result = (result + "\f");
  7659. break;
  7660. case "/":
  7661. result = (result + "/");
  7662. break;
  7663. case "b":
  7664. result = (result + "\b");
  7665. break;
  7666. default:
  7667. result = (result + ("\\" + escapedChar));
  7668. };
  7669. } else {
  7670. result = (result + input.substr(nextSubstringStartPosition));
  7671. break;
  7672. };
  7673. } while (nextSubstringStartPosition < len);
  7674. return (result);
  7675. }
  7676. private function readNumber():JSONToken{
  7677. var token:JSONToken;
  7678. var input:String = "";
  7679. if (this.ch == "-"){
  7680. input = (input + "-");
  7681. this.nextChar();
  7682. };
  7683. if (!this.isDigit(this.ch)){
  7684. this.parseError("Expecting a digit");
  7685. };
  7686. if (this.ch == "0"){
  7687. input = (input + this.ch);
  7688. this.nextChar();
  7689. if (this.isDigit(this.ch)){
  7690. this.parseError("A digit cannot immediately follow 0");
  7691. } else {
  7692. if (((!(this.strict)) && ((this.ch == "x")))){
  7693. input = (input + this.ch);
  7694. this.nextChar();
  7695. if (this.isHexDigit(this.ch)){
  7696. input = (input + this.ch);
  7697. this.nextChar();
  7698. } else {
  7699. this.parseError("Number in hex format require at least one hex digit after \"0x\"");
  7700. };
  7701. while (this.isHexDigit(this.ch)) {
  7702. input = (input + this.ch);
  7703. this.nextChar();
  7704. };
  7705. };
  7706. };
  7707. } else {
  7708. while (this.isDigit(this.ch)) {
  7709. input = (input + this.ch);
  7710. this.nextChar();
  7711. };
  7712. };
  7713. if (this.ch == "."){
  7714. input = (input + ".");
  7715. this.nextChar();
  7716. if (!this.isDigit(this.ch)){
  7717. this.parseError("Expecting a digit");
  7718. };
  7719. while (this.isDigit(this.ch)) {
  7720. input = (input + this.ch);
  7721. this.nextChar();
  7722. };
  7723. };
  7724. if ((((this.ch == "e")) || ((this.ch == "E")))){
  7725. input = (input + "e");
  7726. this.nextChar();
  7727. if ((((this.ch == "+")) || ((this.ch == "-")))){
  7728. input = (input + this.ch);
  7729. this.nextChar();
  7730. };
  7731. if (!this.isDigit(this.ch)){
  7732. this.parseError("Scientific notation number needs exponent value");
  7733. };
  7734. while (this.isDigit(this.ch)) {
  7735. input = (input + this.ch);
  7736. this.nextChar();
  7737. };
  7738. };
  7739. var num:Number = Number(input);
  7740. if (((isFinite(num)) && (!(isNaN(num))))){
  7741. token = new JSONToken();
  7742. token.type = JSONTokenType.NUMBER;
  7743. token.value = num;
  7744. return (token);
  7745. };
  7746. this.parseError((("Number " + num) + " is not valid!"));
  7747. return (null);
  7748. }
  7749. private function nextChar():String{
  7750. return ((this.ch = this.jsonString.charAt(this.loc++)));
  7751. }
  7752. private function skipIgnored():void{
  7753. var originalLoc:int;
  7754. do {
  7755. originalLoc = this.loc;
  7756. this.skipWhite();
  7757. this.skipComments();
  7758. } while (originalLoc != this.loc);
  7759. }
  7760. private function skipComments():void{
  7761. if (this.ch == "/"){
  7762. this.nextChar();
  7763. switch (this.ch){
  7764. case "/":
  7765. do {
  7766. this.nextChar();
  7767. } while (((!((this.ch == "\n"))) && (!((this.ch == "")))));
  7768. this.nextChar();
  7769. break;
  7770. case "*":
  7771. this.nextChar();
  7772. while (true) {
  7773. if (this.ch == "*"){
  7774. this.nextChar();
  7775. if (this.ch == "/"){
  7776. this.nextChar();
  7777. break;
  7778. };
  7779. } else {
  7780. this.nextChar();
  7781. };
  7782. if (this.ch == ""){
  7783. this.parseError("Multi-line comment not closed");
  7784. };
  7785. };
  7786. break;
  7787. default:
  7788. this.parseError((("Unexpected " + this.ch) + " encountered (expecting '/' or '*' )"));
  7789. };
  7790. };
  7791. }
  7792. private function skipWhite():void{
  7793. while (this.isWhiteSpace(this.ch)) {
  7794. this.nextChar();
  7795. };
  7796. }
  7797. private function isWhiteSpace(ch:String):Boolean{
  7798. if ((((((((ch == " ")) || ((ch == "\t")))) || ((ch == "\n")))) || ((ch == "\r")))){
  7799. return (true);
  7800. };
  7801. if (((!(this.strict)) && ((ch.charCodeAt(0) == 160)))){
  7802. return (true);
  7803. };
  7804. return (false);
  7805. }
  7806. private function isDigit(ch:String):Boolean{
  7807. return ((((ch >= "0")) && ((ch <= "9"))));
  7808. }
  7809. private function isHexDigit(ch:String):Boolean{
  7810. return (((((this.isDigit(ch)) || ((((ch >= "A")) && ((ch <= "F")))))) || ((((ch >= "a")) && ((ch <= "f"))))));
  7811. }
  7812. public function parseError(message:String):void{
  7813. throw (new JSONParseError(message, this.loc, this.jsonString));
  7814. }
  7815.  
  7816. }
  7817. }//package com.adobe.serialization.json
  7818. package com.adobe.serialization.json {
  7819.  
  7820. public class JSONParseError extends Error {
  7821.  
  7822. private var _location:int;
  7823. private var _text:String;
  7824.  
  7825. public function JSONParseError(message:String="", location:int=0, text:String=""){
  7826. super(message);
  7827. name = "JSONParseError";
  7828. this._location = location;
  7829. this._text = text;
  7830. }
  7831. public function get location():int{
  7832. return (this._location);
  7833. }
  7834. public function get text():String{
  7835. return (this._text);
  7836. }
  7837.  
  7838. }
  7839. }//package com.adobe.serialization.json
  7840. package {
  7841. import flash.display.*;
  7842. import flash.text.*;
  7843.  
  7844. public dynamic class Copyright extends MovieClip {
  7845.  
  7846. public var _tf:TextField;
  7847.  
  7848. }
  7849. }//package
  7850. package {
  7851. import flash.display.*;
  7852.  
  7853. public dynamic class JumpButton extends MovieClip {
  7854.  
  7855. public var light_mc:MovieClip;
  7856. public var selectedMark:MovieClip;
  7857.  
  7858. }
  7859. }//package
  7860. package hulu_masthead_fla {
  7861. import flash.display.*;
  7862.  
  7863. public dynamic class loading_18 extends MovieClip {
  7864.  
  7865. public function loading_18(){
  7866. addFrameScript(0, this.frame1);
  7867. }
  7868. function frame1(){
  7869. stop();
  7870. }
  7871.  
  7872. }
  7873. }//package hulu_masthead_fla
  7874. package hulu_masthead_fla {
  7875. import flash.display.*;
  7876.  
  7877. public dynamic class line_20 extends MovieClip {
  7878.  
  7879. public function line_20(){
  7880. addFrameScript(0, this.frame1);
  7881. }
  7882. function frame1(){
  7883. stop();
  7884. }
  7885.  
  7886. }
  7887. }//package hulu_masthead_fla
  7888. package {
  7889. import flash.display.*;
  7890.  
  7891. public dynamic class LeftArrowButton extends MovieClip {
  7892.  
  7893. public var arrow_mc:MovieClip;
  7894.  
  7895. }
  7896. }//package
  7897. package {
  7898. import flash.display.*;
  7899.  
  7900. public dynamic class CloseButton extends MovieClip {
  7901.  
  7902. public var light_mc:MovieClip;
  7903.  
  7904. }
  7905. }//package
  7906. package {
  7907. import flash.text.*;
  7908.  
  7909. public dynamic class Font1 extends Font {
  7910.  
  7911. }
  7912. }//package
  7913. package {
  7914. import flash.display.*;
  7915. import com.hulu.masthead.model.*;
  7916. import flash.system.*;
  7917. import com.hulu.masthead.controller.*;
  7918.  
  7919. public class HuluMasthead extends Sprite {
  7920.  
  7921. public static var stage:Stage;
  7922.  
  7923. private var _carousel:HuluCarousel = null;
  7924. private var _style:HuluStyle;
  7925.  
  7926. public function HuluMasthead(){
  7927. this._style = new HuluStyle();
  7928. super();
  7929. Security.allowDomain("*");
  7930. HuluMasthead.stage = this.stage;
  7931. this._carousel = new HuluCarousel(this, this._style);
  7932. }
  7933. }
  7934. }//package
  7935. package {
  7936. import flash.display.*;
  7937.  
  7938. public dynamic class WatchButton extends MovieClip {
  7939.  
  7940. public var light_mc:MovieClip;
  7941.  
  7942. public function WatchButton(){
  7943. addFrameScript(0, this.frame1);
  7944. }
  7945. function frame1(){
  7946. stop();
  7947. }
  7948.  
  7949. }
  7950. }//package
  7951. package {
  7952. import flash.display.*;
  7953.  
  7954. public dynamic class LoadingImage extends MovieClip {
  7955.  
  7956. public var clickArea:MovieClip;
  7957.  
  7958. public function LoadingImage(){
  7959. addFrameScript(0, this.frame1);
  7960. }
  7961. function frame1(){
  7962. stop();
  7963. }
  7964.  
  7965. }
  7966. }//package
  7967. package {
  7968. import flash.display.*;
  7969.  
  7970. public dynamic class RightArrowButton extends MovieClip {
  7971.  
  7972. public var arrow_mc:MovieClip;
  7973.  
  7974. }
  7975. }//package
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement