Section 1
//HtmlEntities (com.adrianparr.utils.HtmlEntities)
package com.adrianparr.utils {
public class HtmlEntities {
public static function encode($str:String):String{
var regExp:RegExp;
regExp = /&/g;
$str = $str.replace(regExp, "&");
regExp = /"/g;
$str = $str.replace(regExp, """);
regExp = /'/g;
$str = $str.replace(regExp, "'");
regExp = /</g;
$str = $str.replace(regExp, "<");
regExp = />/g;
$str = $str.replace(regExp, ">");
regExp = / /g;
$str = $str.replace(regExp, " ");
regExp = /¡/g;
$str = $str.replace(regExp, "¡");
regExp = /¢/g;
$str = $str.replace(regExp, "¢");
regExp = /£/g;
$str = $str.replace(regExp, "£");
regExp = /¤/g;
$str = $str.replace(regExp, "¤");
regExp = /¥/g;
$str = $str.replace(regExp, "¥");
regExp = /¦/g;
$str = $str.replace(regExp, "¦");
regExp = /§/g;
$str = $str.replace(regExp, "§");
regExp = /¨/g;
$str = $str.replace(regExp, "¨");
regExp = /©/g;
$str = $str.replace(regExp, "©");
regExp = /ª/g;
$str = $str.replace(regExp, "ª");
regExp = /«/g;
$str = $str.replace(regExp, "«");
regExp = /¬/g;
$str = $str.replace(regExp, "¬");
regExp = /®/g;
$str = $str.replace(regExp, "®");
regExp = /¯/g;
$str = $str.replace(regExp, "¯");
regExp = /°/g;
$str = $str.replace(regExp, "°");
regExp = /±/g;
$str = $str.replace(regExp, "±");
regExp = /²/g;
$str = $str.replace(regExp, "²");
regExp = /³/g;
$str = $str.replace(regExp, "³");
regExp = /´/g;
$str = $str.replace(regExp, "´");
regExp = /µ/g;
$str = $str.replace(regExp, "µ");
regExp = /¶/g;
$str = $str.replace(regExp, "¶");
regExp = /·/g;
$str = $str.replace(regExp, "·");
regExp = /¸/g;
$str = $str.replace(regExp, "¸");
regExp = /¹/g;
$str = $str.replace(regExp, "¹");
regExp = /º/g;
$str = $str.replace(regExp, "º");
regExp = /»/g;
$str = $str.replace(regExp, "»");
regExp = /¼/g;
$str = $str.replace(regExp, "¼");
regExp = /½/g;
$str = $str.replace(regExp, "½");
regExp = /¾/g;
$str = $str.replace(regExp, "¾");
regExp = /¿/g;
$str = $str.replace(regExp, "¿");
regExp = /×/g;
$str = $str.replace(regExp, "×");
regExp = /÷/g;
$str = $str.replace(regExp, "÷");
regExp = /À/g;
$str = $str.replace(regExp, "À");
regExp = /Á/g;
$str = $str.replace(regExp, "Á");
regExp = /Â/g;
$str = $str.replace(regExp, "Â");
regExp = /Ã/g;
$str = $str.replace(regExp, "Ã");
regExp = /Ä/g;
$str = $str.replace(regExp, "Ä");
regExp = /Å/g;
$str = $str.replace(regExp, "Å");
regExp = /Æ/g;
$str = $str.replace(regExp, "Æ");
regExp = /Ç/g;
$str = $str.replace(regExp, "Ç");
regExp = /È/g;
$str = $str.replace(regExp, "È");
regExp = /É/g;
$str = $str.replace(regExp, "É");
regExp = /Ê/g;
$str = $str.replace(regExp, "Ê");
regExp = /Ë/g;
$str = $str.replace(regExp, "Ë");
regExp = /Ì/g;
$str = $str.replace(regExp, "Ì");
regExp = /Í/g;
$str = $str.replace(regExp, "Í");
regExp = /Î/g;
$str = $str.replace(regExp, "Î");
regExp = /Ï/g;
$str = $str.replace(regExp, "Ï");
regExp = /Ð/g;
$str = $str.replace(regExp, "Ð");
regExp = /Ñ/g;
$str = $str.replace(regExp, "Ñ");
regExp = /Ò/g;
$str = $str.replace(regExp, "Ò");
regExp = /Ó/g;
$str = $str.replace(regExp, "Ó");
regExp = /Ô/g;
$str = $str.replace(regExp, "Ô");
regExp = /Õ/g;
$str = $str.replace(regExp, "Õ");
regExp = /Ö/g;
$str = $str.replace(regExp, "Ö");
regExp = /Ø/g;
$str = $str.replace(regExp, "Ø");
regExp = /Ù/g;
$str = $str.replace(regExp, "Ù");
regExp = /Ú/g;
$str = $str.replace(regExp, "Ú");
regExp = /Û/g;
$str = $str.replace(regExp, "Û");
regExp = /Ü/g;
$str = $str.replace(regExp, "Ü");
regExp = /Ý/g;
$str = $str.replace(regExp, "Ý");
regExp = /Þ/g;
$str = $str.replace(regExp, "Þ");
regExp = /ß/g;
$str = $str.replace(regExp, "ß");
regExp = /à/g;
$str = $str.replace(regExp, "à");
regExp = /á/g;
$str = $str.replace(regExp, "á");
regExp = /â/g;
$str = $str.replace(regExp, "â");
regExp = /ã/g;
$str = $str.replace(regExp, "ã");
regExp = /ä/g;
$str = $str.replace(regExp, "ä");
regExp = /å/g;
$str = $str.replace(regExp, "å");
regExp = /æ/g;
$str = $str.replace(regExp, "æ");
regExp = /ç/g;
$str = $str.replace(regExp, "ç");
regExp = /è/g;
$str = $str.replace(regExp, "è");
regExp = /é/g;
$str = $str.replace(regExp, "é");
regExp = /ê/g;
$str = $str.replace(regExp, "ê");
regExp = /ë/g;
$str = $str.replace(regExp, "ë");
regExp = /ì/g;
$str = $str.replace(regExp, "ì");
regExp = /í/g;
$str = $str.replace(regExp, "í");
regExp = /î/g;
$str = $str.replace(regExp, "î");
regExp = /ï/g;
$str = $str.replace(regExp, "ï");
regExp = /ð/g;
$str = $str.replace(regExp, "ð");
regExp = /ñ/g;
$str = $str.replace(regExp, "ñ");
regExp = /ò/g;
$str = $str.replace(regExp, "ò");
regExp = /ó/g;
$str = $str.replace(regExp, "ó");
regExp = /ô/g;
$str = $str.replace(regExp, "ô");
regExp = /õ/g;
$str = $str.replace(regExp, "õ");
regExp = /ö/g;
$str = $str.replace(regExp, "ö");
regExp = /ø/g;
$str = $str.replace(regExp, "ø");
regExp = /ù/g;
$str = $str.replace(regExp, "ù");
regExp = /ú/g;
$str = $str.replace(regExp, "ú");
regExp = /û/g;
$str = $str.replace(regExp, "û");
regExp = /ü/g;
$str = $str.replace(regExp, "ü");
regExp = /ý/g;
$str = $str.replace(regExp, "ý");
regExp = /þ/g;
$str = $str.replace(regExp, "þ");
regExp = /ÿ/g;
$str = $str.replace(regExp, "ÿ");
regExp = /∀/g;
$str = $str.replace(regExp, "∀");
regExp = /∂/g;
$str = $str.replace(regExp, "∂");
regExp = /∃/g;
$str = $str.replace(regExp, "∃");
regExp = /∅/g;
$str = $str.replace(regExp, "∅");
regExp = /∇/g;
$str = $str.replace(regExp, "∇");
regExp = /∈/g;
$str = $str.replace(regExp, "∈");
regExp = /∉/g;
$str = $str.replace(regExp, "∉");
regExp = /∋/g;
$str = $str.replace(regExp, "∋");
regExp = /∏/g;
$str = $str.replace(regExp, "∏");
regExp = /∑/g;
$str = $str.replace(regExp, "∑");
regExp = /−/g;
$str = $str.replace(regExp, "−");
regExp = /∗/g;
$str = $str.replace(regExp, "∗");
regExp = /√/g;
$str = $str.replace(regExp, "√");
regExp = /∝/g;
$str = $str.replace(regExp, "∝");
regExp = /∞/g;
$str = $str.replace(regExp, "∞");
regExp = /∠/g;
$str = $str.replace(regExp, "∠");
regExp = /∧/g;
$str = $str.replace(regExp, "∧");
regExp = /∨/g;
$str = $str.replace(regExp, "∨");
regExp = /∩/g;
$str = $str.replace(regExp, "∩");
regExp = /∪/g;
$str = $str.replace(regExp, "∪");
regExp = /∫/g;
$str = $str.replace(regExp, "∫");
regExp = /∴/g;
$str = $str.replace(regExp, "∴");
regExp = /∼/g;
$str = $str.replace(regExp, "∼");
regExp = /≅/g;
$str = $str.replace(regExp, "≅");
regExp = /≈/g;
$str = $str.replace(regExp, "≈");
regExp = /≠/g;
$str = $str.replace(regExp, "≠");
regExp = /≡/g;
$str = $str.replace(regExp, "≡");
regExp = /≤/g;
$str = $str.replace(regExp, "≤");
regExp = /≥/g;
$str = $str.replace(regExp, "≥");
regExp = /⊂/g;
$str = $str.replace(regExp, "⊂");
regExp = /⊃/g;
$str = $str.replace(regExp, "⊃");
regExp = /⊄/g;
$str = $str.replace(regExp, "⊄");
regExp = /⊆/g;
$str = $str.replace(regExp, "⊆");
regExp = /⊇/g;
$str = $str.replace(regExp, "⊇");
regExp = /⊕/g;
$str = $str.replace(regExp, "⊕");
regExp = /⊗/g;
$str = $str.replace(regExp, "⊗");
regExp = /⊥/g;
$str = $str.replace(regExp, "⊥");
regExp = /⋅/g;
$str = $str.replace(regExp, "⋅");
regExp = /Α/g;
$str = $str.replace(regExp, "Α");
regExp = /Β/g;
$str = $str.replace(regExp, "Β");
regExp = /Γ/g;
$str = $str.replace(regExp, "Γ");
regExp = /Δ/g;
$str = $str.replace(regExp, "Δ");
regExp = /Ε/g;
$str = $str.replace(regExp, "Ε");
regExp = /Ζ/g;
$str = $str.replace(regExp, "Ζ");
regExp = /Η/g;
$str = $str.replace(regExp, "Η");
regExp = /Θ/g;
$str = $str.replace(regExp, "Θ");
regExp = /Ι/g;
$str = $str.replace(regExp, "Ι");
regExp = /Κ/g;
$str = $str.replace(regExp, "Κ");
regExp = /Λ/g;
$str = $str.replace(regExp, "Λ");
regExp = /Μ/g;
$str = $str.replace(regExp, "Μ");
regExp = /Ν/g;
$str = $str.replace(regExp, "Ν");
regExp = /Ξ/g;
$str = $str.replace(regExp, "Ξ");
regExp = /Ο/g;
$str = $str.replace(regExp, "Ο");
regExp = /Π/g;
$str = $str.replace(regExp, "Π");
regExp = /Ρ/g;
$str = $str.replace(regExp, "Ρ");
regExp = /Σ/g;
$str = $str.replace(regExp, "Σ");
regExp = /Τ/g;
$str = $str.replace(regExp, "Τ");
regExp = /Υ/g;
$str = $str.replace(regExp, "Υ");
regExp = /Φ/g;
$str = $str.replace(regExp, "Φ");
regExp = /Χ/g;
$str = $str.replace(regExp, "Χ");
regExp = /Ψ/g;
$str = $str.replace(regExp, "Ψ");
regExp = /Ω/g;
$str = $str.replace(regExp, "Ω");
regExp = /α/g;
$str = $str.replace(regExp, "α");
regExp = /β/g;
$str = $str.replace(regExp, "β");
regExp = /γ/g;
$str = $str.replace(regExp, "γ");
regExp = /δ/g;
$str = $str.replace(regExp, "δ");
regExp = /ε/g;
$str = $str.replace(regExp, "ε");
regExp = /ζ/g;
$str = $str.replace(regExp, "ζ");
regExp = /η/g;
$str = $str.replace(regExp, "η");
regExp = /θ/g;
$str = $str.replace(regExp, "θ");
regExp = /ι/g;
$str = $str.replace(regExp, "ι");
regExp = /κ/g;
$str = $str.replace(regExp, "κ");
regExp = /λ/g;
$str = $str.replace(regExp, "λ");
regExp = /μ/g;
$str = $str.replace(regExp, "μ");
regExp = /ν/g;
$str = $str.replace(regExp, "ν");
regExp = /ξ/g;
$str = $str.replace(regExp, "ξ");
regExp = /ο/g;
$str = $str.replace(regExp, "ο");
regExp = /π/g;
$str = $str.replace(regExp, "π");
regExp = /ρ/g;
$str = $str.replace(regExp, "ρ");
regExp = /ς/g;
$str = $str.replace(regExp, "ς");
regExp = /σ/g;
$str = $str.replace(regExp, "σ");
regExp = /τ/g;
$str = $str.replace(regExp, "τ");
regExp = /υ/g;
$str = $str.replace(regExp, "υ");
regExp = /φ/g;
$str = $str.replace(regExp, "φ");
regExp = /χ/g;
$str = $str.replace(regExp, "χ");
regExp = /ψ/g;
$str = $str.replace(regExp, "ψ");
regExp = /ω/g;
$str = $str.replace(regExp, "ω");
regExp = /ϑ/g;
$str = $str.replace(regExp, "ϑ");
regExp = /ϒ/g;
$str = $str.replace(regExp, "ϒ");
regExp = /ϖ/g;
$str = $str.replace(regExp, "ϖ");
regExp = /Œ/g;
$str = $str.replace(regExp, "Œ");
regExp = /œ/g;
$str = $str.replace(regExp, "œ");
regExp = /Š/g;
$str = $str.replace(regExp, "Š");
regExp = /š/g;
$str = $str.replace(regExp, "š");
regExp = /Ÿ/g;
$str = $str.replace(regExp, "Ÿ");
regExp = /ƒ/g;
$str = $str.replace(regExp, "ƒ");
regExp = /ˆ/g;
$str = $str.replace(regExp, "ˆ");
regExp = /˜/g;
$str = $str.replace(regExp, "˜");
regExp = / /g;
$str = $str.replace(regExp, " ");
regExp = / /g;
$str = $str.replace(regExp, " ");
regExp = / /g;
$str = $str.replace(regExp, " ");
regExp = / /g;
$str = $str.replace(regExp, "‎");
regExp = / /g;
$str = $str.replace(regExp, "‏");
regExp = /–/g;
$str = $str.replace(regExp, "–");
regExp = /—/g;
$str = $str.replace(regExp, "—");
regExp = /‘/g;
$str = $str.replace(regExp, "‘");
regExp = /’/g;
$str = $str.replace(regExp, "’");
regExp = /‚/g;
$str = $str.replace(regExp, "‚");
regExp = /“/g;
$str = $str.replace(regExp, "“");
regExp = /”/g;
$str = $str.replace(regExp, "”");
regExp = /„/g;
$str = $str.replace(regExp, "„");
regExp = /†/g;
$str = $str.replace(regExp, "†");
regExp = /‡/g;
$str = $str.replace(regExp, "‡");
regExp = /•/g;
$str = $str.replace(regExp, "•");
regExp = /…/g;
$str = $str.replace(regExp, "…");
regExp = /‰/g;
$str = $str.replace(regExp, "‰");
regExp = /′/g;
$str = $str.replace(regExp, "′");
regExp = /″/g;
$str = $str.replace(regExp, "″");
regExp = /‹/g;
$str = $str.replace(regExp, "‹");
regExp = /›/g;
$str = $str.replace(regExp, "›");
regExp = /‾/g;
$str = $str.replace(regExp, "‾");
regExp = /€/g;
$str = $str.replace(regExp, "€");
regExp = /™/g;
$str = $str.replace(regExp, "™");
regExp = /←/g;
$str = $str.replace(regExp, "←");
regExp = /↑/g;
$str = $str.replace(regExp, "↑");
regExp = /→/g;
$str = $str.replace(regExp, "→");
regExp = /↓/g;
$str = $str.replace(regExp, "↓");
regExp = /↔/g;
$str = $str.replace(regExp, "↔");
regExp = /↵/g;
$str = $str.replace(regExp, "↵");
regExp = /⌈/g;
$str = $str.replace(regExp, "⌈");
regExp = /⌉/g;
$str = $str.replace(regExp, "⌉");
regExp = /⌊/g;
$str = $str.replace(regExp, "⌊");
regExp = /⌋/g;
$str = $str.replace(regExp, "⌋");
regExp = /◊/g;
$str = $str.replace(regExp, "◊");
regExp = /♠/g;
$str = $str.replace(regExp, "♠");
regExp = /♣/g;
$str = $str.replace(regExp, "♣");
regExp = /♥/g;
$str = $str.replace(regExp, "♥");
regExp = /♦/g;
$str = $str.replace(regExp, "♦");
regExp = /\//g;
$str = $str.replace(regExp, "⁄");
return ($str);
}
public static function decode($str:String):String{
var regExp:RegExp;
regExp = /&/g;
$str = $str.replace(regExp, "&");
regExp = /"/g;
$str = $str.replace(regExp, "\"");
regExp = /'/g;
$str = $str.replace(regExp, "'");
regExp = /</g;
$str = $str.replace(regExp, "<");
regExp = />/g;
$str = $str.replace(regExp, ">");
regExp = / /g;
$str = $str.replace(regExp, " ");
regExp = /¡/g;
$str = $str.replace(regExp, "¡");
regExp = /¢/g;
$str = $str.replace(regExp, "¢");
regExp = /£/g;
$str = $str.replace(regExp, "£");
regExp = /¤/g;
$str = $str.replace(regExp, "¤");
regExp = /¥/g;
$str = $str.replace(regExp, "¥");
regExp = /¦/g;
$str = $str.replace(regExp, "¦");
regExp = /§/g;
$str = $str.replace(regExp, "§");
regExp = /¨/g;
$str = $str.replace(regExp, "¨");
regExp = /©/g;
$str = $str.replace(regExp, "©");
regExp = /ª/g;
$str = $str.replace(regExp, "ª");
regExp = /«/g;
$str = $str.replace(regExp, "«");
regExp = /¬/g;
$str = $str.replace(regExp, "¬");
regExp = /®/g;
$str = $str.replace(regExp, "®");
regExp = /¯/g;
$str = $str.replace(regExp, "¯");
regExp = /°/g;
$str = $str.replace(regExp, "°");
regExp = /±/g;
$str = $str.replace(regExp, "±");
regExp = /²/g;
$str = $str.replace(regExp, "²");
regExp = /³/g;
$str = $str.replace(regExp, "³");
regExp = /´/g;
$str = $str.replace(regExp, "´");
regExp = /µ/g;
$str = $str.replace(regExp, "µ");
regExp = /¶/g;
$str = $str.replace(regExp, "¶");
regExp = /·/g;
$str = $str.replace(regExp, "·");
regExp = /¸/g;
$str = $str.replace(regExp, "¸");
regExp = /¹/g;
$str = $str.replace(regExp, "¹");
regExp = /º/g;
$str = $str.replace(regExp, "º");
regExp = /»/g;
$str = $str.replace(regExp, "»");
regExp = /¼/g;
$str = $str.replace(regExp, "¼");
regExp = /½/g;
$str = $str.replace(regExp, "½");
regExp = /¾/g;
$str = $str.replace(regExp, "¾");
regExp = /¿/g;
$str = $str.replace(regExp, "¿");
regExp = /×/g;
$str = $str.replace(regExp, "×");
regExp = /÷/g;
$str = $str.replace(regExp, "÷");
regExp = /À/g;
$str = $str.replace(regExp, "À");
regExp = /Á/g;
$str = $str.replace(regExp, "Á");
regExp = /Â/g;
$str = $str.replace(regExp, "Â");
regExp = /Ã/g;
$str = $str.replace(regExp, "Ã");
regExp = /Ä/g;
$str = $str.replace(regExp, "Ä");
regExp = /Å/g;
$str = $str.replace(regExp, "Å");
regExp = /Æ/g;
$str = $str.replace(regExp, "Æ");
regExp = /Ç/g;
$str = $str.replace(regExp, "Ç");
regExp = /È/g;
$str = $str.replace(regExp, "È");
regExp = /É/g;
$str = $str.replace(regExp, "É");
regExp = /Ê/g;
$str = $str.replace(regExp, "Ê");
regExp = /Ë/g;
$str = $str.replace(regExp, "Ë");
regExp = /Ì/g;
$str = $str.replace(regExp, "Ì");
regExp = /Í/g;
$str = $str.replace(regExp, "Í");
regExp = /Î/g;
$str = $str.replace(regExp, "Î");
regExp = /Ï/g;
$str = $str.replace(regExp, "Ï");
regExp = /Ð/g;
$str = $str.replace(regExp, "Ð");
regExp = /Ñ/g;
$str = $str.replace(regExp, "Ñ");
regExp = /Ò/g;
$str = $str.replace(regExp, "Ò");
regExp = /Ó/g;
$str = $str.replace(regExp, "Ó");
regExp = /Ô/g;
$str = $str.replace(regExp, "Ô");
regExp = /Õ/g;
$str = $str.replace(regExp, "Õ");
regExp = /Ö/g;
$str = $str.replace(regExp, "Ö");
regExp = /Ø/g;
$str = $str.replace(regExp, "Ø");
regExp = /Ù/g;
$str = $str.replace(regExp, "Ù");
regExp = /Ú/g;
$str = $str.replace(regExp, "Ú");
regExp = /Û/g;
$str = $str.replace(regExp, "Û");
regExp = /Ü/g;
$str = $str.replace(regExp, "Ü");
regExp = /Ý/g;
$str = $str.replace(regExp, "Ý");
regExp = /Þ/g;
$str = $str.replace(regExp, "Þ");
regExp = /ß/g;
$str = $str.replace(regExp, "ß");
regExp = /à/g;
$str = $str.replace(regExp, "à");
regExp = /á/g;
$str = $str.replace(regExp, "á");
regExp = /â/g;
$str = $str.replace(regExp, "â");
regExp = /ã/g;
$str = $str.replace(regExp, "ã");
regExp = /ä/g;
$str = $str.replace(regExp, "ä");
regExp = /å/g;
$str = $str.replace(regExp, "å");
regExp = /æ/g;
$str = $str.replace(regExp, "æ");
regExp = /ç/g;
$str = $str.replace(regExp, "ç");
regExp = /è/g;
$str = $str.replace(regExp, "è");
regExp = /é/g;
$str = $str.replace(regExp, "é");
regExp = /ê/g;
$str = $str.replace(regExp, "ê");
regExp = /ë/g;
$str = $str.replace(regExp, "ë");
regExp = /ì/g;
$str = $str.replace(regExp, "ì");
regExp = /í/g;
$str = $str.replace(regExp, "í");
regExp = /î/g;
$str = $str.replace(regExp, "î");
regExp = /ï/g;
$str = $str.replace(regExp, "ï");
regExp = /ð/g;
$str = $str.replace(regExp, "ð");
regExp = /ñ/g;
$str = $str.replace(regExp, "ñ");
regExp = /ò/g;
$str = $str.replace(regExp, "ò");
regExp = /ó/g;
$str = $str.replace(regExp, "ó");
regExp = /ô/g;
$str = $str.replace(regExp, "ô");
regExp = /õ/g;
$str = $str.replace(regExp, "õ");
regExp = /ö/g;
$str = $str.replace(regExp, "ö");
regExp = /ø/g;
$str = $str.replace(regExp, "ø");
regExp = /ù/g;
$str = $str.replace(regExp, "ù");
regExp = /ú/g;
$str = $str.replace(regExp, "ú");
regExp = /û/g;
$str = $str.replace(regExp, "û");
regExp = /ü/g;
$str = $str.replace(regExp, "ü");
regExp = /ý/g;
$str = $str.replace(regExp, "ý");
regExp = /þ/g;
$str = $str.replace(regExp, "þ");
regExp = /ÿ/g;
$str = $str.replace(regExp, "ÿ");
regExp = /∀/g;
$str = $str.replace(regExp, "∀");
regExp = /∂/g;
$str = $str.replace(regExp, "∂");
regExp = /∃/g;
$str = $str.replace(regExp, "∃");
regExp = /∅/g;
$str = $str.replace(regExp, "∅");
regExp = /∇/g;
$str = $str.replace(regExp, "∇");
regExp = /∈/g;
$str = $str.replace(regExp, "∈");
regExp = /∉/g;
$str = $str.replace(regExp, "∉");
regExp = /∋/g;
$str = $str.replace(regExp, "∋");
regExp = /∏/g;
$str = $str.replace(regExp, "∏");
regExp = /∑/g;
$str = $str.replace(regExp, "∑");
regExp = /−/g;
$str = $str.replace(regExp, "−");
regExp = /∗/g;
$str = $str.replace(regExp, "∗");
regExp = /√/g;
$str = $str.replace(regExp, "√");
regExp = /∝/g;
$str = $str.replace(regExp, "∝");
regExp = /∞/g;
$str = $str.replace(regExp, "∞");
regExp = /∠/g;
$str = $str.replace(regExp, "∠");
regExp = /∧/g;
$str = $str.replace(regExp, "∧");
regExp = /∨/g;
$str = $str.replace(regExp, "∨");
regExp = /∩/g;
$str = $str.replace(regExp, "∩");
regExp = /∪/g;
$str = $str.replace(regExp, "∪");
regExp = /∫/g;
$str = $str.replace(regExp, "∫");
regExp = /∴/g;
$str = $str.replace(regExp, "∴");
regExp = /∼/g;
$str = $str.replace(regExp, "∼");
regExp = /≅/g;
$str = $str.replace(regExp, "≅");
regExp = /≈/g;
$str = $str.replace(regExp, "≈");
regExp = /≠/g;
$str = $str.replace(regExp, "≠");
regExp = /≡/g;
$str = $str.replace(regExp, "≡");
regExp = /≤/g;
$str = $str.replace(regExp, "≤");
regExp = /≥/g;
$str = $str.replace(regExp, "≥");
regExp = /⊂/g;
$str = $str.replace(regExp, "⊂");
regExp = /⊃/g;
$str = $str.replace(regExp, "⊃");
regExp = /⊄/g;
$str = $str.replace(regExp, "⊄");
regExp = /⊆/g;
$str = $str.replace(regExp, "⊆");
regExp = /⊇/g;
$str = $str.replace(regExp, "⊇");
regExp = /⊕/g;
$str = $str.replace(regExp, "⊕");
regExp = /⊗/g;
$str = $str.replace(regExp, "⊗");
regExp = /⊥/g;
$str = $str.replace(regExp, "⊥");
regExp = /⋅/g;
$str = $str.replace(regExp, "⋅");
regExp = /Α/g;
$str = $str.replace(regExp, "Α");
regExp = /Β/g;
$str = $str.replace(regExp, "Β");
regExp = /Γ/g;
$str = $str.replace(regExp, "Γ");
regExp = /Δ/g;
$str = $str.replace(regExp, "Δ");
regExp = /Ε/g;
$str = $str.replace(regExp, "Ε");
regExp = /Ζ/g;
$str = $str.replace(regExp, "Ζ");
regExp = /Η/g;
$str = $str.replace(regExp, "Η");
regExp = /Θ/g;
$str = $str.replace(regExp, "Θ");
regExp = /Ι/g;
$str = $str.replace(regExp, "Ι");
regExp = /Κ/g;
$str = $str.replace(regExp, "Κ");
regExp = /Λ/g;
$str = $str.replace(regExp, "Λ");
regExp = /Μ/g;
$str = $str.replace(regExp, "Μ");
regExp = /Ν/g;
$str = $str.replace(regExp, "Ν");
regExp = /Ξ/g;
$str = $str.replace(regExp, "Ξ");
regExp = /Ο/g;
$str = $str.replace(regExp, "Ο");
regExp = /Π/g;
$str = $str.replace(regExp, "Π");
regExp = /Ρ/g;
$str = $str.replace(regExp, "Ρ");
regExp = /Σ/g;
$str = $str.replace(regExp, "Σ");
regExp = /Τ/g;
$str = $str.replace(regExp, "Τ");
regExp = /Υ/g;
$str = $str.replace(regExp, "Υ");
regExp = /Φ/g;
$str = $str.replace(regExp, "Φ");
regExp = /Χ/g;
$str = $str.replace(regExp, "Χ");
regExp = /Ψ/g;
$str = $str.replace(regExp, "Ψ");
regExp = /Ω/g;
$str = $str.replace(regExp, "Ω");
regExp = /α/g;
$str = $str.replace(regExp, "α");
regExp = /β/g;
$str = $str.replace(regExp, "β");
regExp = /γ/g;
$str = $str.replace(regExp, "γ");
regExp = /δ/g;
$str = $str.replace(regExp, "δ");
regExp = /ε/g;
$str = $str.replace(regExp, "ε");
regExp = /ζ/g;
$str = $str.replace(regExp, "ζ");
regExp = /η/g;
$str = $str.replace(regExp, "η");
regExp = /θ/g;
$str = $str.replace(regExp, "θ");
regExp = /ι/g;
$str = $str.replace(regExp, "ι");
regExp = /κ/g;
$str = $str.replace(regExp, "κ");
regExp = /λ/g;
$str = $str.replace(regExp, "λ");
regExp = /μ/g;
$str = $str.replace(regExp, "μ");
regExp = /ν/g;
$str = $str.replace(regExp, "ν");
regExp = /ξ/g;
$str = $str.replace(regExp, "ξ");
regExp = /ο/g;
$str = $str.replace(regExp, "ο");
regExp = /π/g;
$str = $str.replace(regExp, "π");
regExp = /ρ/g;
$str = $str.replace(regExp, "ρ");
regExp = /ς/g;
$str = $str.replace(regExp, "ς");
regExp = /σ/g;
$str = $str.replace(regExp, "σ");
regExp = /τ/g;
$str = $str.replace(regExp, "τ");
regExp = /υ/g;
$str = $str.replace(regExp, "υ");
regExp = /φ/g;
$str = $str.replace(regExp, "φ");
regExp = /χ/g;
$str = $str.replace(regExp, "χ");
regExp = /ψ/g;
$str = $str.replace(regExp, "ψ");
regExp = /ω/g;
$str = $str.replace(regExp, "ω");
regExp = /ϑ/g;
$str = $str.replace(regExp, "ϑ");
regExp = /ϒ/g;
$str = $str.replace(regExp, "ϒ");
regExp = /ϖ/g;
$str = $str.replace(regExp, "ϖ");
regExp = /Œ/g;
$str = $str.replace(regExp, "Œ");
regExp = /œ/g;
$str = $str.replace(regExp, "œ");
regExp = /Š/g;
$str = $str.replace(regExp, "Š");
regExp = /š/g;
$str = $str.replace(regExp, "š");
regExp = /Ÿ/g;
$str = $str.replace(regExp, "Ÿ");
regExp = /ƒ/g;
$str = $str.replace(regExp, "ƒ");
regExp = /ˆ/g;
$str = $str.replace(regExp, "ˆ");
regExp = /˜/g;
$str = $str.replace(regExp, "˜");
regExp = / /g;
$str = $str.replace(regExp, " ");
regExp = / /g;
$str = $str.replace(regExp, " ");
regExp = / /g;
$str = $str.replace(regExp, " ");
regExp = /‎/g;
$str = $str.replace(regExp, "\t");
regExp = /‏/g;
$str = $str.replace(regExp, "\t");
regExp = /–/g;
$str = $str.replace(regExp, "–");
regExp = /—/g;
$str = $str.replace(regExp, "—");
regExp = /‘/g;
$str = $str.replace(regExp, "‘");
regExp = /’/g;
$str = $str.replace(regExp, "’");
regExp = /‚/g;
$str = $str.replace(regExp, "‚");
regExp = /“/g;
$str = $str.replace(regExp, "“");
regExp = /”/g;
$str = $str.replace(regExp, "”");
regExp = /„/g;
$str = $str.replace(regExp, "„");
regExp = /†/g;
$str = $str.replace(regExp, "†");
regExp = /‡/g;
$str = $str.replace(regExp, "‡");
regExp = /•/g;
$str = $str.replace(regExp, "•");
regExp = /…/g;
$str = $str.replace(regExp, "…");
regExp = /‰/g;
$str = $str.replace(regExp, "‰");
regExp = /′/g;
$str = $str.replace(regExp, "′");
regExp = /″/g;
$str = $str.replace(regExp, "″");
regExp = /‹/g;
$str = $str.replace(regExp, "‹");
regExp = /›/g;
$str = $str.replace(regExp, "›");
regExp = /‾/g;
$str = $str.replace(regExp, "‾");
regExp = /€/g;
$str = $str.replace(regExp, "€");
regExp = /™/g;
$str = $str.replace(regExp, "™");
regExp = /←/g;
$str = $str.replace(regExp, "←");
regExp = /↑/g;
$str = $str.replace(regExp, "↑");
regExp = /→/g;
$str = $str.replace(regExp, "→");
regExp = /↓/g;
$str = $str.replace(regExp, "↓");
regExp = /↔/g;
$str = $str.replace(regExp, "↔");
regExp = /↵/g;
$str = $str.replace(regExp, "↵");
regExp = /⌈/g;
$str = $str.replace(regExp, "⌈");
regExp = /⌉/g;
$str = $str.replace(regExp, "⌉");
regExp = /⌊/g;
$str = $str.replace(regExp, "⌊");
regExp = /⌋/g;
$str = $str.replace(regExp, "⌋");
regExp = /◊/g;
$str = $str.replace(regExp, "◊");
regExp = /♠/g;
$str = $str.replace(regExp, "♠");
regExp = /♣/g;
$str = $str.replace(regExp, "♣");
regExp = /♥/g;
$str = $str.replace(regExp, "♥");
regExp = /♦/g;
$str = $str.replace(regExp, "♦");
regExp = /⁄/g;
$str = $str.replace(regExp, "/");
return ($str);
}
}
}//package com.adrianparr.utils
Section 2
//decodeJson (com.brokenfunction.json.decodeJson)
package com.brokenfunction.json {
public const decodeJson:Function = initDecodeJson();
}//package com.brokenfunction.json
import flash.utils.*;
import flash.system.*;
private const initDecodeJson:Function = function ():Function{
var position:uint;
var byteInput:ByteArray;
var char:uint;
var nativeJson:Object;
var charConvert:ByteArray;
var isNumberChar:ByteArray;
var stringHelper:ByteArray;
var isWhitespace:ByteArray;
var parseNumber:Function;
var parseWhitespace:Function;
var parse:Object;
var _local2 = ApplicationDomain.currentDomain.getDefinition("JSON");
nativeJson = _local2;
_local2;
//unresolved jump
var _slot1 = e;
charConvert = new ByteArray();
(charConvert.length = 0x0100);
(charConvert[34] = 34);
(charConvert[92] = 92);
(charConvert[47] = 47);
(charConvert[98] = 8);
(charConvert[102] = 12);
(charConvert[110] = 10);
(charConvert[114] = 13);
(charConvert[116] = 9);
isNumberChar = new ByteArray();
(isNumberChar.length = 0x0100);
(isNumberChar[43] = 1);
(isNumberChar[45] = 1);
(isNumberChar[46] = 1);
(isNumberChar[48] = 1);
(isNumberChar[49] = 1);
(isNumberChar[50] = 1);
(isNumberChar[51] = 1);
(isNumberChar[52] = 1);
(isNumberChar[53] = 1);
(isNumberChar[54] = 1);
(isNumberChar[55] = 1);
(isNumberChar[56] = 1);
(isNumberChar[57] = 1);
(isNumberChar[69] = 1);
(isNumberChar[101] = 1);
stringHelper = new ByteArray();
(stringHelper.length = 0x0100);
var i:int;
while (i < 0x0100) {
i = (i + 1);
_local2 = i;
(stringHelper[_local2] = 1);
};
(stringHelper[34] = 0);
(stringHelper[92] = 0);
isWhitespace = new ByteArray();
(isWhitespace.length = 0x0100);
(isWhitespace[9] = 1);
(isWhitespace[10] = 1);
(isWhitespace[13] = 1);
(isWhitespace[32] = 1);
parseNumber = function ():Number{
if (position === 1){
(byteInput.position = 0);
return (parseFloat(byteInput.readUTFBytes(byteInput.length)));
};
(byteInput.position = (position - 1));
do {
} while (isNumberChar[byteInput[position++]]);
return (Number(byteInput.readUTFBytes(((position-- - byteInput.position) - 1))));
};
parseWhitespace = function ():Object{
while (isWhitespace[byteInput[position]]) {
position++;
};
return (parse[byteInput[position++]]());
};
var parseStringEscaped:Function = function (result:String):String{
do {
if ((char = byteInput[position++]) === 117){
(byteInput.position = position);
(char = parseInt(byteInput.readUTFBytes(4), 16));
(position = (position + 4));
} else {
if (!(char = charConvert[char])){
throw (new Error(("Unknown escaped character encountered at position " + (position - 1))));
};
(byteInput.position = position);
};
result = (result + String.fromCharCode(char));
result;
do {
} while (stringHelper[byteInput[position++]]);
if ((position - 1) > byteInput.position){
result = (result + byteInput.readUTFBytes(((position - 1) - byteInput.position)));
result;
};
} while (byteInput[(position - 1)] === 92);
return (result);
};
parse = {34:function ():String{
if (stringHelper[byteInput[position++]]){
(byteInput.position = (position - 1));
do {
} while (stringHelper[byteInput[position++]]);
if (byteInput[(position - 1)] === 92){
return (parseStringEscaped(byteInput.readUTFBytes(((position - 1) - byteInput.position))));
};
return (byteInput.readUTFBytes(((position - 1) - byteInput.position)));
//unresolved jump
};
if (byteInput[(position - 1)] === 92){
return (parseStringEscaped(""));
};
return ("");
}, 123:function ():Object{
var key:*;
while (isWhitespace[byteInput[position]]) {
position++;
};
if (byteInput[position] === 125){
position++;
return ({});
};
var result:* = {};
do {
do {
key = parse[byteInput[position++]]();
key;
if (byteInput[position] !== 58){
while (isWhitespace[byteInput[position]]) {
position++;
};
if (byteInput[position++] !== 58){
throw (new Error(("Expected : at " + (position - 1))));
};
} else {
position++;
};
var _temp1 = key;
(result[_temp1] = parse[byteInput[position++]]());
} while (byteInput[position++] === 44);
if (byteInput[(position - 1)] === 125){
return (result);
};
while (isWhitespace[byteInput[position]]) {
position++;
};
} while (byteInput[position++] === 44);
if (byteInput[(position - 1)] !== 125){
throw (new Error(("Expected , or } at " + (position - 1))));
};
return (result);
}, 91:function ():Object{
while (isWhitespace[byteInput[position]]) {
position++;
};
if (byteInput[position] === 93){
position++;
return ([]);
};
var result:* = [];
do {
do {
(result[result.length] = parse[byteInput[position++]]());
} while (byteInput[position++] === 44);
if (byteInput[(position - 1)] === 93){
return (result);
};
position--;
while (isWhitespace[byteInput[position]]) {
position++;
};
} while (byteInput[position++] === 44);
if (byteInput[(position - 1)] !== 93){
throw (new Error(("Expected , or ] at " + (position - 1))));
};
return (result);
}, 116:function ():Boolean{
if ((((((byteInput[position] === 114)) && ((byteInput[(position + 1)] === 117)))) && ((byteInput[(position + 2)] === 101)))){
(position = (position + 3));
return (true);
};
throw (new Error(("Expected \"true\" at position " + position)));
}, 102:function ():Boolean{
if ((((((((byteInput[position] === 97)) && ((byteInput[(position + 1)] === 108)))) && ((byteInput[(position + 2)] === 115)))) && ((byteInput[(position + 3)] === 101)))){
(position = (position + 4));
return (false);
};
throw (new Error(("Expected \"false\" at position " + (position - 1))));
}, 110:function ():Object{
if ((((((byteInput[position] === 117)) && ((byteInput[(position + 1)] === 108)))) && ((byteInput[(position + 2)] === 108)))){
(position = (position + 3));
return (null);
};
throw (new Error(("Expected \"null\" at position " + position)));
}, 93:function ():void{
throw (new Error(("Unexpected end of array at " + position)));
}, 125:function ():void{
throw (new Error(("Unexpected end of object at " + position)));
}, 44:function ():void{
throw (new Error(("Unexpected comma at " + position)));
}, 45:parseNumber, 48:parseNumber, 49:parseNumber, 50:parseNumber, 51:parseNumber, 52:parseNumber, 53:parseNumber, 54:parseNumber, 55:parseNumber, 56:parseNumber, 57:parseNumber, 13:parseWhitespace, 10:parseWhitespace, 9:parseWhitespace, 32:parseWhitespace};
return (function (input, allowNativeJson:Boolean=false):Object{
var input = input;
var allowNativeJson = allowNativeJson;
if ((input is String)){
if (((nativeJson) && (allowNativeJson))){
return (nativeJson.parse(input));
};
(byteInput = new ByteArray());
byteInput.writeUTFBytes((input as String));
} else {
if ((input is ByteArray)){
(byteInput = (input as ByteArray));
} else {
throw (new Error((("Unexpected input <" + input) + ">")));
};
};
(position = 0);
return (parse[byteInput[position++]]());
//unresolved jump
var _slot1 = e;
if ((position - 1) < byteInput.length){
(input.message = ((((((((("Unexpected character " + String.fromCharCode(byteInput[(position - 1)])) + " (0x") + byteInput[(position - 1)].toString(16)) + ")") + " at position ") + (position - 1)) + " (") + input.message) + ")"));
};
throw (input);
return (null);
});
};
Section 3
//Base64 (com.dynamicflash.util.Base64)
package com.dynamicflash.util {
import flash.utils.*;
public class Base64 {
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public static const version:String = "1.0.0";
public function Base64(){
super();
throw (new Error("Base64 class is static container only"));
}
public static function encode(data:String):String{
var bytes:ByteArray = new ByteArray();
bytes.writeUTFBytes(data);
return (encodeByteArray(bytes));
}
public static function encodeByteArray(data:ByteArray):String{
var dataBuffer:Array;
var i:uint;
var j:uint;
var k:uint;
var output:String = "";
var outputBuffer:Array = new Array(4);
data.position = 0;
while (data.bytesAvailable > 0) {
dataBuffer = new Array();
i = 0;
while ((((i < 3)) && ((data.bytesAvailable > 0)))) {
dataBuffer[i] = data.readUnsignedByte();
i++;
};
outputBuffer[0] = ((dataBuffer[0] & 252) >> 2);
outputBuffer[1] = (((dataBuffer[0] & 3) << 4) | (dataBuffer[1] >> 4));
outputBuffer[2] = (((dataBuffer[1] & 15) << 2) | (dataBuffer[2] >> 6));
outputBuffer[3] = (dataBuffer[2] & 63);
j = dataBuffer.length;
while (j < 3) {
outputBuffer[(j + 1)] = 64;
j++;
};
k = 0;
while (k < outputBuffer.length) {
output = (output + BASE64_CHARS.charAt(outputBuffer[k]));
k++;
};
};
return (output);
}
public static function decode(data:String):String{
var bytes:ByteArray = decodeToByteArray(data);
return (bytes.readUTFBytes(bytes.length));
}
public static function decodeToByteArray(data:String):ByteArray{
var j:uint;
var k:uint;
var output:ByteArray = new ByteArray();
var dataBuffer:Array = new Array(4);
var outputBuffer:Array = new Array(3);
var i:uint;
while (i < data.length) {
j = 0;
while ((((j < 4)) && (((i + j) < data.length)))) {
dataBuffer[j] = BASE64_CHARS.indexOf(data.charAt((i + j)));
j++;
};
outputBuffer[0] = ((dataBuffer[0] << 2) + ((dataBuffer[1] & 48) >> 4));
outputBuffer[1] = (((dataBuffer[1] & 15) << 4) + ((dataBuffer[2] & 60) >> 2));
outputBuffer[2] = (((dataBuffer[2] & 3) << 6) + dataBuffer[3]);
k = 0;
while (k < outputBuffer.length) {
if (dataBuffer[(k + 1)] == 64){
break;
};
output.writeByte(outputBuffer[k]);
k++;
};
i = (i + 4);
};
output.position = 0;
return (output);
}
}
}//package com.dynamicflash.util
Section 4
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 5
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 6
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 7
//CheckBox (fl.controls.CheckBox)
package fl.controls {
import flash.display.*;
public class CheckBox extends LabelButton {
private static var defaultStyles:Object = {icon:null, upIcon:"CheckBox_upIcon", downIcon:"CheckBox_downIcon", overIcon:"CheckBox_overIcon", disabledIcon:"CheckBox_disabledIcon", selectedDisabledIcon:"CheckBox_selectedDisabledIcon", focusRectSkin:null, focusRectPadding:null, selectedUpIcon:"CheckBox_selectedUpIcon", selectedDownIcon:"CheckBox_selectedDownIcon", selectedOverIcon:"CheckBox_selectedOverIcon", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public static var createAccessibilityImplementation:Function;
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = (background.x - _local2);
uiFocusRect.y = (background.y - _local2);
uiFocusRect.width = (background.width + (_local2 << 1));
uiFocusRect.height = (background.height + (_local2 << 1));
};
}
override public function get autoRepeat():Boolean{
return (false);
}
override public function set autoRepeat(_arg1:Boolean):void{
}
override public function set toggle(_arg1:Boolean):void{
throw (new Error("Warning: You cannot change a CheckBox's toggle."));
}
override public function get toggle():Boolean{
return (true);
}
override protected function configUI():void{
var _local1:Shape;
var _local2:Graphics;
super.configUI();
super.toggle = true;
_local1 = new Shape();
_local2 = _local1.graphics;
_local2.beginFill(0, 0);
_local2.drawRect(0, 0, 100, 100);
_local2.endFill();
background = (_local1 as DisplayObject);
addChildAt(background, 0);
}
override protected function drawLayout():void{
var _local1:Number;
super.drawLayout();
_local1 = Number(getStyleValue("textPadding"));
switch (_labelPlacement){
case ButtonLabelPlacement.RIGHT:
icon.x = _local1;
textField.x = (icon.x + (icon.width + _local1));
background.width = ((textField.x + textField.width) + _local1);
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.LEFT:
icon.x = ((width - icon.width) - _local1);
textField.x = (((width - icon.width) - (_local1 * 2)) - textField.width);
background.width = ((textField.width + icon.width) + (_local1 * 3));
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.TOP:
case ButtonLabelPlacement.BOTTOM:
background.width = (Math.max(textField.width, icon.width) + (_local1 * 2));
background.height = ((textField.height + icon.height) + (_local1 * 3));
break;
};
background.x = Math.min((icon.x - _local1), (textField.x - _local1));
background.y = Math.min((icon.y - _local1), (textField.y - _local1));
}
override protected function drawBackground():void{
}
override protected function initializeAccessibility():void{
if (CheckBox.createAccessibilityImplementation != null){
CheckBox.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 8
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 9
//RadioButton (fl.controls.RadioButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import flash.ui.*;
public class RadioButton extends LabelButton implements IFocusManagerGroup {
protected var _value:Object;
protected var defaultGroupName:String;// = "RadioButtonGroup"
protected var _group:RadioButtonGroup;
private static var defaultStyles:Object = {icon:null, upIcon:"RadioButton_upIcon", downIcon:"RadioButton_downIcon", overIcon:"RadioButton_overIcon", disabledIcon:"RadioButton_disabledIcon", selectedDisabledIcon:"RadioButton_selectedDisabledIcon", selectedUpIcon:"RadioButton_selectedUpIcon", selectedDownIcon:"RadioButton_selectedDownIcon", selectedOverIcon:"RadioButton_selectedOverIcon", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public static var createAccessibilityImplementation:Function;
public function RadioButton(){
defaultGroupName = "RadioButtonGroup";
super();
mode = "border";
groupName = defaultGroupName;
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = (background.x - _local2);
uiFocusRect.y = (background.y - _local2);
uiFocusRect.width = (background.width + (_local2 * 2));
uiFocusRect.height = (background.height + (_local2 * 2));
};
}
private function setThis():void{
var _local1:RadioButtonGroup;
_local1 = _group;
if (_local1 != null){
if (_local1.selection != this){
_local1.selection = this;
};
} else {
super.selected = true;
};
}
override public function get autoRepeat():Boolean{
return (false);
}
override public function set autoRepeat(_arg1:Boolean):void{
}
protected function handleClick(_arg1:MouseEvent):void{
if (_group == null){
return;
};
_group.dispatchEvent(new MouseEvent(MouseEvent.CLICK, true));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.DOWN:
setNext(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.UP:
setPrev(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
setPrev(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.RIGHT:
setNext(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.SPACE:
setThis();
_toggle = false;
default:
super.keyDownHandler(_arg1);
break;
};
}
private function setNext(_arg1:Boolean=true):void{
var _local2:RadioButtonGroup;
var _local3:IFocusManager;
var _local4:int;
var _local5:Number;
var _local6:int;
var _local7:*;
_local2 = _group;
if (_local2 == null){
return;
};
_local3 = focusManager;
if (_local3){
_local3.showFocusIndicator = true;
};
_local4 = _local2.getRadioButtonIndex(this);
_local5 = _local2.numRadioButtons;
_local6 = _local4;
if (_local4 != -1){
do {
_local6++;
_local6 = ((_local6)>(_local2.numRadioButtons - 1)) ? 0 : _local6;
_local7 = _local2.getRadioButtonAt(_local6);
if (((_local7) && (_local7.enabled))){
if (_arg1){
_local2.selection = _local7;
};
_local7.setFocus();
return;
};
if (((_arg1) && (!((_local2.getRadioButtonAt(_local6) == _local2.selection))))){
_local2.selection = this;
};
this.drawFocus(true);
} while (_local6 != _local4);
};
}
public function get group():RadioButtonGroup{
return (_group);
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
super.keyUpHandler(_arg1);
if ((((_arg1.keyCode == Keyboard.SPACE)) && (!(_toggle)))){
_toggle = true;
};
}
override public function get selected():Boolean{
return (super.selected);
}
override public function set toggle(_arg1:Boolean):void{
throw (new Error("Warning: You cannot change a RadioButtons toggle."));
}
public function set value(_arg1:Object):void{
_value = _arg1;
}
public function set group(_arg1:RadioButtonGroup):void{
groupName = _arg1.name;
}
override public function set selected(_arg1:Boolean):void{
if ((((_arg1 == false)) || (selected))){
return;
};
if (_group != null){
_group.selection = this;
} else {
super.selected = _arg1;
};
}
override protected function draw():void{
super.draw();
}
override public function get toggle():Boolean{
return (true);
}
override protected function configUI():void{
var _local1:Shape;
var _local2:Graphics;
super.configUI();
super.toggle = true;
_local1 = new Shape();
_local2 = _local1.graphics;
_local2.beginFill(0, 0);
_local2.drawRect(0, 0, 100, 100);
_local2.endFill();
background = (_local1 as DisplayObject);
addChildAt(background, 0);
addEventListener(MouseEvent.CLICK, handleClick, false, 0, true);
}
public function set groupName(_arg1:String):void{
if (_group != null){
_group.removeRadioButton(this);
_group.removeEventListener(Event.CHANGE, handleChange);
};
_group = ((_arg1)==null) ? null : RadioButtonGroup.getGroup(_arg1);
if (_group != null){
_group.addRadioButton(this);
_group.addEventListener(Event.CHANGE, handleChange, false, 0, true);
};
}
public function get value():Object{
return (_value);
}
override protected function drawLayout():void{
var _local1:Number;
super.drawLayout();
_local1 = Number(getStyleValue("textPadding"));
switch (_labelPlacement){
case ButtonLabelPlacement.RIGHT:
icon.x = _local1;
textField.x = (icon.x + (icon.width + _local1));
background.width = ((textField.x + textField.width) + _local1);
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.LEFT:
icon.x = ((width - icon.width) - _local1);
textField.x = (((width - icon.width) - (_local1 * 2)) - textField.width);
background.width = ((textField.width + icon.width) + (_local1 * 3));
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.TOP:
case ButtonLabelPlacement.BOTTOM:
background.width = (Math.max(textField.width, icon.width) + (_local1 * 2));
background.height = ((textField.height + icon.height) + (_local1 * 3));
break;
};
background.x = Math.min((icon.x - _local1), (textField.x - _local1));
background.y = Math.min((icon.y - _local1), (textField.y - _local1));
}
override protected function drawBackground():void{
}
override protected function initializeAccessibility():void{
if (RadioButton.createAccessibilityImplementation != null){
RadioButton.createAccessibilityImplementation(this);
};
}
public function get groupName():String{
return (((_group)==null) ? null : _group.name);
}
private function setPrev(_arg1:Boolean=true):void{
var _local2:RadioButtonGroup;
var _local3:IFocusManager;
var _local4:int;
var _local5:int;
var _local6:*;
_local2 = _group;
if (_local2 == null){
return;
};
_local3 = focusManager;
if (_local3){
_local3.showFocusIndicator = true;
};
_local4 = _local2.getRadioButtonIndex(this);
_local5 = _local4;
if (_local4 != -1){
do {
--_local5;
_local5 = ((_local5)==-1) ? (_local2.numRadioButtons - 1) : _local5;
_local6 = _local2.getRadioButtonAt(_local5);
if (((_local6) && (_local6.enabled))){
if (_arg1){
_local2.selection = _local6;
};
_local6.setFocus();
return;
};
if (((_arg1) && (!((_local2.getRadioButtonAt(_local5) == _local2.selection))))){
_local2.selection = this;
};
this.drawFocus(true);
} while (_local5 != _local4);
};
}
protected function handleChange(_arg1:Event):void{
super.selected = (_group.selection == this);
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 10
//RadioButtonGroup (fl.controls.RadioButtonGroup)
package fl.controls {
import flash.events.*;
public class RadioButtonGroup extends EventDispatcher {
protected var _selection:RadioButton;
protected var radioButtons:Array;
protected var _name:String;
private static var groups:Object;
private static var groupCount:uint = 0;
public function RadioButtonGroup(_arg1:String){
_name = _arg1;
radioButtons = [];
registerGroup(this);
}
public function getRadioButtonIndex(_arg1:RadioButton):int{
var _local2:int;
var _local3:RadioButton;
_local2 = 0;
while (_local2 < radioButtons.length) {
_local3 = (radioButtons[_local2] as RadioButton);
if (_local3 == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function get numRadioButtons():int{
return (radioButtons.length);
}
public function get name():String{
return (_name);
}
public function get selection():RadioButton{
return (_selection);
}
public function set selection(_arg1:RadioButton):void{
if ((((((_selection == _arg1)) || ((_arg1 == null)))) || ((getRadioButtonIndex(_arg1) == -1)))){
return;
};
_selection = _arg1;
dispatchEvent(new Event(Event.CHANGE, true));
}
public function set selectedData(_arg1:Object):void{
var _local2:int;
var _local3:RadioButton;
_local2 = 0;
while (_local2 < radioButtons.length) {
_local3 = (radioButtons[_local2] as RadioButton);
if (_local3.value == _arg1){
selection = _local3;
return;
};
_local2++;
};
}
public function removeRadioButton(_arg1:RadioButton):void{
var _local2:int;
_local2 = getRadioButtonIndex(_arg1);
if (_local2 != -1){
radioButtons.splice(_local2, 1);
};
if (_selection == _arg1){
_selection = null;
};
}
public function addRadioButton(_arg1:RadioButton):void{
if (_arg1.groupName != name){
_arg1.groupName = name;
return;
};
radioButtons.push(_arg1);
if (_arg1.selected){
selection = _arg1;
};
}
public function getRadioButtonAt(_arg1:int):RadioButton{
return (RadioButton(radioButtons[_arg1]));
}
public function get selectedData():Object{
var _local1:RadioButton;
_local1 = _selection;
return (((_local1)==null) ? null : _local1.value);
}
public static function getGroup(_arg1:String):RadioButtonGroup{
var _local2:RadioButtonGroup;
if (groups == null){
groups = {};
};
_local2 = (groups[_arg1] as RadioButtonGroup);
if (_local2 == null){
_local2 = new RadioButtonGroup(_arg1);
if ((++groupCount % 20) == 0){
cleanUpGroups();
};
};
return (_local2);
}
private static function registerGroup(_arg1:RadioButtonGroup):void{
if (groups == null){
groups = {};
};
groups[_arg1.name] = _arg1;
}
private static function cleanUpGroups():void{
var _local1:String;
var _local2:RadioButtonGroup;
for (_local1 in groups) {
_local2 = (groups[_local1] as RadioButtonGroup);
if (_local2.radioButtons.length == 0){
delete groups[_local1];
};
};
}
}
}//package fl.controls
Section 11
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import flash.events.*;
import fl.core.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 12
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 13
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 14
//TextArea (fl.controls.TextArea)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.system.*;
import flash.ui.*;
public class TextArea extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _verticalScrollBar:UIScrollBar;
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _horizontalScrollBar:UIScrollBar;
protected var _horizontalScrollPolicy:String;// = "auto"
protected var _editable:Boolean;// = true
protected var textHasChanged:Boolean;// = false
public var textField:TextField;
protected var _wordWrap:Boolean;// = true
protected var _verticalScrollPolicy:String;// = "auto"
protected static const SCROLL_BAR_STYLES:Object = {downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {upSkin:"TextArea_upSkin", disabledSkin:"TextArea_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:3, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextArea(){
_editable = true;
_wordWrap = true;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
_html = false;
textHasChanged = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((!(enabled)) || (!(_verticalScrollBar.visible)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * _verticalScrollBar.lineScrollSize));
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, (_arg1.delta * _verticalScrollBar.lineScrollSize), _verticalScrollBar.scrollPosition));
}
public function get verticalScrollPosition():Number{
return (textField.scrollV);
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
textField.scrollV = _arg1;
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
return;
};
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
textHasChanged = true;
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (_editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
textField.wordWrap = _wordWrap;
textField.multiline = true;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
setIMEMode(true);
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (_local2){
if (editable){
_local2.showFocusIndicator = true;
};
_local2.defaultButtonEnabled = false;
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get wordWrap():Boolean{
return (_wordWrap);
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function get horizontalScrollBar():UIScrollBar{
return (_horizontalScrollBar);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseChildren = enabled;
invalidate(InvalidationType.STATE);
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():Number{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
invalidate(InvalidationType.DATA);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function get maxVerticalScrollPosition():int{
return (textField.maxScrollV);
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
textField.scrollH = _arg1;
}
public function get textHeight():Number{
drawNow();
return (textField.textHeight);
}
public function get textWidth():Number{
drawNow();
return (textField.textWidth);
}
public function get restrict():String{
return (textField.restrict);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
invalidate(InvalidationType.STATE);
}
protected function updateScrollBars(){
_horizontalScrollBar.update();
_verticalScrollBar.update();
_verticalScrollBar.enabled = enabled;
_horizontalScrollBar.enabled = enabled;
_horizontalScrollBar.drawNow();
_verticalScrollBar.drawNow();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():Number{
return (textField.text.length);
}
public function set wordWrap(_arg1:Boolean):void{
_wordWrap = _arg1;
invalidate(InvalidationType.STATE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (IME.conversionMode);
}
protected function handleScroll(_arg1:ScrollEvent):void{
dispatchEvent(_arg1);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
_local2 = focusManager;
if (_local2){
_local2.defaultButtonEnabled = true;
};
setSelection(0, 0);
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
protected function delayedLayoutUpdate(_arg1:Event):void{
if (textHasChanged){
textHasChanged = false;
drawLayout();
return;
};
removeEventListener(Event.ENTER_FRAME, delayedLayoutUpdate);
}
public function set htmlText(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
return;
};
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
textHasChanged = true;
}
public function get text():String{
return (textField.text);
}
public function get verticalScrollBar():UIScrollBar{
return (_verticalScrollBar);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STATE)){
updateTextFieldType();
};
if (isInvalid(InvalidationType.STYLES)){
setStyles();
setEmbedFont();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.DATA)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
_verticalScrollBar = new UIScrollBar();
_verticalScrollBar.name = "V";
_verticalScrollBar.visible = false;
_verticalScrollBar.focusEnabled = false;
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
addChild(_verticalScrollBar);
_horizontalScrollBar = new UIScrollBar();
_horizontalScrollBar.name = "H";
_horizontalScrollBar.visible = false;
_horizontalScrollBar.focusEnabled = false;
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
addChild(_horizontalScrollBar);
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
_horizontalScrollBar.scrollTarget = textField;
_verticalScrollBar.scrollTarget = textField;
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function setTextSize(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number;
var _local5:Number;
_local4 = (_arg1 - (_arg3 * 2));
_local5 = (_arg2 - (_arg3 * 2));
if (_local4 != textField.width){
textField.width = _local4;
};
if (_local5 != textField.height){
textField.height = _local5;
};
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
invalidate(InvalidationType.DATA);
}
protected function needVScroll():Boolean{
if (_verticalScrollPolicy == ScrollPolicy.OFF){
return (false);
};
if (_verticalScrollPolicy == ScrollPolicy.ON){
return (true);
};
return ((textField.maxScrollV > 1));
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
public function get htmlText():String{
return (textField.htmlText);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background != null){
addChildAt(background, 0);
};
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
var _local5:Boolean;
_local1 = Number(getStyleValue("textPadding"));
textField.x = (textField.y = _local1);
background.width = width;
background.height = height;
_local2 = height;
_local3 = needVScroll();
_local4 = (width - (_local3) ? _verticalScrollBar.width : 0);
_local5 = needHScroll();
if (_local5){
_local2 = (_local2 - _horizontalScrollBar.height);
};
setTextSize(_local4, _local2, _local1);
if (((((_local5) && (!(_local3)))) && (needVScroll()))){
_local3 = true;
_local4 = (_local4 - _verticalScrollBar.width);
setTextSize(_local4, _local2, _local1);
};
if (_local3){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = (width - _verticalScrollBar.width);
_verticalScrollBar.height = _local2;
_verticalScrollBar.visible = true;
_verticalScrollBar.enabled = enabled;
} else {
_verticalScrollBar.visible = false;
};
if (_local5){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.y = (height - _horizontalScrollBar.height);
_horizontalScrollBar.width = _local4;
_horizontalScrollBar.visible = true;
_horizontalScrollBar.enabled = enabled;
} else {
_horizontalScrollBar.visible = false;
};
updateScrollBars();
addEventListener(Event.ENTER_FRAME, delayedLayoutUpdate, false, 0, true);
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function needHScroll():Boolean{
if (_horizontalScrollPolicy == ScrollPolicy.OFF){
return (false);
};
if (_horizontalScrollPolicy == ScrollPolicy.ON){
return (true);
};
return ((textField.maxScrollH > 0));
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
invalidate(InvalidationType.DATA);
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 15
//TextInput (fl.controls.TextInput)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 16
//UIScrollBar (fl.controls.UIScrollBar)
package fl.controls {
import flash.events.*;
import fl.core.*;
import flash.text.*;
import fl.events.*;
public class UIScrollBar extends ScrollBar {
protected var inScroll:Boolean;// = false
protected var _scrollTarget:TextField;
protected var inEdit:Boolean;// = false
private static var defaultStyles:Object = {};
public function UIScrollBar(){
inEdit = false;
inScroll = false;
super();
}
protected function handleTargetScroll(_arg1:Event):void{
if (inDrag){
return;
};
if (!enabled){
return;
};
inEdit = true;
updateScrollTargetProperties();
scrollPosition = ((direction)==ScrollBarDirection.HORIZONTAL) ? _scrollTarget.scrollH : _scrollTarget.scrollV;
inEdit = false;
}
override public function set minScrollPosition(_arg1:Number):void{
super.minScrollPosition = ((_arg1)<0) ? 0 : _arg1;
}
override public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
super.setScrollPosition(_arg1, _arg2);
if (!_scrollTarget){
inScroll = false;
return;
};
updateTargetScroll();
}
override public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
var _local5:Number;
var _local6:Number;
_local5 = _arg3;
_local6 = ((_arg2)<0) ? 0 : _arg2;
if (_scrollTarget != null){
if (direction == ScrollBarDirection.HORIZONTAL){
_local5 = ((_arg3)>_scrollTarget.maxScrollH) ? _scrollTarget.maxScrollH : _local5;
} else {
_local5 = ((_arg3)>_scrollTarget.maxScrollV) ? _scrollTarget.maxScrollV : _local5;
};
};
super.setScrollProperties(_arg1, _local6, _local5, _arg4);
}
public function get scrollTargetName():String{
return (_scrollTarget.name);
}
public function get scrollTarget():TextField{
return (_scrollTarget);
}
protected function updateScrollTargetProperties():void{
var _local1:Boolean;
var _local2:Number;
if (_scrollTarget == null){
setScrollProperties(pageSize, minScrollPosition, maxScrollPosition, pageScrollSize);
scrollPosition = 0;
} else {
_local1 = (direction == ScrollBarDirection.HORIZONTAL);
_local2 = (_local1) ? _scrollTarget.width : 10;
setScrollProperties(_local2, (_local1) ? 0 : 1, (_local1) ? _scrollTarget.maxScrollH : _scrollTarget.maxScrollV, pageScrollSize);
scrollPosition = (_local1) ? _scrollTarget.scrollH : _scrollTarget.scrollV;
};
}
public function update():void{
inEdit = true;
updateScrollTargetProperties();
inEdit = false;
}
public function set scrollTargetName(_arg1:String):void{
var target = _arg1;
try {
scrollTarget = (parent.getChildByName(target) as TextField);
} catch(error:Error) {
throw (new Error("ScrollTarget not found, or is not a TextField"));
};
}
override public function set direction(_arg1:String):void{
if (isLivePreview){
return;
};
super.direction = _arg1;
updateScrollTargetProperties();
}
protected function handleTargetChange(_arg1:Event):void{
inEdit = true;
setScrollPosition(((direction)==ScrollBarDirection.HORIZONTAL) ? _scrollTarget.scrollH : _scrollTarget.scrollV, true);
updateScrollTargetProperties();
inEdit = false;
}
override public function set maxScrollPosition(_arg1:Number):void{
var _local2:Number;
_local2 = _arg1;
if (_scrollTarget != null){
if (direction == ScrollBarDirection.HORIZONTAL){
_local2 = ((_local2)>_scrollTarget.maxScrollH) ? _scrollTarget.maxScrollH : _local2;
} else {
_local2 = ((_local2)>_scrollTarget.maxScrollV) ? _scrollTarget.maxScrollV : _local2;
};
};
super.maxScrollPosition = _local2;
}
protected function updateTargetScroll(_arg1:ScrollEvent=null):void{
if (inEdit){
return;
};
if (direction == ScrollBarDirection.HORIZONTAL){
_scrollTarget.scrollH = scrollPosition;
} else {
_scrollTarget.scrollV = scrollPosition;
};
}
override protected function draw():void{
if (isInvalid(InvalidationType.DATA)){
updateScrollTargetProperties();
};
super.draw();
}
public function set scrollTarget(_arg1:TextField):void{
if (_scrollTarget != null){
_scrollTarget.removeEventListener(Event.CHANGE, handleTargetChange, false);
_scrollTarget.removeEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false);
_scrollTarget.removeEventListener(Event.SCROLL, handleTargetScroll, false);
removeEventListener(ScrollEvent.SCROLL, updateTargetScroll, false);
};
_scrollTarget = _arg1;
if (_scrollTarget != null){
_scrollTarget.addEventListener(Event.CHANGE, handleTargetChange, false, 0, true);
_scrollTarget.addEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false, 0, true);
_scrollTarget.addEventListener(Event.SCROLL, handleTargetScroll, false, 0, true);
addEventListener(ScrollEvent.SCROLL, updateTargetScroll, false, 0, true);
};
invalidate(InvalidationType.DATA);
}
override public function get direction():String{
return (super.direction);
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 17
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 18
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 19
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.managers.*;
import flash.text.*;
import fl.events.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 20
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 21
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 22
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import flash.display.*;
import flash.events.*;
import fl.controls.*;
import fl.core.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 23
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import flash.display.*;
import fl.controls.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 24
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 25
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 26
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 27
//Bounce (fl.motion.easing.Bounce)
package fl.motion.easing {
public class Bounce {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 - easeOut((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeIn((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOut(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
}
}//package fl.motion.easing
Section 28
//Elastic (fl.motion.easing.Elastic)
package fl.motion.easing {
public class Elastic {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) + _arg3) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) * 0.5) + _arg3) + _arg2));
}
}
}//package fl.motion.easing
Section 29
//Linear (fl.motion.easing.Linear)
package fl.motion.easing {
public class Linear {
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.motion.easing
Section 30
//Sine (fl.motion.easing.Sine)
package fl.motion.easing {
public class Sine {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
}
}//package fl.motion.easing
Section 31
//Bounce (fl.transitions.easing.Bounce)
package fl.transitions.easing {
public class Bounce {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 - easeOut((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeIn((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOut(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
}
}//package fl.transitions.easing
Section 32
//Regular (fl.transitions.easing.Regular)
package fl.transitions.easing {
public class Regular {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
}
}//package fl.transitions.easing
Section 33
//Tween (fl.transitions.Tween)
package fl.transitions {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Tween extends EventDispatcher {
public var isPlaying:Boolean;// = false
public var obj:Object;// = null
public var prop:String;// = ""
public var func:Function;
public var begin:Number;// = NAN
public var change:Number;// = NAN
public var useSeconds:Boolean;// = false
public var prevTime:Number;// = NAN
public var prevPos:Number;// = NAN
public var looping:Boolean;// = false
private var _duration:Number;// = NAN
private var _time:Number;// = NAN
private var _fps:Number;// = NAN
private var _position:Number;// = NAN
private var _startTime:Number;// = NAN
private var _intervalID:uint;// = 0
private var _finish:Number;// = NAN
private var _timer:Timer;// = null
protected static var _mc:MovieClip = new MovieClip();
public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
this.func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
};
super();
if (!arguments.length){
return;
};
this.obj = _arg1;
this.prop = _arg2;
this.begin = _arg4;
this.position = _arg4;
this.duration = _arg6;
this.useSeconds = _arg7;
if ((_arg3 is Function)){
this.func = _arg3;
};
this.finish = _arg5;
this._timer = new Timer(100);
this.start();
}
public function get time():Number{
return (this._time);
}
public function set time(_arg1:Number):void{
this.prevTime = this._time;
if (_arg1 > this.duration){
if (this.looping){
this.rewind((_arg1 - this._duration));
this.update();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
} else {
if (this.useSeconds){
this._time = this._duration;
this.update();
};
this.stop();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
};
} else {
if (_arg1 < 0){
this.rewind();
this.update();
} else {
this._time = _arg1;
this.update();
};
};
}
public function get duration():Number{
return (this._duration);
}
public function set duration(_arg1:Number):void{
this._duration = ((_arg1)<=0) ? Infinity : _arg1;
}
public function get FPS():Number{
return (this._fps);
}
public function set FPS(_arg1:Number):void{
var _local2:Boolean = this.isPlaying;
this.stopEnterFrame();
this._fps = _arg1;
if (_local2){
this.startEnterFrame();
};
}
public function get position():Number{
return (this.getPosition(this._time));
}
public function set position(_arg1:Number):void{
this.setPosition(_arg1);
}
public function getPosition(_arg1:Number=NaN):Number{
if (isNaN(_arg1)){
_arg1 = this._time;
};
return (this.func(_arg1, this.begin, this.change, this._duration));
}
public function setPosition(_arg1:Number):void{
this.prevPos = this._position;
if (this.prop.length){
this.obj[this.prop] = (this._position = _arg1);
};
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
}
public function get finish():Number{
return ((this.begin + this.change));
}
public function set finish(_arg1:Number):void{
this.change = (_arg1 - this.begin);
}
public function continueTo(_arg1:Number, _arg2:Number):void{
this.begin = this.position;
this.finish = _arg1;
if (!isNaN(_arg2)){
this.duration = _arg2;
};
this.start();
}
public function yoyo():void{
this.continueTo(this.begin, this.time);
}
protected function startEnterFrame():void{
var _local1:Number;
if (isNaN(this._fps)){
_mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
} else {
_local1 = (1000 / this._fps);
this._timer.delay = _local1;
this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
this._timer.start();
};
this.isPlaying = true;
}
protected function stopEnterFrame():void{
if (isNaN(this._fps)){
_mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
} else {
this._timer.stop();
};
this.isPlaying = false;
}
public function start():void{
this.rewind();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
}
public function stop():void{
this.stopEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
}
public function resume():void{
this.fixTime();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
}
public function rewind(_arg1:Number=0):void{
this._time = _arg1;
this.fixTime();
this.update();
}
public function fforward():void{
this.time = this._duration;
this.fixTime();
}
public function nextFrame():void{
if (this.useSeconds){
this.time = ((getTimer() - this._startTime) / 1000);
} else {
this.time = (this._time + 1);
};
}
protected function onEnterFrame(_arg1:Event):void{
this.nextFrame();
}
protected function timerHandler(_arg1:TimerEvent):void{
this.nextFrame();
_arg1.updateAfterEvent();
}
public function prevFrame():void{
if (!this.useSeconds){
this.time = (this._time - 1);
};
}
private function fixTime():void{
if (this.useSeconds){
this._startTime = (getTimer() - (this._time * 1000));
};
}
private function update():void{
this.setPosition(this.getPosition(this._time));
}
}
}//package fl.transitions
Section 34
//TweenEvent (fl.transitions.TweenEvent)
package fl.transitions {
import flash.events.*;
public class TweenEvent extends Event {
public var time:Number;// = NAN
public var position:Number;// = NAN
public static const MOTION_START:String = "motionStart";
public static const MOTION_STOP:String = "motionStop";
public static const MOTION_FINISH:String = "motionFinish";
public static const MOTION_CHANGE:String = "motionChange";
public static const MOTION_RESUME:String = "motionResume";
public static const MOTION_LOOP:String = "motionLoop";
public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
this.time = _arg2;
this.position = _arg3;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
}
}
}//package fl.transitions
Section 35
//AutoLayoutEvent (fl.video.AutoLayoutEvent)
package fl.video {
import flash.events.*;
import flash.geom.*;
public class AutoLayoutEvent extends LayoutEvent implements IVPEvent {
private var _vp:uint;
public static const AUTO_LAYOUT:String = "autoLayout";
public function AutoLayoutEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Rectangle=null, _arg5:Rectangle=null, _arg6:uint=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
_vp = _arg6;
}
override public function clone():Event{
return (new AutoLayoutEvent(type, bubbles, cancelable, Rectangle(oldBounds.clone()), Rectangle(oldRegistrationBounds.clone()), vp));
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
public function get vp():uint{
return (_vp);
}
}
}//package fl.video
Section 36
//ConnectClient (fl.video.ConnectClient)
package fl.video {
import flash.net.*;
public class ConnectClient {
public var connIndex:uint;
public var nc:NetConnection;
public var pending:Boolean;
public var owner:NCManager;
public function ConnectClient(_arg1:NCManager, _arg2:NetConnection, _arg3:uint=0){
this.owner = _arg1;
this.nc = _arg2;
this.connIndex = _arg3;
this.pending = false;
}
public function onBWCheck(... _args):Number{
return (++owner._payload);
}
public function onBWDone(... _args):void{
var _local2:Number;
if (_args.length > 0){
_local2 = _args[0];
};
owner.onConnected(nc, _local2);
}
public function close():void{
}
}
}//package fl.video
Section 37
//ControlData (fl.video.ControlData)
package fl.video {
import flash.display.*;
public class ControlData {
public var state_mc:Array;
public var origWidth:Number;
public var handle_mc:Sprite;
public var state:uint;
public var leftMargin:Number;
public var fullness_mc:DisplayObject;
public var isDragging:Boolean;
public var currentState_mc:DisplayObject;
public var percentage:Number;
public var owner:DisplayObject;
public var origX:Number;
public var origY:Number;
public var bottomMargin:Number;
public var disabled_mc:DisplayObject;
public var enabled:Boolean;
public var hit_mc:Sprite;
public var origHeight:Number;
public var index:int;
public var mask_mc:DisplayObject;
public var avatar:DisplayObject;
public var fill_mc:DisplayObject;
public var topMargin:Number;
public var uiMgr:UIManager;
public var progress_mc:DisplayObject;
public var rightMargin:Number;
public var ctrl:DisplayObject;
public var origScaleX:Number;
public var origScaleY:Number;
public function ControlData(_arg1:UIManager, _arg2:DisplayObject, _arg3:DisplayObject, _arg4:int){
var uiMgr = _arg1;
var ctrl = _arg2;
var owner = _arg3;
var index = _arg4;
super();
this.uiMgr = uiMgr;
this.index = index;
this.ctrl = ctrl;
this.owner = owner;
try {
ctrl["uiMgr"] = uiMgr;
} catch(re:ReferenceError) {
};
}
}
}//package fl.video
Section 38
//CuePointManager (fl.video.CuePointManager)
package fl.video {
public class CuePointManager {
flvplayback_internal var _disabledCuePointsByNameOnly:Object;
flvplayback_internal var navCuePoints:Array;
flvplayback_internal var allCuePoints:Array;
flvplayback_internal var _disabledCuePoints:Array;
flvplayback_internal var _asCuePointTolerance:Number;
flvplayback_internal var _linearSearchTolerance:Number;
flvplayback_internal var _asCuePointIndex:int;
flvplayback_internal var asCuePoints:Array;
flvplayback_internal var flvCuePoints:Array;
flvplayback_internal var _metadataLoaded:Boolean;
flvplayback_internal var _id:uint;
private var _owner:FLVPlayback;
flvplayback_internal var eventCuePoints:Array;
public static const SHORT_VERSION:String = "2.1";
public static const VERSION:String = "2.1.0.14";
flvplayback_internal static const DEFAULT_LINEAR_SEARCH_TOLERANCE:Number = 50;
flvplayback_internal static var cuePointsReplace:Array = [""", "\"", "'", "'", ",", ",", "&", "&"];
public function CuePointManager(_arg1:FLVPlayback, _arg2:uint){
_owner = _arg1;
_id = _arg2;
reset();
_asCuePointTolerance = (_owner.getVideoPlayer(_id).playheadUpdateInterval / 2000);
_linearSearchTolerance = DEFAULT_LINEAR_SEARCH_TOLERANCE;
}
flvplayback_internal function getCuePoint(_arg1:Array, _arg2:Boolean, _arg3):Object{
var _local4:Object;
var _local5:int;
switch (typeof(_arg3)){
case "string":
_local4 = {name:_arg3};
break;
case "number":
_local4 = {time:_arg3};
break;
case "object":
_local4 = _arg3;
break;
};
_local5 = getCuePointIndex(_arg1, _arg2, _local4.time, _local4.name);
if (_local5 < 0){
return (null);
};
_local4 = deepCopyObject(_arg1[_local5]);
_local4.array = _arg1;
_local4.index = _local5;
return (_local4);
}
public function resetASCuePointIndex(_arg1:Number):void{
var _local2:int;
if ((((_arg1 <= 0)) || ((asCuePoints == null)))){
_asCuePointIndex = 0;
return;
};
_local2 = getCuePointIndex(asCuePoints, true, _arg1);
_asCuePointIndex = ((asCuePoints[_local2].time)<_arg1) ? (_local2 + 1) : _local2;
}
public function set playheadUpdateInterval(_arg1:Number):void{
_asCuePointTolerance = (_arg1 / 2000);
}
flvplayback_internal function addOrDisable(_arg1:Boolean, _arg2:Object):void{
if (_arg1){
if (_arg2.type == CuePointType.ACTIONSCRIPT){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "Cannot disable actionscript cue points"));
};
setFLVCuePointEnabled(false, _arg2);
} else {
if (_arg2.type == CuePointType.ACTIONSCRIPT){
addASCuePoint(_arg2);
};
};
}
public function processFLVCuePoints(_arg1:Array):void{
var _local2:int;
var _local3:Number;
var _local4:Object;
var _local5:Array;
var _local6:Number;
var _local7:int;
_metadataLoaded = true;
if ((((_arg1 == null)) || ((_arg1.length < 1)))){
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
return;
};
flvCuePoints = _arg1;
navCuePoints = new Array();
eventCuePoints = new Array();
_local3 = -1;
_local5 = _disabledCuePoints;
_local6 = 0;
_disabledCuePoints = new Array();
_local7 = 0;
while ((_local4 = flvCuePoints[_local7++]) != undefined) {
if ((((_local3 > 0)) && ((_local3 >= _local4.time)))){
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
_disabledCuePoints = new Array();
_disabledCuePointsByNameOnly = new Object();
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, ("Unsorted cuePoint found after time: " + _local3)));
};
_local3 = _local4.time;
while ((((_local6 < _local5.length)) && ((cuePointCompare(_local5[_local6].time, null, _local4) < 0)))) {
_local6++;
};
if (((!((_disabledCuePointsByNameOnly[_local4.name] == undefined))) || ((((_local6 < _local5.length)) && ((cuePointCompare(_local5[_local6].time, _local5[_local6].name, _local4) == 0)))))){
_disabledCuePoints.push({time:_local4.time, name:_local4.name});
};
if (_local4.type == CuePointType.NAVIGATION){
navCuePoints.push(_local4);
} else {
if (_local4.type == CuePointType.EVENT){
eventCuePoints.push(_local4);
};
};
if ((((allCuePoints == null)) || ((allCuePoints.length < 1)))){
allCuePoints = new Array();
allCuePoints.push(_local4);
} else {
_local2 = getCuePointIndex(allCuePoints, true, _local4.time);
_local2 = ((allCuePoints[_local2].time)>_local4.time) ? 0 : (_local2 + 1);
allCuePoints.splice(_local2, 0, _local4);
};
};
_disabledCuePointsByNameOnly = new Object();
}
public function addASCuePoint(_arg1, _arg2:String=null, _arg3:Object=null):Object{
var _local4:Object;
var _local5:Boolean;
var _local6:Boolean;
var _local7:int;
var _local8:Number;
var _local9:Object;
var _local10:int;
if (typeof(_arg1) == "object"){
_local4 = deepCopyObject(_arg1);
} else {
_local4 = {time:_arg1, name:_arg2, parameters:deepCopyObject(_arg3)};
};
if (_local4.parameters == null){
delete _local4.parameters;
};
_local5 = ((isNaN(_local4.time)) || ((_local4.time < 0)));
if (_local5){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
_local6 = (_local4.name == null);
if (_local6){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be undefined or null"));
};
_local4.type = CuePointType.ACTIONSCRIPT;
if ((((asCuePoints == null)) || ((asCuePoints.length < 1)))){
_local7 = 0;
asCuePoints = new Array();
asCuePoints.push(_local4);
} else {
_local7 = getCuePointIndex(asCuePoints, true, _local4.time);
_local7 = ((asCuePoints[_local7].time)>_local4.time) ? 0 : (_local7 + 1);
asCuePoints.splice(_local7, 0, _local4);
};
if ((((allCuePoints == null)) || ((allCuePoints.length < 1)))){
allCuePoints = new Array();
allCuePoints.push(_local4);
} else {
_local10 = getCuePointIndex(allCuePoints, true, _local4.time);
_local10 = ((allCuePoints[_local10].time)>_local4.time) ? 0 : (_local10 + 1);
allCuePoints.splice(_local10, 0, _local4);
};
_local8 = _owner.getVideoPlayer(_id).playheadTime;
if (_local8 > 0){
if (_asCuePointIndex == _local7){
if (_local8 > asCuePoints[_local7].time){
_asCuePointIndex++;
};
} else {
if (_asCuePointIndex > _local7){
_asCuePointIndex++;
};
};
} else {
_asCuePointIndex = 0;
};
_local9 = deepCopyObject(asCuePoints[_local7]);
_local9.array = asCuePoints;
_local9.index = _local7;
return (_local9);
}
public function get metadataLoaded():Boolean{
return (_metadataLoaded);
}
public function reset():void{
_metadataLoaded = false;
allCuePoints = null;
asCuePoints = null;
_disabledCuePoints = new Array();
_disabledCuePointsByNameOnly = new Object();
flvCuePoints = null;
navCuePoints = null;
eventCuePoints = null;
_asCuePointIndex = 0;
}
public function removeCuePoints(_arg1:Array, _arg2:Object):Number{
var _local3:int;
var _local4:Object;
var _local5:int;
_local5 = 0;
_local3 = getCuePointIndex(_arg1, true, -1, _arg2.name);
while (_local3 >= 0) {
_local4 = _arg1[_local3];
_arg1.splice(_local3, 1);
_local3--;
_local5++;
_local3 = getNextCuePointIndexWithName(_local4.name, _arg1, _local3);
};
return (_local5);
}
flvplayback_internal function unescape(_arg1:String):String{
var _local2:String;
var _local3:int;
_local2 = _arg1;
_local3 = 0;
while (_local3 < cuePointsReplace.length) {
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _temp2 = _local3;
_local3 = (_local3 + 1);
_local2 = _local2.replace(cuePointsReplace[_temp1], cuePointsReplace[_temp2]);
};
return (_local2);
}
public function setFLVCuePointEnabled(_arg1:Boolean, _arg2):int{
var _local3:Object;
var _local4:Boolean;
var _local5:Boolean;
var _local6:uint;
var _local7:int;
var _local8:int;
var _local9:Object;
switch (typeof(_arg2)){
case "string":
_local3 = {name:_arg2};
break;
case "number":
_local3 = {time:_arg2};
break;
case "object":
_local3 = _arg2;
break;
};
_local4 = ((isNaN(_local3.time)) || ((_local3.time < 0)));
_local5 = (_local3.name == null);
if (((_local4) && (_local5))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
_local6 = 0;
if (_local4){
if (!_metadataLoaded){
if (_disabledCuePointsByNameOnly[_local3.name] == undefined){
if (!_arg1){
_disabledCuePointsByNameOnly[_local3.name] = new Array();
};
} else {
if (_arg1){
delete _disabledCuePointsByNameOnly[_local3.name];
};
return (-1);
};
removeCuePoints(_disabledCuePoints, _local3);
return (-1);
};
if (_arg1){
_local6 = removeCuePoints(_disabledCuePoints, _local3);
} else {
_local7 = getCuePointIndex(flvCuePoints, true, -1, _local3.name);
while (_local7 >= 0) {
_local9 = flvCuePoints[_local7];
_local8 = getCuePointIndex(_disabledCuePoints, true, _local9.time);
if ((((_local8 < 0)) || (!((_disabledCuePoints[_local8].time == _local9.time))))){
_disabledCuePoints = insertCuePoint(_local8, _disabledCuePoints, {name:_local9.name, time:_local9.time});
_local6 = (_local6 + 1);
};
_local7 = getNextCuePointIndexWithName(_local9.name, flvCuePoints, _local7);
};
};
return (_local6);
};
_local7 = getCuePointIndex(_disabledCuePoints, false, _local3.time, _local3.name);
if (_local7 < 0){
if (_arg1){
if (!_metadataLoaded){
_local7 = getCuePointIndex(_disabledCuePoints, false, _local3.time);
if (_local7 < 0){
_local8 = getCuePointIndex(_disabledCuePointsByNameOnly[_local3.name], true, _local3.time);
if (cuePointCompare(_local3.time, null, _disabledCuePointsByNameOnly[_local3.name]) != 0){
_disabledCuePointsByNameOnly[_local3.name] = insertCuePoint(_local8, _disabledCuePointsByNameOnly[_local3.name], _local3);
};
} else {
_disabledCuePoints.splice(_local7, 1);
};
};
return ((_metadataLoaded) ? 0 : -1);
};
} else {
if (_arg1){
_disabledCuePoints.splice(_local7, 1);
_local6 = 1;
} else {
_local6 = 0;
};
return ((_metadataLoaded) ? _local6 : -1);
};
if (_metadataLoaded){
_local7 = getCuePointIndex(flvCuePoints, false, _local3.time, _local3.name);
if (_local7 < 0){
return (0);
};
if (_local5){
_local3.name = flvCuePoints[_local7].name;
};
};
_local8 = getCuePointIndex(_disabledCuePoints, true, _local3.time);
_disabledCuePoints = insertCuePoint(_local8, _disabledCuePoints, _local3);
_local6 = 1;
return ((_metadataLoaded) ? _local6 : -1);
}
public function isFLVCuePointEnabled(_arg1):Boolean{
var _local2:Object;
var _local3:Boolean;
var _local4:Boolean;
var _local5:int;
if (!_metadataLoaded){
return (true);
};
switch (typeof(_arg1)){
case "string":
_local2 = {name:_arg1};
break;
case "number":
_local2 = {time:_arg1};
break;
case "object":
_local2 = _arg1;
break;
};
_local3 = ((isNaN(_local2.time)) || ((_local2.time < 0)));
_local4 = (_local2.name == null);
if (((_local3) && (_local4))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
if (_local3){
_local5 = getCuePointIndex(flvCuePoints, true, -1, _local2.name);
if (_local5 < 0){
return (true);
};
while (_local5 >= 0) {
if (getCuePointIndex(_disabledCuePoints, false, flvCuePoints[_local5].time, flvCuePoints[_local5].name) < 0){
return (true);
};
_local5 = getNextCuePointIndexWithName(_local2.name, flvCuePoints, _local5);
};
return (false);
};
return ((getCuePointIndex(_disabledCuePoints, false, _local2.time, _local2.name) < 0));
}
public function removeASCuePoint(_arg1):Object{
var _local2:Object;
var _local3:int;
if ((((asCuePoints == null)) || ((asCuePoints.length < 1)))){
return (null);
};
switch (typeof(_arg1)){
case "string":
_local2 = {name:_arg1};
break;
case "number":
_local2 = {time:_arg1};
break;
case "object":
_local2 = _arg1;
break;
};
_local3 = getCuePointIndex(asCuePoints, false, _local2.time, _local2.name);
if (_local3 < 0){
return (null);
};
_local2 = asCuePoints[_local3];
asCuePoints.splice(_local3, 1);
_local3 = getCuePointIndex(allCuePoints, false, _local2.time, _local2.name);
if (_local3 > 0){
allCuePoints.splice(_local3, 1);
};
if (_owner.getVideoPlayer(_id).playheadTime > 0){
if (_asCuePointIndex > _local3){
_asCuePointIndex--;
};
} else {
_asCuePointIndex = 0;
};
return (_local2);
}
public function get id():uint{
return (_id);
}
public function processCuePointsProperty(_arg1:Array):void{
var _local2:uint;
var _local3:uint;
var _local4:String;
var _local5:String;
var _local6:Object;
var _local7:Boolean;
var _local8:int;
if ((((_arg1 == null)) || ((_arg1.length == 0)))){
return;
};
_local2 = 0;
_local8 = 0;
while (_local8 < (_arg1.length - 1)) {
switch (_local2){
case 6:
addOrDisable(_local7, _local6);
_local2 = 0;
case 0:
var _temp1 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp1] != "t"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
_local6 = new Object();
_local6.time = (_arg1[_local8] / 1000);
_local2++;
break;
case 1:
var _temp2 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp2] != "n"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (_arg1[_local8] == undefined){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be null or undefined"));
};
_local6.name = unescape(_arg1[_local8]);
_local2++;
break;
case 2:
var _temp3 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp3] != "t"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "type must be number"));
};
switch (_arg1[_local8]){
case 0:
_local6.type = CuePointType.EVENT;
break;
case 1:
_local6.type = CuePointType.NAVIGATION;
break;
case 2:
_local6.type = CuePointType.ACTIONSCRIPT;
break;
default:
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "type must be 0, 1 or 2"));
};
_local2++;
break;
case 3:
var _temp4 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp4] != "d"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "disabled must be number"));
};
_local7 = !((_arg1[_local8] == 0));
_local2++;
break;
case 4:
var _temp5 = _local8;
_local8 = (_local8 + 1);
if (_arg1[_temp5] != "p"){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected cuePoint parameter format"));
};
if (isNaN(_arg1[_local8])){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "num params must be number"));
};
_local3 = _arg1[_local8];
_local2++;
if (_local3 == 0){
_local2++;
} else {
_local6.parameters = new Object();
};
break;
case 5:
var _temp6 = _local8;
_local8 = (_local8 + 1);
_local4 = _arg1[_temp6];
_local5 = _arg1[_local8];
if ((_local4 is String)){
_local4 = unescape(_local4);
};
if ((_local5 is String)){
_local5 = unescape(_local5);
};
_local6.parameters[_local4] = _local5;
_local3--;
if (_local3 == 0){
_local2++;
};
break;
};
_local8++;
};
if (_local2 == 6){
addOrDisable(_local7, _local6);
} else {
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "unexpected end of cuePoint param string"));
};
}
flvplayback_internal function getNextCuePointIndexWithName(_arg1:String, _arg2:Array, _arg3:int):int{
var _local4:int;
if (_arg1 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "name cannot be undefined or null"));
};
if (_arg2 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint.array undefined"));
};
if (((((isNaN(_arg3)) || ((_arg3 < -1)))) || ((_arg3 >= _arg2.length)))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint.index must be number between -1 and cuePoint.array.length"));
};
_local4 = (_arg3 + 1);
while (_local4 < _arg2.length) {
if (_arg2[_local4].name == _arg1){
break;
};
_local4++;
};
if (_local4 < _arg2.length){
return (_local4);
};
return (-1);
}
public function dispatchASCuePoints():void{
var _local1:Number;
_local1 = _owner.getVideoPlayer(_id).playheadTime;
if (((_owner.getVideoPlayer(_id).stateResponsive) && (!((asCuePoints == null))))){
while ((((_asCuePointIndex < asCuePoints.length)) && ((asCuePoints[_asCuePointIndex].time <= (_local1 + _asCuePointTolerance))))) {
_owner.dispatchEvent(new MetadataEvent(MetadataEvent.CUE_POINT, false, false, deepCopyObject(asCuePoints[_asCuePointIndex++]), _id));
};
};
}
flvplayback_internal function getNextCuePointWithName(_arg1:Object):Object{
var _local2:int;
var _local3:Object;
if (_arg1 == null){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "cuePoint parameter undefined"));
};
if (((isNaN(_arg1.time)) || ((_arg1.time < 0)))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number"));
};
_local2 = getNextCuePointIndexWithName(_arg1.name, _arg1.array, _arg1.index);
if (_local2 < 0){
return (null);
};
_local3 = deepCopyObject(_arg1.array[_local2]);
_local3.array = _arg1.array;
_local3.index = _local2;
return (_local3);
}
public function insertCuePoint(_arg1:int, _arg2:Array, _arg3:Object):Array{
if (_arg1 < 0){
_arg2 = new Array();
_arg2.push(_arg3);
} else {
if (_arg2[_arg1].time > _arg3.time){
_arg1 = 0;
} else {
_arg1++;
};
_arg2.splice(_arg1, 0, _arg3);
};
return (_arg2);
}
flvplayback_internal function getCuePointIndex(_arg1:Array, _arg2:Boolean, _arg3:Number=NaN, _arg4:String=null, _arg5:int=-1, _arg6:int=-1):int{
var _local7:Boolean;
var _local8:Boolean;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
if ((((_arg1 == null)) || ((_arg1.length < 1)))){
return (-1);
};
_local7 = ((isNaN(_arg3)) || ((_arg3 < 0)));
_local8 = (_arg4 == null);
if (((_local7) && (_local8))){
throw (new VideoError(VideoError.ILLEGAL_CUE_POINT, "time must be number and/or name must not be undefined or null"));
};
if (_arg5 < 0){
_arg5 = 0;
};
if (_arg6 < 0){
_arg6 = _arg1.length;
};
if (((!(_local8)) && (((_arg2) || (_local7))))){
if (_local7){
_local12 = _arg5;
} else {
_local12 = getCuePointIndex(_arg1, _arg2, _arg3);
};
_local13 = _local12;
while (_local13 >= _arg5) {
if (_arg1[_local13].name == _arg4){
break;
};
_local13--;
};
if (_local13 >= _arg5){
return (_local13);
};
_local13 = (_local12 + 1);
while (_local13 < _arg6) {
if (_arg1[_local13].name == _arg4){
break;
};
_local13++;
};
if (_local13 < _arg6){
return (_local13);
};
return (-1);
};
if (_arg6 <= _linearSearchTolerance){
_local14 = (_arg5 + _arg6);
_local15 = _arg5;
while (_local15 < _local14) {
_local9 = cuePointCompare(_arg3, _arg4, _arg1[_local15]);
if (_local9 == 0){
return (_local15);
};
if (_local9 < 0){
break;
};
_local15++;
};
if (_arg2){
if (_local15 > 0){
return ((_local15 - 1));
};
return (0);
};
return (-1);
};
_local10 = int((_arg6 / 2));
_local11 = (_arg5 + _local10);
_local9 = cuePointCompare(_arg3, _arg4, _arg1[_local11]);
if (_local9 < 0){
return (getCuePointIndex(_arg1, _arg2, _arg3, _arg4, _arg5, _local10));
};
if (_local9 > 0){
return (getCuePointIndex(_arg1, _arg2, _arg3, _arg4, (_local11 + 1), ((_local10 - 1) + (_arg6 % 2))));
};
return (_local11);
}
flvplayback_internal static function deepCopyObject(_arg1:Object, _arg2:uint=0):Object{
var _local3:Object;
var _local4:*;
if (_arg1 == null){
return (_arg1);
};
_local3 = new Object();
for (_local4 in _arg1) {
if ((((_arg2 == 0)) && ((((_local4 == "array")) || ((_local4 == "index")))))){
} else {
if (typeof(_arg1[_local4]) == "object"){
_local3[_local4] = deepCopyObject(_arg1[_local4], (_arg2 + 1));
} else {
_local3[_local4] = _arg1[_local4];
};
};
};
return (_local3);
}
flvplayback_internal static function cuePointCompare(_arg1:Number, _arg2:String, _arg3:Object):int{
var _local4:Number;
var _local5:Number;
_local4 = Math.round((_arg1 * 1000));
_local5 = Math.round((_arg3.time * 1000));
if (_local4 < _local5){
return (-1);
};
if (_local4 > _local5){
return (1);
};
if (_arg2 != null){
if (_arg2 == _arg3.name){
return (0);
};
if (_arg2 < _arg3.name){
return (-1);
};
return (1);
};
return (0);
}
}
}//package fl.video
Section 39
//CuePointType (fl.video.CuePointType)
package fl.video {
public final class CuePointType {
public static const FLV:String = "flv";
public static const ALL:String = "all";
public static const ACTIONSCRIPT:String = "actionscript";
public static const EVENT:String = "event";
public static const NAVIGATION:String = "navigation";
}
}//package fl.video
Section 40
//FLVPlayback (fl.video.FLVPlayback)
package fl.video {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
public class FLVPlayback extends Sprite {
private var _playheadUpdateInterval:Number;
private var _align:String;
flvplayback_internal var videoPlayerStateDict:Dictionary;
flvplayback_internal var cuePointMgrs:Array;
private var _volume:Number;
private var _origHeight:Number;
flvplayback_internal var videoPlayerStates:Array;
private var _progressInterval:Number;
private var _seekToPrevOffset:Number;
private var _origWidth:Number;
private var _scaleMode:String;
flvplayback_internal var resizingNow:Boolean;
flvplayback_internal var videoPlayers:Array;
private var _bufferTime:Number;
private var _aspectRatio:Boolean;
private var _autoRewind:Boolean;
flvplayback_internal var uiMgr:UIManager;
private var previewImage_mc:Loader;
private var _componentInspectorSetting:Boolean;
flvplayback_internal var _firstStreamShown:Boolean;
private var _visibleVP:uint;
private var _idleTimeout:Number;
private var _soundTransform:SoundTransform;
public var boundingBox_mc:DisplayObject;
flvplayback_internal var skinShowTimer:Timer;
private var preview_mc:MovieClip;
private var livePreviewHeight:Number;
flvplayback_internal var _firstStreamReady:Boolean;
private var _activeVP:uint;
private var isLivePreview:Boolean;
private var _topVP:uint;
private var livePreviewWidth:Number;
private var __forceNCMgr:NCManager;
private var previewImageUrl:String;
public static const SEEK_TO_PREV_OFFSET_DEFAULT:Number = 1;
public static const SHORT_VERSION:String = "2.1";
flvplayback_internal static const skinShowTimerInterval:Number = 2000;
public static const VERSION:String = "2.1.0.14";
flvplayback_internal static const DEFAULT_SKIN_SHOW_TIMER_INTERVAL:Number = 2000;
public function FLVPlayback(){
var _local1:VideoPlayer;
super();
mouseEnabled = false;
isLivePreview = ((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")));
_componentInspectorSetting = false;
_origWidth = super.width;
_origHeight = super.height;
super.scaleX = 1;
super.scaleY = 1;
_local1 = new VideoPlayer(0, 0);
_local1.setSize(_origWidth, _origHeight);
videoPlayers = new Array();
videoPlayers[0] = _local1;
_align = _local1.align;
_autoRewind = _local1.autoRewind;
_scaleMode = _local1.scaleMode;
_bufferTime = _local1.bufferTime;
_idleTimeout = _local1.idleTimeout;
_playheadUpdateInterval = _local1.playheadUpdateInterval;
_progressInterval = _local1.progressInterval;
_soundTransform = _local1.soundTransform;
_volume = _local1.volume;
_seekToPrevOffset = SEEK_TO_PREV_OFFSET_DEFAULT;
_firstStreamReady = false;
_firstStreamShown = false;
resizingNow = false;
uiMgr = new UIManager(this);
if (isLivePreview){
uiMgr.visible = true;
};
_activeVP = 0;
_visibleVP = 0;
_topVP = 0;
videoPlayerStates = new Array();
videoPlayerStateDict = new Dictionary(true);
cuePointMgrs = new Array();
createVideoPlayer(0);
boundingBox_mc.visible = false;
removeChild(boundingBox_mc);
boundingBox_mc = null;
if (isLivePreview){
previewImageUrl = "";
createLivePreviewMovieClip();
setSize(_origWidth, _origHeight);
};
}
public function set fullScreenTakeOver(_arg1:Boolean):void{
uiMgr.fullScreenTakeOver = _arg1;
}
public function pause():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.PAUSE);
} else {
_local2 = videoPlayers[_activeVP];
_local2.pause();
};
}
public function setScale(_arg1:Number, _arg2:Number):void{
var _local3:Rectangle;
var _local4:Rectangle;
var _local5:int;
var _local6:VideoPlayer;
_local3 = new Rectangle(x, y, width, height);
_local4 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local5 = 0;
while (_local5 < videoPlayers.length) {
_local6 = videoPlayers[_local5];
if (_local6 !== null){
_local6.setSize((_origWidth * _arg1), (_origWidth * _arg2));
};
_local5++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
}
public function stop():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.STOP);
} else {
_local2 = videoPlayers[_activeVP];
_local2.stop();
};
}
public function set align(_arg1:String):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_align = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.align = _arg1;
}
public function getVideoPlayer(_arg1:Number):VideoPlayer{
return (videoPlayers[_arg1]);
}
public function get playheadTime():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.playheadTime);
}
public function get progressInterval():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.progressInterval);
}
public function set skinFadeTime(_arg1:int):void{
uiMgr.skinFadeTime = _arg1;
}
public function get seekToPrevOffset():Number{
return (_seekToPrevOffset);
}
public function set playheadTime(_arg1:Number):void{
seek(_arg1);
}
public function get source():String{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
_local1 = videoPlayerStates[_activeVP];
if (_local1.isWaiting){
return (_local1.url);
};
_local2 = videoPlayers[_activeVP];
return (_local2.source);
}
public function get activeVideoPlayerIndex():uint{
return (_activeVP);
}
public function get skinFadeTime():int{
return (uiMgr.skinFadeTime);
}
public function set scaleMode(_arg1:String):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_scaleMode = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.scaleMode = _arg1;
}
public function set bufferingBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.BUFFERING_BAR, _arg1);
}
public function get metadataLoaded():Boolean{
var _local1:CuePointManager;
_local1 = cuePointMgrs[_activeVP];
return (_local1.metadataLoaded);
}
public function closeVideoPlayer(_arg1:uint):void{
var _local2:VideoPlayer;
if (_arg1 == 0){
throw (new VideoError(VideoError.DELETE_DEFAULT_PLAYER));
};
if (videoPlayers[_arg1] == undefined){
return;
};
_local2 = videoPlayers[_arg1];
if (_visibleVP == _arg1){
visibleVideoPlayerIndex = 0;
};
if (_activeVP == _arg1){
activeVideoPlayerIndex = 0;
};
removeChild(_local2);
_local2.close();
delete videoPlayers[_arg1];
delete videoPlayerStates[_arg1];
delete videoPlayerStateDict[_local2];
}
public function get scaleMode():String{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.scaleMode);
}
public function set progressInterval(_arg1:Number):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_progressInterval = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.progressInterval = _arg1;
}
public function get playing():Boolean{
return ((state == VideoState.PLAYING));
}
public function get totalTime():Number{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (isLivePreview){
return (1);
};
_local1 = videoPlayerStates[_activeVP];
if (_local1.totalTimeSet){
return (_local1.totalTime);
};
_local2 = videoPlayers[_activeVP];
return (_local2.totalTime);
}
public function get ncMgr():INCManager{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.ncMgr);
}
public function set volume(_arg1:Number):void{
var _local2:VideoPlayer;
if (_volume == _arg1){
return;
};
_volume = _arg1;
if (!scrubbing){
_local2 = videoPlayers[_visibleVP];
_local2.volume = _volume;
};
dispatchEvent(new SoundEvent(SoundEvent.SOUND_UPDATE, false, false, _local2.soundTransform));
}
public function get skinAutoHide():Boolean{
return (uiMgr.skinAutoHide);
}
public function set source(_arg1:String):void{
var _local2:VideoPlayerState;
var _local3:CuePointManager;
if (isLivePreview){
return;
};
if (_arg1 == null){
_arg1 = "";
};
if (_componentInspectorSetting){
_local2 = videoPlayerStates[_activeVP];
_local2.url = _arg1;
if (_arg1.length > 0){
_local2.isWaiting = true;
addEventListener(Event.ENTER_FRAME, doContentPathConnect);
};
} else {
if (source == _arg1){
return;
};
_local3 = cuePointMgrs[_activeVP];
_local3.reset();
_local2 = videoPlayerStates[_activeVP];
_local2.url = _arg1;
_local2.isWaiting = true;
doContentPathConnect(_activeVP);
};
}
public function set activeVideoPlayerIndex(_arg1:uint):void{
if (_activeVP == _arg1){
return;
};
_activeVP = _arg1;
if (videoPlayers[_activeVP] == undefined){
createVideoPlayer(_activeVP);
};
}
override public function set soundTransform(_arg1:SoundTransform):void{
var _local2:VideoPlayer;
if (_arg1 == null){
return;
};
_volume = _arg1.volume;
_soundTransform.volume = (scrubbing) ? 0 : _arg1.volume;
_soundTransform.leftToLeft = _arg1.leftToLeft;
_soundTransform.leftToRight = _arg1.leftToRight;
_soundTransform.rightToLeft = _arg1.rightToLeft;
_soundTransform.rightToRight = _arg1.rightToRight;
_local2 = videoPlayers[_activeVP];
_local2.soundTransform = _soundTransform;
dispatchEvent(new SoundEvent(SoundEvent.SOUND_UPDATE, false, false, _local2.soundTransform));
}
public function set seekToPrevOffset(_arg1:Number):void{
_seekToPrevOffset = _arg1;
}
public function set seekBarScrubTolerance(_arg1:Number):void{
uiMgr.seekBarScrubTolerance = _arg1;
}
override public function get scaleX():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return ((_local1.width / _origWidth));
}
override public function get scaleY():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return ((_local1.height / _origHeight));
}
public function get bytesLoaded():uint{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.bytesLoaded);
}
override public function set height(_arg1:Number):void{
var _local2:Rectangle;
var _local3:Rectangle;
var _local4:int;
var _local5:VideoPlayer;
if (isLivePreview){
setSize(this.width, _arg1);
return;
};
_local2 = new Rectangle(x, y, width, height);
_local3 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local4 = 0;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 != null){
_local5.height = _arg1;
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
public function get forwardButton():Sprite{
return (uiMgr.getControl(UIManager.FORWARD_BUTTON));
}
public function get seekBarInterval():Number{
return (uiMgr.seekBarInterval);
}
public function set totalTime(_arg1:Number):void{
var _local2:VideoPlayerState;
_local2 = videoPlayerStates[_activeVP];
_local2.totalTime = _arg1;
_local2.totalTimeSet = true;
}
public function set skinAutoHide(_arg1:Boolean):void{
if (isLivePreview){
return;
};
uiMgr.skinAutoHide = _arg1;
}
public function set bufferTime(_arg1:Number):void{
var _local2:VideoPlayer;
_local2 = videoPlayers[_activeVP];
_local2.bufferTime = _arg1;
}
public function get fullScreenSkinDelay():int{
return (uiMgr.fullScreenSkinDelay);
}
public function seekToNavCuePoint(_arg1):void{
var _local2:Object;
var _local3:Object;
if ((_arg1 is String)){
_local2 = {name:String(_arg1)};
} else {
if ((_arg1 is Number)){
_local2 = {time:Number(_arg1)};
} else {
_local2 = _arg1;
};
};
if (_local2.name == undefined){
seekToNextNavCuePoint(_local2.time);
return;
};
if (isNaN(_local2.time)){
_local2.time = 0;
};
_local3 = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
while (((!((_local3 == null))) && ((((_local3.time < _local2.time)) || (!(isFLVCuePointEnabled(_local3))))))) {
_local3 = findNextCuePointWithName(_local3);
};
if (_local3 == null){
throw (new VideoError(VideoError.INVALID_SEEK));
};
seek(_local3.time);
}
private function onCompletePreview(_arg1:Event):void{
var e = _arg1;
try {
previewImage_mc.width = livePreviewWidth;
previewImage_mc.height = livePreviewHeight;
} catch(e:Error) {
};
}
public function set isLive(_arg1:Boolean):void{
var _local2:VideoPlayerState;
_local2 = videoPlayerStates[_activeVP];
_local2.isLive = _arg1;
_local2.isLiveSet = true;
}
flvplayback_internal function showSkinNow(_arg1:TimerEvent):void{
skinShowTimer = null;
uiMgr.visible = true;
}
override public function get x():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return ((super.x + _local1.x));
}
override public function get y():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return ((super.y + _local1.y));
}
public function get seekBar():Sprite{
return (uiMgr.getControl(UIManager.SEEK_BAR));
}
public function get volumeBarInterval():Number{
return (uiMgr.volumeBarInterval);
}
public function set registrationHeight(_arg1:Number):void{
height = _arg1;
}
public function get bufferingBarHidesAndDisablesOthers():Boolean{
return (uiMgr.bufferingBarHidesAndDisablesOthers);
}
public function seek(_arg1:Number):void{
var _local2:VideoPlayerState;
var _local3:VideoPlayer;
_local2 = videoPlayerStates[_activeVP];
if (!_firstStreamShown){
_local2.preSeekTime = 0;
queueCmd(_local2, QueuedCommand.SEEK, _arg1);
} else {
_local2.preSeekTime = playheadTime;
_local3 = videoPlayers[_activeVP];
_local3.seek(_arg1);
};
}
public function get state():String{
var _local1:VideoPlayer;
var _local2:String;
var _local3:VideoPlayerState;
if (isLivePreview){
return (VideoState.STOPPED);
};
_local1 = videoPlayers[_activeVP];
if ((((_activeVP == _visibleVP)) && (scrubbing))){
return (VideoState.SEEKING);
};
_local2 = _local1.state;
if (_local2 == VideoState.RESIZING){
return (VideoState.LOADING);
};
_local3 = videoPlayerStates[_activeVP];
if ((((((_local3.prevState == VideoState.LOADING)) && (_local3.autoPlay))) && ((_local2 == VideoState.STOPPED)))){
return (VideoState.LOADING);
};
return (_local2);
}
public function set autoRewind(_arg1:Boolean):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_autoRewind = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.autoRewind = _arg1;
}
public function get volumeBar():Sprite{
return (uiMgr.getControl(UIManager.VOLUME_BAR));
}
flvplayback_internal function skinError(_arg1:String):void{
if (isLivePreview){
return;
};
if (((_firstStreamReady) && (!(_firstStreamShown)))){
showFirstStream();
};
dispatchEvent(new SkinErrorEvent(SkinErrorEvent.SKIN_ERROR, false, false, _arg1));
}
override public function set scaleX(_arg1:Number):void{
var _local2:Rectangle;
var _local3:Rectangle;
var _local4:int;
var _local5:VideoPlayer;
_local2 = new Rectangle(x, y, width, height);
_local3 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local4 = 0;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 !== null){
_local5.width = (_origWidth * _arg1);
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
override public function set scaleY(_arg1:Number):void{
var _local2:Rectangle;
var _local3:Rectangle;
var _local4:int;
var _local5:VideoPlayer;
_local2 = new Rectangle(x, y, width, height);
_local3 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local4 = 0;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 !== null){
_local5.height = (_origHeight * _arg1);
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
flvplayback_internal function createVideoPlayer(_arg1:Number):void{
var vp:VideoPlayer;
var added:Boolean;
var vpState:VideoPlayerState;
var cpMgr:CuePointManager;
var skinDepth:int;
var index = _arg1;
if (isLivePreview){
return;
};
vp = videoPlayers[index];
if (vp == null){
var _local3 = new VideoPlayer(0, 0);
vp = _local3;
videoPlayers[index] = _local3;
vp.setSize(registrationWidth, registrationHeight);
};
vp.visible = false;
vp.volume = 0;
vp.name = String(index);
added = false;
if (uiMgr.skin_mc != null){
try {
skinDepth = getChildIndex(uiMgr.skin_mc);
if (skinDepth > 0){
addChildAt(vp, skinDepth);
added = true;
};
} catch(err:Error) {
};
};
if (!added){
addChild(vp);
};
_topVP = index;
vp.autoRewind = _autoRewind;
vp.scaleMode = _scaleMode;
vp.bufferTime = _bufferTime;
vp.idleTimeout = _idleTimeout;
vp.playheadUpdateInterval = _playheadUpdateInterval;
vp.progressInterval = _progressInterval;
vp.soundTransform = _soundTransform;
vpState = new VideoPlayerState(vp, index);
videoPlayerStates[index] = vpState;
videoPlayerStateDict[vp] = vpState;
vp.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleAutoLayoutEvent);
vp.addEventListener(MetadataEvent.CUE_POINT, handleMetadataEvent);
vp.addEventListener(MetadataEvent.METADATA_RECEIVED, handleMetadataEvent);
vp.addEventListener(VideoProgressEvent.PROGRESS, handleVideoProgressEvent);
vp.addEventListener(VideoEvent.AUTO_REWOUND, handleVideoEvent);
vp.addEventListener(VideoEvent.CLOSE, handleVideoEvent);
vp.addEventListener(VideoEvent.COMPLETE, handleVideoEvent);
vp.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleVideoEvent);
vp.addEventListener(VideoEvent.STATE_CHANGE, handleVideoEvent);
vp.addEventListener(VideoEvent.READY, handleVideoEvent);
cpMgr = new CuePointManager(this, index);
cuePointMgrs[index] = cpMgr;
cpMgr.playheadUpdateInterval = _playheadUpdateInterval;
}
public function findNearestCuePoint(_arg1, _arg2:String="all"):Object{
var _local3:CuePointManager;
_local3 = cuePointMgrs[_activeVP];
switch (_arg2){
case "event":
return (_local3.getCuePoint(_local3.eventCuePoints, true, _arg1));
case "navigation":
return (_local3.getCuePoint(_local3.navCuePoints, true, _arg1));
case "flv":
return (_local3.getCuePoint(_local3.flvCuePoints, true, _arg1));
case "actionscript":
return (_local3.getCuePoint(_local3.asCuePoints, true, _arg1));
case "all":
default:
return (_local3.getCuePoint(_local3.allCuePoints, true, _arg1));
};
}
public function get muteButton():Sprite{
return (uiMgr.getControl(UIManager.MUTE_BUTTON));
}
public function seekPercent(_arg1:Number):void{
var _local2:VideoPlayer;
_local2 = videoPlayers[_activeVP];
if (((((((((isNaN(_arg1)) || ((_arg1 < 0)))) || ((_arg1 > 100)))) || (isNaN(_local2.totalTime)))) || ((_local2.totalTime <= 0)))){
throw (new VideoError(VideoError.INVALID_SEEK));
};
seek(((_local2.totalTime * _arg1) / 100));
}
public function set forwardButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.FORWARD_BUTTON, _arg1);
}
public function get registrationWidth():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return (_local1.registrationWidth);
}
flvplayback_internal function queueCmd(_arg1:VideoPlayerState, _arg2:Number, _arg3:Number=NaN):void{
if (_arg1.cmdQueue == null){
_arg1.cmdQueue = new Array();
};
_arg1.cmdQueue.push(new QueuedCommand(_arg2, null, false, _arg3));
}
private function doContentPathConnect(_arg1):void{
var _local2:int;
var _local3:VideoPlayer;
var _local4:VideoPlayerState;
if (isLivePreview){
return;
};
_local2 = 0;
if ((_arg1 is int)){
_local2 = int(_arg1);
} else {
removeEventListener(Event.ENTER_FRAME, doContentPathConnect);
};
_local3 = videoPlayers[_local2];
_local4 = videoPlayerStates[_local2];
if (!_local4.isWaiting){
return;
};
if (((_local4.autoPlay) && (_firstStreamShown))){
_local3.play(_local4.url, _local4.totalTime, _local4.isLive);
} else {
_local3.load(_local4.url, _local4.totalTime, _local4.isLive);
};
_local4.isLiveSet = false;
_local4.totalTimeSet = false;
_local4.isWaiting = false;
}
public function get registrationX():Number{
return (super.x);
}
public function bringVideoPlayerToFront(_arg1:uint):void{
var vp:VideoPlayer;
var moved:Boolean;
var skinDepth:int;
var index = _arg1;
if (index == _topVP){
return;
};
vp = videoPlayers[index];
if (vp == null){
createVideoPlayer(index);
vp = videoPlayers[index];
};
moved = false;
if (uiMgr.skin_mc != null){
try {
skinDepth = getChildIndex(uiMgr.skin_mc);
if (skinDepth > 0){
setChildIndex(vp, (skinDepth - 1));
moved = true;
};
} catch(err:Error) {
};
};
if (!moved){
setChildIndex(vp, (numChildren - 1));
};
_topVP = index;
}
public function get registrationY():Number{
return (super.y);
}
public function get pauseButton():Sprite{
return (uiMgr.getControl(UIManager.PAUSE_BUTTON));
}
public function set seekBarInterval(_arg1:Number):void{
uiMgr.seekBarInterval = _arg1;
}
public function addASCuePoint(_arg1, _arg2:String=null, _arg3:Object=null):Object{
var _local4:CuePointManager;
_local4 = cuePointMgrs[_activeVP];
return (_local4.addASCuePoint(_arg1, _arg2, _arg3));
}
public function get playheadPercentage():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
if (isNaN(_local1.totalTime)){
return (NaN);
};
return (((_local1.playheadTime / _local1.totalTime) * 100));
}
public function setFLVCuePointEnabled(_arg1:Boolean, _arg2):Number{
var _local3:CuePointManager;
_local3 = cuePointMgrs[_activeVP];
return (_local3.setFLVCuePointEnabled(_arg1, _arg2));
}
public function set fullScreenSkinDelay(_arg1:int):void{
uiMgr.fullScreenSkinDelay = _arg1;
}
public function seekToNextNavCuePoint(_arg1:Number=NaN):void{
var _local2:VideoPlayer;
var _local3:Object;
var _local4:Number;
_local2 = videoPlayers[_activeVP];
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
_arg1 = (_local2.playheadTime + 0.001);
};
_local3 = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
if (_local3 == null){
seek(_local2.totalTime);
return;
};
_local4 = _local3.index;
if (_local3.time < _arg1){
_local4++;
};
while ((((_local4 < _local3.array.length)) && (!(isFLVCuePointEnabled(_local3.array[_local4]))))) {
_local4++;
};
if (_local4 >= _local3.array.length){
_arg1 = _local2.totalTime;
if (_local3.array[(_local3.array.length - 1)].time > _arg1){
_arg1 = _local3.array[(_local3.array.length - 1)];
};
seek(_arg1);
} else {
seek(_local3.array[_local4].time);
};
}
public function load(_arg1:String, _arg2:Number=NaN, _arg3:Boolean=false):void{
if ((((_arg1 == null)) || ((_arg1.length == 0)))){
return;
};
if (_arg1 == this.source){
return;
};
this.autoPlay = false;
this.totalTime = _arg2;
this.isLive = _arg3;
this.source = _arg1;
}
public function seekSeconds(_arg1:Number):void{
seek(_arg1);
}
public function get fullScreenButton():Sprite{
return (uiMgr.getControl(UIManager.FULL_SCREEN_BUTTON));
}
public function get scrubbing():Boolean{
var _local1:Sprite;
var _local2:ControlData;
_local1 = seekBar;
if (_local1 != null){
_local2 = uiMgr.ctrlDataDict[_local1];
return (_local2.isDragging);
};
return (false);
}
override public function set y(_arg1:Number):void{
var _local2:VideoPlayer;
_local2 = videoPlayers[_visibleVP];
super.y = (_arg1 - _local2.y);
}
public function removeASCuePoint(_arg1):Object{
var _local2:CuePointManager;
_local2 = cuePointMgrs[_activeVP];
return (_local2.removeASCuePoint(_arg1));
}
public function get fullScreenTakeOver():Boolean{
return (uiMgr.fullScreenTakeOver);
}
override public function set x(_arg1:Number):void{
var _local2:VideoPlayer;
_local2 = videoPlayers[_visibleVP];
super.x = (_arg1 - _local2.x);
}
public function get backButton():Sprite{
return (uiMgr.getControl(UIManager.BACK_BUTTON));
}
public function set seekBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.SEEK_BAR, _arg1);
}
public function set skin(_arg1:String):void{
uiMgr.skin = _arg1;
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_componentInspectorSetting = _arg1;
}
public function get preferredHeight():int{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.videoHeight);
}
public function set volumeBarInterval(_arg1:Number):void{
uiMgr.volumeBarInterval = _arg1;
}
public function set autoPlay(_arg1:Boolean):void{
var _local2:VideoPlayerState;
_local2 = videoPlayerStates[_activeVP];
_local2.autoPlay = _arg1;
}
public function set visibleVideoPlayerIndex(_arg1:uint):void{
var _local2:VideoPlayer;
var _local3:VideoPlayer;
var _local4:uint;
var _local5:Rectangle;
var _local6:Rectangle;
if (_visibleVP == _arg1){
return;
};
if (videoPlayers[_arg1] == undefined){
createVideoPlayer(_arg1);
};
_local2 = videoPlayers[_arg1];
_local3 = videoPlayers[_visibleVP];
_local3.visible = false;
_local3.volume = 0;
_visibleVP = _arg1;
if (_firstStreamShown){
uiMgr.setupSkinAutoHide(false);
_local2.visible = true;
_soundTransform.volume = (scrubbing) ? _volume : 0;
_local2.soundTransform = _soundTransform;
} else {
if (((((((_local2.stateResponsive) || ((_local2.state == VideoState.CONNECTION_ERROR)))) || ((_local2.state == VideoState.DISCONNECTED)))) && (uiMgr.skinReady))){
uiMgr.visible = true;
uiMgr.setupSkinAutoHide(false);
_firstStreamReady = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
showFirstStream();
};
};
if (((!((_local2.height == _local3.height))) || (!((_local2.width == _local3.width))))){
_local5 = new Rectangle((_local3.x + super.x), (_local3.y + super.y), _local3.width, _local3.height);
_local6 = new Rectangle((_local3.registrationX + super.x), (_local3.registrationY + super.y), _local3.registrationWidth, _local3.registrationHeight);
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local5, _local6));
};
_local4 = _activeVP;
_activeVP = _visibleVP;
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, state, playheadTime, _visibleVP));
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.PLAYHEAD_UPDATE, false, false, state, playheadTime, _visibleVP));
if (_local2.isRTMP){
uiMgr.handleIVPEvent(new VideoEvent(VideoEvent.READY, false, false, state, playheadTime, _visibleVP));
} else {
uiMgr.handleIVPEvent(new VideoProgressEvent(VideoProgressEvent.PROGRESS, false, false, bytesLoaded, bytesTotal, _visibleVP));
};
_activeVP = _local4;
}
public function get bufferingBar():Sprite{
return (uiMgr.getControl(UIManager.BUFFERING_BAR));
}
flvplayback_internal function _scrubStart():void{
var _local1:Number;
var _local2:VideoPlayer;
_local1 = playheadTime;
_local2 = videoPlayers[_visibleVP];
_volume = _local2.volume;
_local2.volume = 0;
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, VideoState.SEEKING, _local1, _visibleVP));
dispatchEvent(new VideoEvent(VideoEvent.SCRUB_START, false, false, VideoState.SEEKING, _local1, _visibleVP));
}
public function get align():String{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.align);
}
flvplayback_internal function handleAutoLayoutEvent(_arg1:AutoLayoutEvent):void{
var _local2:VideoPlayerState;
var _local3:AutoLayoutEvent;
var _local4:Rectangle;
var _local5:Rectangle;
_local2 = videoPlayerStateDict[_arg1.currentTarget];
_local3 = AutoLayoutEvent(_arg1.clone());
_local3.oldBounds.x = (_local3.oldBounds.x + super.x);
_local3.oldBounds.y = (_local3.oldBounds.y + super.y);
_local3.oldRegistrationBounds.x = (_local3.oldRegistrationBounds.x + super.y);
_local3.oldRegistrationBounds.y = (_local3.oldRegistrationBounds.y + super.y);
_local3.vp = _local2.index;
dispatchEvent(_local3);
if (((!(resizingNow)) && ((_local2.index == _visibleVP)))){
_local4 = Rectangle(_arg1.oldBounds.clone());
_local5 = Rectangle(_arg1.oldRegistrationBounds.clone());
_local4.x = (_local4.x + super.x);
_local4.y = (_local4.y + super.y);
_local5.x = (_local5.x + super.y);
_local5.y = (_local5.y + super.y);
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local4, _local5));
};
}
public function findNextCuePointWithName(_arg1:Object):Object{
var _local2:CuePointManager;
_local2 = cuePointMgrs[_activeVP];
return (_local2.getNextCuePointWithName(_arg1));
}
public function set playButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PLAY_BUTTON, _arg1);
}
public function set bitrate(_arg1:Number):void{
ncMgr.bitrate = _arg1;
}
public function set bufferingBarHidesAndDisablesOthers(_arg1:Boolean):void{
uiMgr.bufferingBarHidesAndDisablesOthers = _arg1;
}
override public function get soundTransform():SoundTransform{
var _local1:VideoPlayer;
var _local2:SoundTransform;
_local1 = videoPlayers[_visibleVP];
_local2 = _local1.soundTransform;
if (scrubbing){
_local2.volume = _volume;
};
return (_local2);
}
public function get stateResponsive():Boolean{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.stateResponsive);
}
public function get idleTimeout():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.idleTimeout);
}
override public function get height():Number{
var _local1:VideoPlayer;
if (isLivePreview){
return (livePreviewHeight);
};
_local1 = videoPlayers[_visibleVP];
return (_local1.height);
}
public function set registrationWidth(_arg1:Number):void{
width = _arg1;
}
public function get metadata():Object{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.metadata);
}
public function set skinBackgroundColor(_arg1:uint):void{
uiMgr.skinBackgroundColor = _arg1;
}
public function get volume():Number{
return (_volume);
}
public function play(_arg1:String=null, _arg2:Number=NaN, _arg3:Boolean=false):void{
var _local4:VideoPlayerState;
var _local5:VideoPlayer;
if (_arg1 == null){
if (!_firstStreamShown){
_local4 = videoPlayerStates[_activeVP];
queueCmd(_local4, QueuedCommand.PLAY);
} else {
_local5 = videoPlayers[_activeVP];
_local5.play();
};
} else {
if (_arg1 == this.source){
return;
};
this.autoPlay = true;
this.totalTime = _arg2;
this.isLive = _arg3;
this.source = _arg1;
};
}
public function get paused():Boolean{
return ((state == VideoState.PAUSED));
}
flvplayback_internal function handleVideoEvent(_arg1:VideoEvent):void{
var _local2:VideoPlayerState;
var _local3:CuePointManager;
var _local4:VideoEvent;
var _local5:String;
var _local6:Number;
_local2 = videoPlayerStateDict[_arg1.currentTarget];
_local3 = cuePointMgrs[_local2.index];
_local4 = VideoEvent(_arg1.clone());
_local4.vp = _local2.index;
_local5 = ((((_local2.index == _visibleVP)) && (scrubbing))) ? VideoState.SEEKING : _arg1.state;
switch (_arg1.type){
case VideoEvent.AUTO_REWOUND:
dispatchEvent(_local4);
dispatchEvent(new VideoEvent(VideoEvent.REWIND, false, false, _local5, _arg1.playheadTime, _local2.index));
_local3.resetASCuePointIndex(_arg1.playheadTime);
break;
case VideoEvent.PLAYHEAD_UPDATE:
_local4.state = _local5;
dispatchEvent(_local4);
if (((!(isNaN(_local2.preSeekTime))) && (!((_arg1.state == VideoState.SEEKING))))){
_local6 = _local2.preSeekTime;
_local2.preSeekTime = NaN;
_local3.resetASCuePointIndex(_arg1.playheadTime);
dispatchEvent(new VideoEvent(VideoEvent.SEEKED, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
if (_local6 < _arg1.playheadTime){
dispatchEvent(new VideoEvent(VideoEvent.FAST_FORWARD, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
} else {
if (_local6 > _arg1.playheadTime){
dispatchEvent(new VideoEvent(VideoEvent.REWIND, false, false, _arg1.state, _arg1.playheadTime, _local2.index));
};
};
};
_local3.dispatchASCuePoints();
break;
case VideoEvent.STATE_CHANGE:
if ((((_local2.index == _visibleVP)) && (scrubbing))){
break;
};
if (_arg1.state == VideoState.RESIZING){
break;
};
if ((((((_local2.prevState == VideoState.LOADING)) && (_local2.autoPlay))) && ((_arg1.state == VideoState.STOPPED)))){
return;
};
if ((((((((_arg1.state == VideoState.CONNECTION_ERROR)) && ((_arg1.vp == _visibleVP)))) && (!(_firstStreamShown)))) && (uiMgr.skinReady))){
showFirstStream();
uiMgr.visible = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
if (skinShowTimer != null){
skinShowTimer.reset();
skinShowTimer = null;
};
};
_local2.prevState = _arg1.state;
_local4.state = _local5;
dispatchEvent(_local4);
if (_local2.owner.state != _arg1.state){
return;
};
switch (_arg1.state){
case VideoState.BUFFERING:
dispatchEvent(new VideoEvent(VideoEvent.BUFFERING_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.PAUSED:
dispatchEvent(new VideoEvent(VideoEvent.PAUSED_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.PLAYING:
dispatchEvent(new VideoEvent(VideoEvent.PLAYING_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
case VideoState.STOPPED:
dispatchEvent(new VideoEvent(VideoEvent.STOPPED_STATE_ENTERED, false, false, _local5, _arg1.playheadTime, _local2.index));
break;
};
break;
case VideoEvent.READY:
if (!_firstStreamReady){
if (_local2.index == _visibleVP){
_firstStreamReady = true;
if (((uiMgr.skinReady) && (!(_firstStreamShown)))){
uiMgr.visible = true;
if (uiMgr.skin == ""){
uiMgr.hookUpCustomComponents();
};
showFirstStream();
};
};
} else {
if (((((_firstStreamShown) && ((_arg1.state == VideoState.STOPPED)))) && (_local2.autoPlay))){
if (_local2.owner.isRTMP){
_local2.owner.play();
} else {
_local2.prevState = VideoState.STOPPED;
_local2.owner.playWhenEnoughDownloaded();
};
};
};
_local4.state = _local5;
dispatchEvent(_local4);
break;
case VideoEvent.CLOSE:
case VideoEvent.COMPLETE:
_local4.state = _local5;
dispatchEvent(_local4);
break;
};
}
public function set volumeBar(_arg1:Sprite):void{
uiMgr.setControl(UIManager.VOLUME_BAR, _arg1);
}
public function set fullScreenBackgroundColor(_arg1:uint):void{
uiMgr.fullScreenBackgroundColor = _arg1;
}
public function get isLive():Boolean{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
_local1 = videoPlayerStates[_activeVP];
if (_local1.isLiveSet){
return (_local1.isLive);
};
_local2 = videoPlayers[_activeVP];
return (_local2.isLive);
}
public function get bufferTime():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.bufferTime);
}
public function get registrationHeight():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_visibleVP];
return (_local1.registrationHeight);
}
public function get playPauseButton():Sprite{
return (uiMgr.getControl(UIManager.PLAY_PAUSE_BUTTON));
}
flvplayback_internal function showFirstStream():void{
var _local1:VideoPlayer;
var _local2:int;
var _local3:VideoPlayerState;
var _local4:int;
_firstStreamShown = true;
_local1 = videoPlayers[_visibleVP];
_local1.visible = true;
if (!scrubbing){
_soundTransform.volume = _volume;
_local1.soundTransform = _soundTransform;
};
_local2 = 0;
while (_local2 < videoPlayers.length) {
_local1 = videoPlayers[_local2];
if (_local1 != null){
_local3 = videoPlayerStates[_local2];
if ((((_local1.state == VideoState.STOPPED)) && (_local3.autoPlay))){
if (_local1.isRTMP){
_local1.play();
} else {
_local3.prevState = VideoState.STOPPED;
_local1.playWhenEnoughDownloaded();
};
};
if (_local3.cmdQueue != null){
_local4 = 0;
while (_local4 < _local3.cmdQueue.length) {
switch (_local3.cmdQueue[_local4].type){
case QueuedCommand.PLAY:
_local1.play();
break;
case QueuedCommand.PAUSE:
_local1.pause();
break;
case QueuedCommand.STOP:
_local1.stop();
break;
case QueuedCommand.SEEK:
_local1.seek(_local3.cmdQueue[_local4].time);
break;
case QueuedCommand.PLAY_WHEN_ENOUGH:
_local1.playWhenEnoughDownloaded();
break;
};
_local4++;
};
_local3.cmdQueue = null;
};
};
_local2++;
};
}
public function set volumeBarScrubTolerance(_arg1:Number):void{
uiMgr.volumeBarScrubTolerance = _arg1;
}
public function set skinBackgroundAlpha(_arg1:Number):void{
uiMgr.skinBackgroundAlpha = _arg1;
}
public function get playheadUpdateInterval():Number{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.playheadUpdateInterval);
}
public function set muteButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.MUTE_BUTTON, _arg1);
}
public function set skinScaleMaximum(_arg1:Number){
uiMgr.skinScaleMaximum = _arg1;
}
public function enterFullScreenDisplayState():void{
uiMgr.enterFullScreenDisplayState();
}
flvplayback_internal function handleMetadataEvent(_arg1:MetadataEvent):void{
var _local2:VideoPlayerState;
var _local3:CuePointManager;
var _local4:MetadataEvent;
_local2 = videoPlayerStateDict[_arg1.currentTarget];
_local3 = cuePointMgrs[_local2.index];
switch (_arg1.type){
case MetadataEvent.METADATA_RECEIVED:
_local3.processFLVCuePoints(_arg1.info.cuePoints);
break;
case MetadataEvent.CUE_POINT:
if (!_local3.isFLVCuePointEnabled(_arg1.info)){
return;
};
break;
};
_local4 = MetadataEvent(_arg1.clone());
_local4.vp = _local2.index;
dispatchEvent(_local4);
}
public function playWhenEnoughDownloaded():void{
var _local1:VideoPlayerState;
var _local2:VideoPlayer;
if (!_firstStreamShown){
_local1 = videoPlayerStates[_activeVP];
queueCmd(_local1, QueuedCommand.PLAY_WHEN_ENOUGH);
} else {
_local2 = videoPlayers[_activeVP];
_local2.playWhenEnoughDownloaded();
};
}
public function get bitrate():Number{
return (ncMgr.bitrate);
}
public function get autoRewind():Boolean{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.autoRewind);
}
public function get fullScreenBackgroundColor():uint{
return (uiMgr.fullScreenBackgroundColor);
}
public function get skin():String{
return (uiMgr.skin);
}
public function set registrationX(_arg1:Number):void{
super.x = _arg1;
}
public function set registrationY(_arg1:Number):void{
super.y = _arg1;
}
public function setSize(_arg1:Number, _arg2:Number):void{
var _local3:Rectangle;
var _local4:Rectangle;
var _local5:int;
var _local6:VideoPlayer;
_local3 = new Rectangle(x, y, this.width, this.height);
_local4 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
if (isLivePreview){
livePreviewWidth = _arg1;
livePreviewHeight = _arg2;
if (previewImage_mc != null){
previewImage_mc.width = _arg1;
previewImage_mc.height = _arg2;
};
preview_mc.box_mc.width = _arg1;
preview_mc.box_mc.height = _arg2;
if ((((preview_mc.box_mc.width < preview_mc.icon_mc.width)) || ((preview_mc.box_mc.height < preview_mc.icon_mc.height)))){
preview_mc.icon_mc.visible = false;
} else {
preview_mc.icon_mc.visible = true;
preview_mc.icon_mc.x = ((preview_mc.box_mc.width - preview_mc.icon_mc.width) / 2);
preview_mc.icon_mc.y = ((preview_mc.box_mc.height - preview_mc.icon_mc.height) / 2);
};
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
return;
};
resizingNow = true;
_local5 = 0;
while (_local5 < videoPlayers.length) {
_local6 = videoPlayers[_local5];
if (_local6 != null){
_local6.setSize(_arg1, _arg2);
};
_local5++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local3, _local4));
}
public function get isRTMP():Boolean{
var _local1:VideoPlayer;
if (isLivePreview){
return (true);
};
_local1 = videoPlayers[_activeVP];
return (_local1.isRTMP);
}
public function set preview(_arg1:String):void{
var filename = _arg1;
if (!isLivePreview){
return;
};
previewImageUrl = filename;
if (previewImage_mc != null){
removeChild(previewImage_mc);
};
previewImage_mc = new Loader();
previewImage_mc.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompletePreview);
previewImage_mc.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
});
previewImage_mc.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (_arg1:SecurityErrorEvent):void{
});
addChildAt(previewImage_mc, 1);
previewImage_mc.load(new URLRequest(previewImageUrl));
}
override public function set width(_arg1:Number):void{
var _local2:Rectangle;
var _local3:Rectangle;
var _local4:int;
var _local5:VideoPlayer;
if (isLivePreview){
setSize(_arg1, this.height);
return;
};
_local2 = new Rectangle(x, y, width, height);
_local3 = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
resizingNow = true;
_local4 = 0;
while (_local4 < videoPlayers.length) {
_local5 = videoPlayers[_local4];
if (_local5 != null){
_local5.width = _arg1;
};
_local4++;
};
resizingNow = false;
dispatchEvent(new LayoutEvent(LayoutEvent.LAYOUT, false, false, _local2, _local3));
}
public function get playButton():Sprite{
return (uiMgr.getControl(UIManager.PLAY_BUTTON));
}
public function set pauseButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PAUSE_BUTTON, _arg1);
}
public function get bytesTotal():uint{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.bytesTotal);
}
public function seekToPrevNavCuePoint(_arg1:Number=NaN):void{
var _local2:Object;
var _local3:Number;
var _local4:VideoPlayer;
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
_local4 = videoPlayers[_activeVP];
_arg1 = _local4.playheadTime;
};
_local2 = findNearestCuePoint(_arg1, CuePointType.NAVIGATION);
if (_local2 == null){
seek(0);
return;
};
_local3 = _local2.index;
while ((((_local3 >= 0)) && (((!(isFLVCuePointEnabled(_local2.array[_local3]))) || ((_local2.array[_local3].time >= (_arg1 - _seekToPrevOffset))))))) {
_local3--;
};
if (_local3 < 0){
seek(0);
} else {
seek(_local2.array[_local3].time);
};
}
public function get autoPlay():Boolean{
var _local1:VideoPlayerState;
_local1 = videoPlayerStates[_activeVP];
return (_local1.autoPlay);
}
public function set playheadPercentage(_arg1:Number):void{
seekPercent(_arg1);
}
public function isFLVCuePointEnabled(_arg1):Boolean{
var _local2:CuePointManager;
_local2 = cuePointMgrs[_activeVP];
return (_local2.isFLVCuePointEnabled(_arg1));
}
public function get buffering():Boolean{
return ((state == VideoState.BUFFERING));
}
public function get volumeBarScrubTolerance():Number{
return (uiMgr.volumeBarScrubTolerance);
}
public function get skinBackgroundColor():uint{
return (uiMgr.skinBackgroundColor);
}
public function get visibleVideoPlayerIndex():uint{
return (_visibleVP);
}
public function set stopButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.STOP_BUTTON, _arg1);
}
public function get skinBackgroundAlpha():Number{
return (uiMgr.skinBackgroundAlpha);
}
public function get skinScaleMaximum():Number{
return (uiMgr.skinScaleMaximum);
}
public function get preferredWidth():int{
var _local1:VideoPlayer;
_local1 = videoPlayers[_activeVP];
return (_local1.videoWidth);
}
override public function get width():Number{
var _local1:VideoPlayer;
if (isLivePreview){
return (livePreviewWidth);
};
_local1 = videoPlayers[_visibleVP];
return (_local1.width);
}
public function get stopped():Boolean{
return ((state == VideoState.STOPPED));
}
public function set fullScreenButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.FULL_SCREEN_BUTTON, _arg1);
}
public function get stopButton():Sprite{
return (uiMgr.getControl(UIManager.STOP_BUTTON));
}
public function set playheadUpdateInterval(_arg1:Number):void{
var _local2:CuePointManager;
var _local3:VideoPlayer;
if (_activeVP == 0){
_playheadUpdateInterval = _arg1;
};
_local2 = cuePointMgrs[_activeVP];
_local2.playheadUpdateInterval = _arg1;
_local3 = videoPlayers[_activeVP];
_local3.playheadUpdateInterval = _arg1;
}
private function createLivePreviewMovieClip():void{
preview_mc = new MovieClip();
preview_mc.name = "preview_mc";
preview_mc.box_mc = new MovieClip();
preview_mc.box_mc.name = "box_mc";
preview_mc.box_mc.graphics.beginFill(0);
preview_mc.box_mc.graphics.moveTo(0, 0);
preview_mc.box_mc.graphics.lineTo(0, 100);
preview_mc.box_mc.graphics.lineTo(100, 100);
preview_mc.box_mc.graphics.lineTo(100, 0);
preview_mc.box_mc.graphics.lineTo(0, 0);
preview_mc.box_mc.graphics.endFill();
preview_mc.addChild(preview_mc.box_mc);
preview_mc.icon_mc = new Icon();
preview_mc.icon_mc.name = "icon_mc";
preview_mc.addChild(preview_mc.icon_mc);
addChild(preview_mc);
}
public function set idleTimeout(_arg1:Number):void{
var _local2:VideoPlayer;
if (_activeVP == 0){
_idleTimeout = _arg1;
};
_local2 = videoPlayers[_activeVP];
_local2.idleTimeout = _arg1;
}
flvplayback_internal function skinLoaded():void{
var _local1:VideoPlayer;
if (isLivePreview){
return;
};
_local1 = videoPlayers[_visibleVP];
if (((((_firstStreamReady) || ((_local1.state == VideoState.CONNECTION_ERROR)))) || ((_local1.state == VideoState.DISCONNECTED)))){
uiMgr.visible = true;
if (!_firstStreamShown){
showFirstStream();
};
} else {
if (skinShowTimer != null){
skinShowTimer.reset();
skinShowTimer = null;
};
skinShowTimer = new Timer(DEFAULT_SKIN_SHOW_TIMER_INTERVAL, 1);
skinShowTimer.addEventListener(TimerEvent.TIMER, showSkinNow);
skinShowTimer.start();
};
dispatchEvent(new VideoEvent(VideoEvent.SKIN_LOADED, false, false, state, playheadTime, _visibleVP));
}
flvplayback_internal function _scrubFinish():void{
var _local1:Number;
var _local2:String;
var _local3:VideoPlayer;
_local1 = playheadTime;
_local2 = state;
_local3 = videoPlayers[_visibleVP];
_soundTransform.volume = _volume;
_local3.soundTransform = _soundTransform;
if (_local2 != VideoState.SEEKING){
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, _local2, _local1, _visibleVP));
};
dispatchEvent(new VideoEvent(VideoEvent.SCRUB_FINISH, false, false, _local2, _local1, _visibleVP));
}
public function set playPauseButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.PLAY_PAUSE_BUTTON, _arg1);
}
public function set backButton(_arg1:Sprite):void{
uiMgr.setControl(UIManager.BACK_BUTTON, _arg1);
}
public function set cuePoints(_arg1:Array):void{
if (!_componentInspectorSetting){
return;
};
cuePointMgrs[0].processCuePointsProperty(_arg1);
}
public function findCuePoint(_arg1, _arg2:String="all"):Object{
var _local3:CuePointManager;
_local3 = cuePointMgrs[_activeVP];
switch (_arg2){
case "event":
return (_local3.getCuePoint(_local3.eventCuePoints, false, _arg1));
case "navigation":
return (_local3.getCuePoint(_local3.navCuePoints, false, _arg1));
case "flv":
return (_local3.getCuePoint(_local3.flvCuePoints, false, _arg1));
case "actionscript":
return (_local3.getCuePoint(_local3.asCuePoints, false, _arg1));
case "all":
default:
return (_local3.getCuePoint(_local3.allCuePoints, false, _arg1));
};
}
public function get seekBarScrubTolerance():Number{
return (uiMgr.seekBarScrubTolerance);
}
flvplayback_internal function handleVideoProgressEvent(_arg1:VideoProgressEvent):void{
var _local2:VideoPlayerState;
var _local3:VideoProgressEvent;
_local2 = videoPlayerStateDict[_arg1.currentTarget];
_local3 = VideoProgressEvent(_arg1.clone());
_local3.vp = _local2.index;
dispatchEvent(_local3);
}
}
}//package fl.video
Section 41
//flvplayback_internal (fl.video.flvplayback_internal)
package fl.video {
public namespace flvplayback_internal = "http://www.adobe.com/2007/flash/flvplayback/internal";
}//package fl.video
Section 42
//FPADManager (fl.video.FPADManager)
package fl.video {
import flash.events.*;
import flash.net.*;
public class FPADManager {
flvplayback_internal var _parseResults:ParseResults;
flvplayback_internal var rtmpURL:String;
flvplayback_internal var _url:String;
flvplayback_internal var xmlLoader:URLLoader;
flvplayback_internal var xml:XML;
flvplayback_internal var _uriParam:String;
private var _owner:INCManager;
public static const VERSION:String = "2.1.0.14";
public static const SHORT_VERSION:String = "2.1";
public function FPADManager(_arg1:INCManager){
_owner = _arg1;
}
flvplayback_internal function connectXML(_arg1:String, _arg2:String, _arg3:String, _arg4:ParseResults):Boolean{
_uriParam = _arg2;
_parseResults = _arg4;
_url = ((_arg1 + "uri=") + _parseResults.protocol);
if (_parseResults.serverName != null){
_url = (_url + ("/" + _parseResults.serverName));
};
if (_parseResults.portNumber != null){
_url = (_url + (":" + _parseResults.portNumber));
};
if (_parseResults.wrappedURL != null){
_url = (_url + ("/?" + _parseResults.wrappedURL));
};
_url = (_url + ("/" + _parseResults.appName));
_url = (_url + _arg3);
xml = new XML();
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader.load(new URLRequest(_url));
return (false);
}
flvplayback_internal function xmlLoadEventHandler(_arg1:Event):void{
var proxy:String;
var e = _arg1;
try {
if (e.type != Event.COMPLETE){
_owner.helperDone(this, false);
} else {
xml = new XML(xmlLoader.data);
if ((((xml == null)) || ((xml.localName() == null)))){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" No root node found; if url is for an flv it must have .flv extension and take no parameters")));
} else {
if (xml.localName() != "fpad"){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Root node not fpad")));
};
};
proxy = null;
if ((((((xml.proxy.length() > 0)) && (xml.proxy.hasSimpleContent()))) && ((xml.proxy.*[0].nodeKind() == "text")))){
proxy = xml.proxy.*[0].toString();
};
if (proxy == null){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" fpad xml requires proxy tag.")));
};
rtmpURL = ((((_parseResults.protocol + "/") + proxy) + "/?") + _uriParam);
_owner.helperDone(this, true);
};
} catch(err:Error) {
_owner.helperDone(this, false);
throw (err);
};
}
}
}//package fl.video
Section 43
//Icon (fl.video.Icon)
package fl.video {
import flash.display.*;
public dynamic class Icon extends MovieClip {
}
}//package fl.video
Section 44
//INCManager (fl.video.INCManager)
package fl.video {
import flash.net.*;
public interface INCManager {
function set timeout(_arg1:uint):void;
function get streamLength():Number;
function get timeout():uint;
function connectToURL(_arg1:String):Boolean;
function get streamName():String;
function get bitrate():Number;
function get streamHeight():int;
function helperDone(_arg1:Object, _arg2:Boolean):void;
function getProperty(_arg1:String);
function get streamWidth():int;
function connectAgain():Boolean;
function reconnect():void;
function set videoPlayer(_arg1:VideoPlayer):void;
function setProperty(_arg1:String, _arg2):void;
function set bitrate(_arg1:Number):void;
function get netConnection():NetConnection;
function get videoPlayer():VideoPlayer;
function get isRTMP():Boolean;
function close():void;
}
}//package fl.video
Section 45
//IVPEvent (fl.video.IVPEvent)
package fl.video {
public interface IVPEvent {
function set vp(_arg1:uint):void;
function get vp():uint;
function get type():String;
}
}//package fl.video
Section 46
//LayoutEvent (fl.video.LayoutEvent)
package fl.video {
import flash.events.*;
import flash.geom.*;
public class LayoutEvent extends Event {
private var _oldBounds:Rectangle;
private var _oldRegistrationBounds:Rectangle;
public static const LAYOUT:String = "layout";
public function LayoutEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Rectangle=null, _arg5:Rectangle=null){
super(_arg1, _arg2, _arg3);
_oldBounds = _arg4;
_oldRegistrationBounds = _arg5;
}
public function get oldRegistrationBounds():Rectangle{
return (_oldRegistrationBounds);
}
override public function clone():Event{
return (new LayoutEvent(type, bubbles, cancelable, Rectangle(oldBounds.clone()), Rectangle(oldRegistrationBounds.clone())));
}
public function set oldRegistrationBounds(_arg1:Rectangle):void{
_oldRegistrationBounds = _arg1;
}
public function set oldBounds(_arg1:Rectangle):void{
_oldBounds = _arg1;
}
public function get oldBounds():Rectangle{
return (_oldBounds);
}
}
}//package fl.video
Section 47
//MetadataEvent (fl.video.MetadataEvent)
package fl.video {
import flash.events.*;
public class MetadataEvent extends Event implements IVPEvent {
private var _info:Object;
private var _vp:uint;
public static const METADATA_RECEIVED:String = "metadataReceived";
public static const CUE_POINT:String = "cuePoint";
public function MetadataEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Object=null, _arg5:uint=0){
super(_arg1, _arg2, _arg3);
_info = _arg4;
_vp = _arg5;
}
public function get vp():uint{
return (_vp);
}
public function set info(_arg1:Object):void{
_info = _arg1;
}
override public function clone():Event{
return (new MetadataEvent(type, bubbles, cancelable, info, vp));
}
public function get info():Object{
return (_info);
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
}
}//package fl.video
Section 48
//NCManager (fl.video.NCManager)
package fl.video {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class NCManager implements INCManager {
public const DEFAULT_TIMEOUT:uint = 60000;
flvplayback_internal var _serverName:String;
flvplayback_internal var _tryNCTimer:Timer;
flvplayback_internal var _autoSenseBW:Boolean;
flvplayback_internal var _fpadZone:Number;
flvplayback_internal var _appName:String;
flvplayback_internal var _ncConnected:Boolean;
flvplayback_internal var _fpadMgr:FPADManager;
flvplayback_internal var _bitrate:Number;
flvplayback_internal var _timeoutTimer:Timer;
flvplayback_internal var _wrappedURL:String;
flvplayback_internal var _payload:Number;
flvplayback_internal var _proxyType:String;
flvplayback_internal var _nc:NetConnection;
flvplayback_internal var _streamLength:Number;
flvplayback_internal var _connTypeCounter:uint;
flvplayback_internal var _streamWidth:int;
flvplayback_internal var _ncUri:String;
flvplayback_internal var _contentPath:String;
flvplayback_internal var _smilMgr:SMILManager;
flvplayback_internal var _streamHeight:int;
flvplayback_internal var _isRTMP:Boolean;
flvplayback_internal var _tryNC:Array;
flvplayback_internal var _owner:VideoPlayer;
flvplayback_internal var _streams:Array;
flvplayback_internal var _portNumber:String;
flvplayback_internal var _streamName:String;
flvplayback_internal var _objectEncoding:uint;
public var fallbackServerName:String;
flvplayback_internal var _protocol:String;
public static const VERSION:String = "2.1.0.14";
public static const SHORT_VERSION:String = "2.1";
public function NCManager(){
_fpadZone = NaN;
_objectEncoding = ObjectEncoding.AMF0;
_proxyType = "best";
_timeoutTimer = new Timer(DEFAULT_TIMEOUT);
_timeoutTimer.addEventListener(TimerEvent.TIMER, this._onFMSConnectTimeOut);
_tryNCTimer = new Timer(1500, 1);
_tryNCTimer.addEventListener(TimerEvent.TIMER, this.nextConnect);
initNCInfo();
initOtherInfo();
_nc = null;
_ncConnected = false;
}
flvplayback_internal function initNCInfo():void{
_isRTMP = false;
_serverName = null;
_wrappedURL = null;
_portNumber = null;
_appName = null;
}
flvplayback_internal function cleanConns():void{
var _local1:uint;
_tryNCTimer.reset();
if (_tryNC != null){
_local1 = 0;
while (_local1 < _tryNC.length) {
if (_tryNC[_local1] != null){
_tryNC[_local1].removeEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
if (_tryNC[_local1].client.pending){
_tryNC[_local1].addEventListener(NetStatusEvent.NET_STATUS, disconnectOnStatus);
} else {
_tryNC[_local1].close();
};
};
_tryNC[_local1] = null;
_local1++;
};
_tryNC = null;
};
}
public function get streamWidth():int{
return (_streamWidth);
}
public function connectToURL(_arg1:String):Boolean{
var parseResults:ParseResults;
var canReuse:Boolean;
var name:String;
var url = _arg1;
initOtherInfo();
_contentPath = url;
if ((((_contentPath == null)) || ((_contentPath == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE));
};
parseResults = parseURL(_contentPath);
if ((((parseResults.streamName == null)) || ((parseResults.streamName == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE, url));
};
if (parseResults.isRTMP){
canReuse = canReuseOldConnection(parseResults);
_isRTMP = true;
_protocol = parseResults.protocol;
_streamName = parseResults.streamName;
_serverName = parseResults.serverName;
_wrappedURL = parseResults.wrappedURL;
_portNumber = parseResults.portNumber;
_appName = parseResults.appName;
if ((((((((_appName == null)) || ((_appName == "")))) || ((_streamName == null)))) || ((_streamName == "")))){
throw (new VideoError(VideoError.INVALID_SOURCE, url));
};
_autoSenseBW = (_streamName.indexOf(",") >= 0);
return (((canReuse) || (connectRTMP())));
//unresolved jump
};
name = parseResults.streamName;
if ((((((((name.indexOf("?") < 0)) && ((((name.length < 4)) || (!((name.slice(-4).toLowerCase() == ".txt"))))))) && ((((name.length < 4)) || (!((name.slice(-4).toLowerCase() == ".xml"))))))) && ((((name.length < 5)) || (!((name.slice(-5).toLowerCase() == ".smil"))))))){
canReuse = canReuseOldConnection(parseResults);
_isRTMP = false;
_streamName = name;
return (((canReuse) || (connectHTTP())));
};
if (name.indexOf("/fms/fpad") >= 0){
try {
return (connectFPAD(name));
} catch(err:Error) {
};
};
_smilMgr = new SMILManager(this);
return (_smilMgr.connectXML(name));
}
public function get streamName():String{
return (_streamName);
}
flvplayback_internal function reconnectOnStatus(_arg1:NetStatusEvent):void{
if ((((_arg1.info.code == "NetConnection.Connect.Failed")) || ((_arg1.info.code == "NetConnection.Connect.Rejected")))){
_nc = null;
_ncConnected = false;
_owner.ncReconnected();
};
}
public function get videoPlayer():VideoPlayer{
return (_owner);
}
flvplayback_internal function getStreamLengthResult(_arg1:Number):void{
if (_arg1 > 0){
_streamLength = _arg1;
};
_owner.ncConnected();
}
flvplayback_internal function canReuseOldConnection(_arg1:ParseResults):Boolean{
if ((((_nc == null)) || (!(_ncConnected)))){
return (false);
};
if (!_arg1.isRTMP){
if (!_isRTMP){
return (true);
};
_owner.close();
_nc = null;
_ncConnected = false;
initNCInfo();
return (false);
};
if (_isRTMP){
if ((((((((((_arg1.serverName == _serverName)) && ((_arg1.appName == _appName)))) && ((_arg1.protocol == _protocol)))) && ((_arg1.portNumber == _portNumber)))) && ((_arg1.wrappedURL == _wrappedURL)))){
return (true);
};
_owner.close();
_nc = null;
_ncConnected = false;
};
initNCInfo();
return (false);
}
public function getProperty(_arg1:String){
switch (_arg1){
case "fallbackServerName":
return (fallbackServerName);
case "fpadZone":
return (_fpadZone);
case "objectEncoding":
return (_objectEncoding);
case "proxyType":
return (_proxyType);
default:
throw (new VideoError(VideoError.UNSUPPORTED_PROPERTY, _arg1));
};
}
flvplayback_internal function connectRTMP():Boolean{
var _local1:int;
var _local2:uint;
_timeoutTimer.stop();
_timeoutTimer.start();
_tryNC = new Array();
_local1 = ((((_protocol == "rtmp:/")) || ((_protocol == "rtmpe:/")))) ? 2 : 1;
_local2 = 0;
while (_local2 < _local1) {
_tryNC[_local2] = new NetConnection();
_tryNC[_local2].objectEncoding = _objectEncoding;
_tryNC[_local2].proxyType = _proxyType;
if (!isNaN(_fpadZone)){
_tryNC[_local2].fpadZone = _fpadZone;
};
_tryNC[_local2].client = new ConnectClient(this, _tryNC[_local2], _local2);
_tryNC[_local2].addEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
_local2++;
};
nextConnect();
return (false);
}
public function reconnect():void{
if (!_isRTMP){
throw (new Error("Cannot call reconnect on an http connection"));
};
_nc.client = new ReconnectClient(this);
_nc.addEventListener(NetStatusEvent.NET_STATUS, reconnectOnStatus);
_nc.connect(_ncUri, false);
}
public function helperDone(_arg1:Object, _arg2:Boolean):void{
var _local3:ParseResults;
var _local4:String;
var _local5:Boolean;
var _local6:uint;
var _local7:Number;
if (!_arg2){
_nc = null;
_ncConnected = false;
_owner.ncConnected();
_smilMgr = null;
_fpadMgr = null;
return;
};
_local5 = false;
if (_arg1 == _fpadMgr){
_local4 = _fpadMgr.rtmpURL;
_fpadMgr = null;
_local3 = parseURL(_local4);
_isRTMP = _local3.isRTMP;
_protocol = _local3.protocol;
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
_streamName = _local3.streamName;
_local7 = _fpadZone;
_fpadZone = NaN;
connectRTMP();
_fpadZone = _local7;
return;
};
if (_arg1 != _smilMgr){
return;
};
_streamWidth = _smilMgr.width;
_streamHeight = _smilMgr.height;
_local4 = _smilMgr.baseURLAttr[0];
if (((!((_local4 == null))) && (!((_local4 == ""))))){
if (_local4.charAt((_local4.length - 1)) != "/"){
_local4 = (_local4 + "/");
};
_local3 = parseURL(_local4);
_isRTMP = _local3.isRTMP;
_local5 = true;
_streamName = _local3.streamName;
if (_isRTMP){
_protocol = _local3.protocol;
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
if ((((_appName == null)) || ((_appName == "")))){
_smilMgr = null;
throw (new VideoError(VideoError.INVALID_XML, ("Base RTMP URL must include application name: " + _local4)));
};
if (_smilMgr.baseURLAttr.length > 1){
_local3 = parseURL(_smilMgr.baseURLAttr[1]);
if (_local3.serverName != null){
fallbackServerName = _local3.serverName;
};
};
};
};
_streams = _smilMgr.videoTags;
_smilMgr = null;
_local6 = 0;
while (_local6 < _streams.length) {
_local4 = _streams[_local6].src;
_local3 = parseURL(_local4);
if (!_local5){
_isRTMP = _local3.isRTMP;
_local5 = true;
if (_isRTMP){
_protocol = _local3.protocol;
if (_streams.length > 1){
throw (new VideoError(VideoError.INVALID_XML, "Cannot switch between multiple absolute RTMP URLs, must use meta tag base attribute."));
};
_serverName = _local3.serverName;
_portNumber = _local3.portNumber;
_wrappedURL = _local3.wrappedURL;
_appName = _local3.appName;
if ((((_appName == null)) || ((_appName == "")))){
throw (new VideoError(VideoError.INVALID_XML, ("Base RTMP URL must include application name: " + _local4)));
};
} else {
if ((((_local3.streamName.indexOf("/fms/fpad") >= 0)) && ((_streams.length > 1)))){
throw (new VideoError(VideoError.INVALID_XML, "Cannot switch between multiple absolute fpad URLs, must use meta tag base attribute."));
};
};
} else {
if (((((((!((_streamName == null))) && (!((_streamName == ""))))) && (!(_local3.isRelative)))) && ((_streams.length > 1)))){
throw (new VideoError(VideoError.INVALID_XML, "When using meta tag base attribute, cannot use absolute URLs for video or ref tag src attributes."));
};
};
_streams[_local6].parseResults = _local3;
_local6++;
};
_autoSenseBW = (_streams.length > 1);
if (!_autoSenseBW){
if (_streamName != null){
_streamName = (_streamName + _streams[0].parseResults.streamName);
} else {
_streamName = _streams[0].parseResults.streamName;
};
if (((_isRTMP) && ((_streamName.substr(-4).toLowerCase() == ".flv")))){
_streamName = _streamName.substr(0, (_streamName.length - 4));
};
_streamLength = _streams[0].dur;
};
if (_isRTMP){
connectRTMP();
} else {
if (((!((_streamName == null))) && ((_streamName.indexOf("/fms/fpad") >= 0)))){
connectFPAD(_streamName);
} else {
if (_autoSenseBW){
bitrateMatch();
};
connectHTTP();
_owner.ncConnected();
};
};
}
public function get netConnection():NetConnection{
return (_nc);
}
public function get bitrate():Number{
return (_bitrate);
}
public function setProperty(_arg1:String, _arg2):void{
switch (_arg1){
case "fallbackServerName":
fallbackServerName = String(_arg2);
break;
case "fpadZone":
_fpadZone = Number(_arg2);
break;
case "objectEncoding":
_objectEncoding = uint(_arg2);
break;
case "proxyType":
_proxyType = String(_arg2);
break;
default:
throw (new VideoError(VideoError.UNSUPPORTED_PROPERTY, _arg1));
};
}
public function get timeout():uint{
return (_timeoutTimer.delay);
}
public function set videoPlayer(_arg1:VideoPlayer):void{
_owner = _arg1;
}
flvplayback_internal function bitrateMatch():void{
var _local1:Number;
var _local2:uint;
var _local3:uint;
_local1 = _bitrate;
if (isNaN(_local1)){
_local1 = 0;
};
_local2 = _streams.length;
_local3 = 0;
while (_local3 < _streams.length) {
if (((isNaN(_streams[_local3].bitrate)) || ((_local1 >= _streams[_local3].bitrate)))){
_local2 = _local3;
break;
};
_local3++;
};
if (_local2 == _streams.length){
throw (new VideoError(VideoError.NO_BITRATE_MATCH));
};
if (_streamName != null){
_streamName = (_streamName + _streams[_local2].src);
} else {
_streamName = _streams[_local2].src;
};
if (((_isRTMP) && ((_streamName.substr(-4).toLowerCase() == ".flv")))){
_streamName = _streamName.substr(0, (_streamName.length - 4));
};
_streamLength = _streams[_local2].dur;
}
flvplayback_internal function disconnectOnStatus(_arg1:NetStatusEvent):void{
if (_arg1.info.code == "NetConnection.Connect.Success"){
_arg1.target.removeEventListener(NetStatusEvent.NET_STATUS, disconnectOnStatus);
_arg1.target.close();
};
}
flvplayback_internal function nextConnect(_arg1:TimerEvent=null):void{
var _local2:String;
var _local3:String;
var _local4:String;
if (_connTypeCounter == 0){
_local2 = _protocol;
_local3 = _portNumber;
} else {
_local3 = null;
if (_protocol == "rtmp:/"){
_local2 = "rtmpt:/";
} else {
if (_protocol == "rtmpe:/"){
_local2 = "rtmpte:/";
} else {
_tryNC.pop();
return;
};
};
};
_local4 = (((_local2 + ((_serverName)==null) ? "" : ((("/" + _serverName) + ((_local3)==null) ? "" : (":" + _local3)) + "/")) + ((_wrappedURL)==null) ? "" : (_wrappedURL + "/")) + _appName);
_tryNC[_connTypeCounter].client.pending = true;
_tryNC[_connTypeCounter].connect(_local4, _autoSenseBW);
if (_connTypeCounter < (_tryNC.length - 1)){
_connTypeCounter++;
_tryNCTimer.reset();
_tryNCTimer.start();
};
}
flvplayback_internal function connectFPAD(_arg1:String):Boolean{
var _local2:Object;
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:ParseResults;
_local2 = /^(.+)(\?|\&)(uri=)([^&]+)(\&.*)?$/.exec(_arg1);
if (_local2 == null){
throw (new VideoError(VideoError.INVALID_SOURCE, ("fpad url must include uri parameter: " + _arg1)));
};
_local3 = (_local2[1] + _local2[2]);
_local4 = _local2[4];
_local5 = ((_local2[5])==undefined) ? "" : _local2[5];
_local6 = parseURL(_local4);
if (!_local6.isRTMP){
throw (new VideoError(VideoError.INVALID_SOURCE, ("fpad url uri parameter must be rtmp url: " + _arg1)));
};
_fpadMgr = new FPADManager(this);
return (_fpadMgr.connectXML(_local3, _local4, _local5, _local6));
}
flvplayback_internal function connectHTTP():Boolean{
_nc = new NetConnection();
_nc.connect(null);
_ncConnected = true;
return (true);
}
public function get isRTMP():Boolean{
return (_isRTMP);
}
public function get streamLength():Number{
return (_streamLength);
}
public function connectAgain():Boolean{
var _local1:int;
var _local2:String;
_local1 = _appName.indexOf("/");
if (_local1 < 0){
_local1 = _streamName.indexOf("/");
if (_local1 >= 0){
_appName = (_appName + "/");
_appName = (_appName + _streamName.slice(0, _local1));
_streamName = _streamName.slice((_local1 + 1));
};
return (false);
};
_local2 = _appName.slice((_local1 + 1));
_local2 = (_local2 + "/");
_local2 = (_local2 + _streamName);
_streamName = _local2;
_appName = _appName.slice(0, _local1);
close();
_payload = 0;
_connTypeCounter = 0;
cleanConns();
connectRTMP();
return (true);
}
flvplayback_internal function parseURL(_arg1:String):ParseResults{
var _local2:ParseResults;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:ParseResults;
_local2 = new ParseResults();
_local3 = 0;
_local4 = _arg1.indexOf(":/", _local3);
if (_local4 >= 0){
_local4 = (_local4 + 2);
_local2.protocol = _arg1.slice(_local3, _local4).toLowerCase();
_local2.isRelative = false;
} else {
_local2.isRelative = true;
};
if (((!((_local2.protocol == null))) && ((((((((((_local2.protocol == "rtmp:/")) || ((_local2.protocol == "rtmpt:/")))) || ((_local2.protocol == "rtmps:/")))) || ((_local2.protocol == "rtmpe:/")))) || ((_local2.protocol == "rtmpte:/")))))){
_local2.isRTMP = true;
_local3 = _local4;
if (_arg1.charAt(_local3) == "/"){
_local3++;
_local5 = _arg1.indexOf(":", _local3);
_local6 = _arg1.indexOf("/", _local3);
if (_local6 < 0){
if (_local5 < 0){
_local2.serverName = _arg1.slice(_local3);
} else {
_local4 = _local5;
_local2.portNumber = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local2.serverName = _arg1.slice(_local3);
};
return (_local2);
};
if ((((_local5 >= 0)) && ((_local5 < _local6)))){
_local4 = _local5;
_local2.serverName = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local4 = _local6;
_local2.portNumber = _arg1.slice(_local3, _local4);
} else {
_local4 = _local6;
_local2.serverName = _arg1.slice(_local3, _local4);
};
_local3 = (_local4 + 1);
};
if (_arg1.charAt(_local3) == "?"){
_local7 = _arg1.slice((_local3 + 1));
_local8 = parseURL(_local7);
if ((((_local8.protocol == null)) || (!(_local8.isRTMP)))){
throw (new VideoError(VideoError.INVALID_SOURCE, _arg1));
};
_local2.wrappedURL = "?";
_local2.wrappedURL = (_local2.wrappedURL + _local8.protocol);
if (_local8.serverName != null){
_local2.wrappedURL = (_local2.wrappedURL + "/");
_local2.wrappedURL = (_local2.wrappedURL + _local8.serverName);
};
if (_local8.portNumber != null){
_local2.wrappedURL = (_local2.wrappedURL + (":" + _local8.portNumber));
};
if (_local8.wrappedURL != null){
_local2.wrappedURL = (_local2.wrappedURL + "/");
_local2.wrappedURL = (_local2.wrappedURL + _local8.wrappedURL);
};
_local2.appName = _local8.appName;
_local2.streamName = _local8.streamName;
return (_local2);
};
_local4 = _arg1.indexOf("/", _local3);
if (_local4 < 0){
_local2.appName = _arg1.slice(_local3);
return (_local2);
};
_local2.appName = _arg1.slice(_local3, _local4);
_local3 = (_local4 + 1);
_local4 = _arg1.indexOf("/", _local3);
if (_local4 < 0){
_local2.streamName = _arg1.slice(_local3);
if (_local2.streamName.slice(-4).toLowerCase() == ".flv"){
_local2.streamName = _local2.streamName.slice(0, -4);
};
return (_local2);
};
_local2.appName = (_local2.appName + "/");
_local2.appName = (_local2.appName + _arg1.slice(_local3, _local4));
_local3 = (_local4 + 1);
_local2.streamName = _arg1.slice(_local3);
if (_local2.streamName.slice(-4).toLowerCase() == ".flv"){
_local2.streamName = _local2.streamName.slice(0, -4);
};
} else {
_local2.isRTMP = false;
_local2.streamName = _arg1;
};
return (_local2);
}
flvplayback_internal function initOtherInfo():void{
_contentPath = null;
_streamName = null;
_streamWidth = -1;
_streamHeight = -1;
_streamLength = NaN;
_streams = null;
_autoSenseBW = false;
_payload = 0;
_connTypeCounter = 0;
cleanConns();
}
public function set timeout(_arg1:uint):void{
_timeoutTimer.delay = _arg1;
}
flvplayback_internal function _onFMSConnectTimeOut(_arg1:TimerEvent=null):void{
cleanConns();
_nc = null;
_ncConnected = false;
if (!connectAgain()){
_owner.ncConnected();
};
}
public function get streamHeight():int{
return (_streamHeight);
}
flvplayback_internal function connectOnStatus(_arg1:NetStatusEvent):void{
var _local2:ParseResults;
_arg1.target.client.pending = false;
if (_arg1.info.code == "NetConnection.Connect.Success"){
_nc = _tryNC[_arg1.target.client.connIndex];
cleanConns();
} else {
if ((((((_arg1.info.code == "NetConnection.Connect.Rejected")) && (!((_arg1.info.ex == null))))) && ((_arg1.info.ex.code == 302)))){
_connTypeCounter = 0;
cleanConns();
_local2 = parseURL(_arg1.info.ex.redirect);
if (_local2.isRTMP){
_protocol = _local2.protocol;
_serverName = _local2.serverName;
_wrappedURL = _local2.wrappedURL;
_portNumber = _local2.portNumber;
_appName = _local2.appName;
if (_local2.streamName != null){
_appName = (_appName + ("/" + _local2.streamName));
};
connectRTMP();
} else {
tryFallBack();
};
} else {
if ((((((_arg1.info.code == "NetConnection.Connect.Failed")) || ((_arg1.info.code == "NetConnection.Connect.Rejected")))) && ((_arg1.target.client.connIndex == (_tryNC.length - 1))))){
if (!connectAgain()){
tryFallBack();
};
};
};
};
}
flvplayback_internal function onReconnected():void{
_ncConnected = true;
_owner.ncReconnected();
}
flvplayback_internal function tryFallBack():void{
if ((((_serverName == fallbackServerName)) || ((fallbackServerName == null)))){
_nc = null;
_ncConnected = false;
_owner.ncConnected();
} else {
_connTypeCounter = 0;
cleanConns();
_serverName = fallbackServerName;
connectRTMP();
};
}
public function set bitrate(_arg1:Number):void{
if (!_isRTMP){
_bitrate = _arg1;
};
}
flvplayback_internal function onConnected(_arg1:NetConnection, _arg2:Number):void{
var _local3:Array;
var _local4:uint;
var _local5:String;
_timeoutTimer.stop();
_arg1.removeEventListener(NetStatusEvent.NET_STATUS, connectOnStatus);
_nc = _arg1;
_ncUri = _nc.uri;
_ncConnected = true;
if (_autoSenseBW){
_bitrate = (_arg2 * 0x0400);
if (_streams != null){
bitrateMatch();
} else {
_local3 = _streamName.split(",");
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = stripFrontAndBackWhiteSpace(_local3[_local4]);
if ((_local4 + 1) < _local3.length){
if (_arg2 <= Number(_local3[(_local4 + 1)])){
_streamName = _local5;
break;
};
} else {
_streamName = _local5;
break;
};
_local4 = (_local4 + 2);
};
if (_streamName.slice(-4).toLowerCase() == ".flv"){
_streamName = _streamName.slice(0, -4);
};
};
};
if (((!(_owner.isLive)) && (isNaN(_streamLength)))){
_nc.call("getStreamLength", new Responder(getStreamLengthResult), _streamName);
} else {
_owner.ncConnected();
};
}
public function close():void{
if (_nc){
_nc.close();
_ncConnected = false;
};
}
flvplayback_internal static function stripFrontAndBackWhiteSpace(_arg1:String):String{
var _local2:uint;
var _local3:uint;
var _local4:int;
var _local5:int;
_local3 = _arg1.length;
_local4 = 0;
_local5 = _local3;
_local2 = 0;
for (;_local2 < _local3;_local2++) {
switch (_arg1.charCodeAt(_local2)){
case 9:
case 10:
case 13:
case 32:
continue;
};
_local4 = _local2;
break;
};
_local2 = _local3;
for (;_local2 >= 0;_local2--) {
switch (_arg1.charCodeAt(_local2)){
case 9:
case 10:
case 13:
case 32:
continue;
};
_local5 = (_local2 + 1);
break;
};
if (_local5 <= _local4){
return ("");
};
return (_arg1.slice(_local4, _local5));
}
}
}//package fl.video
Section 49
//ParseResults (fl.video.ParseResults)
package fl.video {
public class ParseResults {
public var portNumber:String;
public var streamName:String;
public var serverName:String;
public var isRTMP:Boolean;
public var appName:String;
public var isRelative:Boolean;
public var protocol:String;
public var wrappedURL:String;
}
}//package fl.video
Section 50
//QueuedCommand (fl.video.QueuedCommand)
package fl.video {
public class QueuedCommand {
public var type:uint;
public var time:Number;
public var url:String;
public var isLive:Boolean;
public static const LOAD:uint = 1;
public static const STOP:uint = 3;
public static const PLAY_WHEN_ENOUGH:uint = 5;
public static const PLAY:uint = 0;
public static const PAUSE:uint = 2;
public static const SEEK:uint = 4;
public function QueuedCommand(_arg1:uint, _arg2:String, _arg3:Boolean, _arg4:Number){
this.type = _arg1;
this.url = _arg2;
this.isLive = _arg3;
this.time = _arg4;
}
}
}//package fl.video
Section 51
//ReconnectClient (fl.video.ReconnectClient)
package fl.video {
public class ReconnectClient {
public var owner:NCManager;
public function ReconnectClient(_arg1:NCManager){
this.owner = _arg1;
}
public function close():void{
}
public function onBWDone(... _args):void{
owner.onReconnected();
}
}
}//package fl.video
Section 52
//SkinErrorEvent (fl.video.SkinErrorEvent)
package fl.video {
import flash.events.*;
public class SkinErrorEvent extends ErrorEvent {
public static const SKIN_ERROR:String = "skinError";
public function SkinErrorEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=""){
super(_arg1, _arg2, _arg3, _arg4);
}
override public function clone():Event{
return (new SkinErrorEvent(type, bubbles, cancelable, text));
}
}
}//package fl.video
Section 53
//SMILManager (fl.video.SMILManager)
package fl.video {
import flash.events.*;
import flash.net.*;
public class SMILManager {
flvplayback_internal var width:int;
flvplayback_internal var xmlLoader:URLLoader;
flvplayback_internal var xml:XML;
flvplayback_internal var height:int;
private var _url:String;
flvplayback_internal var videoTags:Array;
flvplayback_internal var baseURLAttr:Array;
private var _owner:INCManager;
public static const VERSION:String = "2.1.0.14";
public static const SHORT_VERSION:String = "2.1";
public function SMILManager(_arg1:INCManager){
_owner = _arg1;
width = -1;
height = -1;
}
flvplayback_internal function parseVideo(_arg1:XML):Object{
var _local2:Object;
_local2 = new Object();
if (_arg1.@src.length() > 0){
_local2.src = _arg1.@src.toString();
};
if (_arg1.@["system-bitrate"].length() > 0){
_local2.bitrate = int(_arg1.@["system-bitrate"].toString());
};
if (_arg1.@dur.length() > 0){
_local2.dur = parseTime(_arg1.@dur.toString());
};
return (_local2);
}
flvplayback_internal function connectXML(_arg1:String):Boolean{
_url = fixURL(_arg1);
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader.load(new URLRequest(_url));
return (false);
}
flvplayback_internal function parseSwitch(_arg1:XML):void{
var _local2:String;
var _local3:XML;
for (_local2 in _arg1.*) {
_local3 = _arg1.*[_local2];
if (_local3.nodeKind() != "element"){
} else {
switch (_local3.localName()){
case "video":
case "ref":
videoTags.push(parseVideo(_local3));
break;
default:
break;
};
};
};
}
flvplayback_internal function fixURL(_arg1:String):String{
var _local2:String;
if (/^(http:|https:)/i.test(_arg1)){
_local2 = ((_arg1.indexOf("?"))>=0) ? "&" : "?";
return ((((_arg1 + _local2) + "FLVPlaybackVersion=") + SHORT_VERSION));
};
return (_arg1);
}
flvplayback_internal function xmlLoadEventHandler(_arg1:Event):void{
var e = _arg1;
try {
if (e.type != Event.COMPLETE){
_owner.helperDone(this, false);
} else {
baseURLAttr = new Array();
videoTags = new Array();
xml = new XML(xmlLoader.data);
if ((((xml == null)) || ((xml.localName() == null)))){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" No root node found; if url is for an flv it must have .flv extension and take no parameters")));
} else {
if (xml.localName() != "smil"){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Root node not smil")));
};
};
checkForIllegalNodes(xml, "element", ["head", "body"]);
if (xml.head.length() > 0){
parseHead(xml.head[0]);
};
if (xml.body.length() < 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Tag body is required.")));
} else {
parseBody(xml.body[0]);
};
_owner.helperDone(this, true);
};
} catch(err:Error) {
_owner.helperDone(this, false);
throw (err);
} finally {
xmlLoader.removeEventListener(Event.COMPLETE, xmlLoadEventHandler);
xmlLoader.removeEventListener(IOErrorEvent.IO_ERROR, xmlLoadEventHandler);
xmlLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, xmlLoadEventHandler);
xmlLoader = null;
};
}
flvplayback_internal function checkForIllegalNodes(_arg1:XML, _arg2:String, _arg3:Array):void{
var _local4:String;
var _local5:Boolean;
var _local6:XML;
var _local7:String;
var _local8:String;
for (_local4 in _arg1.*) {
_local5 = false;
_local6 = _arg1.*[_local4];
if (_local6.nodeKind() != _arg2){
} else {
_local7 = _local6.localName();
for (_local8 in _arg3) {
if (_arg3[_local8] == _local7){
_local5 = true;
break;
};
};
if (!_local5){
throw (new VideoError(VideoError.INVALID_XML, (((((((("URL: \"" + _url) + "\" ") + _arg2) + " ") + _local7) + " not supported in ") + _arg1.localName()) + " tag.")));
};
};
};
}
flvplayback_internal function parseHead(_arg1:XML):void{
checkForIllegalNodes(_arg1, "element", ["meta", "layout"]);
if (_arg1.meta.length() > 0){
checkForIllegalNodes(_arg1.meta[0], "element", []);
checkForIllegalNodes(_arg1.meta[0], "attribute", ["base"]);
if (_arg1.meta.@base.length() > 0){
baseURLAttr.push(_arg1.meta.@base.toString());
};
};
if (_arg1.layout.length() > 0){
parseLayout(_arg1.layout[0]);
};
}
flvplayback_internal function parseBody(_arg1:XML):void{
var _local2:XML;
var _local3:String;
var _local4:Object;
if (((!((_arg1.*.length() == 1))) || (!((_arg1.*[0].nodeKind() == "element"))))){
throw (new VideoError(VideoError.INVALID_XML, (((("URL: \"" + _url) + "\" Tag ") + _arg1.localName()) + " is required to contain exactly one tag.")));
};
_local2 = _arg1.*[0];
_local3 = _local2.localName();
switch (_local3){
case "switch":
parseSwitch(_local2);
break;
case "video":
case "ref":
_local4 = parseVideo(_local2);
videoTags.push(_local4);
break;
default:
throw (new VideoError(VideoError.INVALID_XML, (((((("URL: \"" + _url) + "\" Tag ") + _local3) + " not supported in ") + _arg1.localName()) + " tag.")));
};
if (videoTags.length < 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" At least one video of ref tag is required.")));
};
}
flvplayback_internal function parseTime(_arg1:String):Number{
var _local2:Object;
var _local3:Number;
var _local4:Number;
_local2 = /^((\d+):)?(\d+):((\d+)(.\d+)?)$/.exec(_arg1);
if (_local2 == null){
_local3 = Number(_arg1);
if (((isNaN(_local3)) || ((_local3 < 0)))){
throw (new VideoError(VideoError.INVALID_XML, ("Invalid dur value: " + _arg1)));
};
return (_local3);
//unresolved jump
};
_local4 = 0;
_local4 = (_local4 + ((uint(_local2[2]) * 60) * 60));
_local4 = (_local4 + (uint(_local2[3]) * 60));
_local4 = (_local4 + Number(_local2[4]));
return (_local4);
}
flvplayback_internal function parseLayout(_arg1:XML):void{
var _local2:XML;
var _local3:Number;
var _local4:Number;
checkForIllegalNodes(_arg1, "element", ["root-layout"]);
if (_arg1["root-layout"].length() > 1){
throw (new VideoError(VideoError.INVALID_XML, (("URL: \"" + _url) + "\" Only one base attribute supported in meta tag.")));
};
if (_arg1["root-layout"].length() > 0){
_local2 = _arg1["root-layout"][0];
if (_local2.@width.length() > 0){
_local3 = Number(_local2.@width[0]);
};
if (_local2.@height.length() > 0){
_local4 = Number(_local2.@height[0]);
};
if (((((((isNaN(_local3)) || ((_local3 < 0)))) || (isNaN(_local4)))) || ((_local4 < 0)))){
throw (new VideoError(VideoError.INVALID_XML, (((("URL: \"" + _url) + "\" Tag ") + _arg1.localName()) + " requires attributes width and height. Width and height must be numbers greater than or equal to 0.")));
};
width = Math.round(_local3);
height = Math.round(_local4);
};
}
}
}//package fl.video
Section 54
//SoundEvent (fl.video.SoundEvent)
package fl.video {
import flash.events.*;
import flash.media.*;
public class SoundEvent extends Event {
private var _soundTransform:SoundTransform;
public static const SOUND_UPDATE:String = "soundUpdate";
public function SoundEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:SoundTransform=null){
super(_arg1, _arg2, _arg3);
_soundTransform = _arg4;
}
public function get soundTransform():SoundTransform{
return (_soundTransform);
}
override public function clone():Event{
return (new SoundEvent(type, bubbles, cancelable, soundTransform));
}
}
}//package fl.video
Section 55
//UIManager (fl.video.UIManager)
package fl.video {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
public class UIManager {
flvplayback_internal var cacheStageBGColor:uint;
flvplayback_internal var _bufferingDelayTimer:Timer;
public var ctrlDataDict:Dictionary;
flvplayback_internal var _skinAutoHide:Boolean;
flvplayback_internal var placeholderLeft:Number;
flvplayback_internal var _playAfterScrub:Boolean;
public var customClips:Array;
flvplayback_internal var _skinFadeStartTime:int;
flvplayback_internal var delayedControls:Array;
flvplayback_internal var _lastScrubPos:Number;
flvplayback_internal var _skinAutoHideLastMotionTime:int;
flvplayback_internal var _volumeBarTimer:Timer;
flvplayback_internal var cacheFLVPlaybackScaleMode:Array;
flvplayback_internal var borderScale9Rects:Array;
flvplayback_internal var _volumeBarScrubTolerance:Number;
flvplayback_internal var fullScreenSourceRectMinAspectRatio:Number;
flvplayback_internal var _skin:String;
flvplayback_internal var fullScreenSourceRectMinHeight:uint;
flvplayback_internal var videoRight:Number;
flvplayback_internal var _bufferingBarHides:Boolean;
flvplayback_internal var placeholderRight:Number;
flvplayback_internal var cachedSoundLevel:Number;
flvplayback_internal var videoBottom:Number;
flvplayback_internal var border_mc:DisplayObject;
flvplayback_internal var borderAlpha:Number;
flvplayback_internal var borderColorTransform:ColorTransform;
flvplayback_internal var _skinFadingTimer:Timer;
flvplayback_internal var __visible:Boolean;
flvplayback_internal var borderColor:uint;
flvplayback_internal var cacheFLVPlaybackIndex:int;
flvplayback_internal var cacheFLVPlaybackLocation:Rectangle;
flvplayback_internal var _skinReady:Boolean;
flvplayback_internal var controls:Array;
flvplayback_internal var cacheFLVPlaybackAlign:Array;
flvplayback_internal var _skinAutoHideMouseX:Number;
flvplayback_internal var _skinAutoHideMouseY:Number;
flvplayback_internal var layout_mc:Sprite;
flvplayback_internal var cacheSkinAutoHide:Boolean;
flvplayback_internal var cacheStageScaleMode:String;
flvplayback_internal var videoTop:Number;
flvplayback_internal var _skinFadingMaxTime:int;
flvplayback_internal var placeholderTop:Number;
flvplayback_internal var _lastVolumePos:Number;
flvplayback_internal var mouseCaptureCtrl:int;
flvplayback_internal var _seekBarScrubTolerance:Number;
flvplayback_internal var borderPrevRect:Rectangle;
flvplayback_internal var skinTemplate:Sprite;
flvplayback_internal var _progressPercent:Number;
flvplayback_internal var videoLeft:Number;
flvplayback_internal var _fullScreenVideoWidth:Number;
flvplayback_internal var _isMuted:Boolean;
flvplayback_internal var _skinAutoHideTimer:Timer;
flvplayback_internal var _fullScreenBgColor:uint;
flvplayback_internal var _vc:FLVPlayback;
flvplayback_internal var _bufferingOn:Boolean;
flvplayback_internal var _seekBarTimer:Timer;
flvplayback_internal var _controlsEnabled:Boolean;
flvplayback_internal var _fullScreen:Boolean;
flvplayback_internal var placeholderBottom:Number;
flvplayback_internal var fullScreenSourceRectMinWidth:uint;
flvplayback_internal var _fullScreenTakeOver:Boolean;
flvplayback_internal var skin_mc:Sprite;
flvplayback_internal var _fullScreenAccel:Boolean;
flvplayback_internal var _fullScreenVideoHeight:Number;
flvplayback_internal var skinLoadDelayCount:uint;
flvplayback_internal var _skinFadingIn:Boolean;
flvplayback_internal var _skinAutoHideMotionTimeout:int;
flvplayback_internal var borderCopy:Sprite;
flvplayback_internal var cacheStageAlign:String;
flvplayback_internal var cacheFLVPlaybackParent:DisplayObjectContainer;
flvplayback_internal var skinLoader:Loader;
flvplayback_internal var _skinScaleMaximum:Number;
public static const VOLUME_BAR_HIT:int = 12;
public static const MUTE_OFF_BUTTON:int = 10;
public static const BACK_BUTTON:int = 5;
public static const FORWARD_BUTTON:int = 6;
public static const STOP_BUTTON:int = 2;
public static const NUM_BUTTONS:int = 13;
public static const NORMAL_STATE:uint = 0;
public static const SEEK_BAR_HANDLE:int = 3;
public static const PLAY_BUTTON:int = 1;
public static const MUTE_BUTTON:int = 15;
public static const DOWN_STATE:uint = 2;
public static const SEEK_BAR_SCRUB_TOLERANCE_DEFAULT:Number = 5;
public static const FULL_SCREEN_OFF_BUTTON:int = 8;
flvplayback_internal static const SKIN_AUTO_HIDE_MOTION_TIMEOUT_DEFAULT:Number = 3000;
public static const SEEK_BAR:int = 17;
public static const VOLUME_BAR_SCRUB_TOLERANCE_DEFAULT:Number = 0;
public static const FULL_SCREEN_ON_BUTTON:int = 7;
public static const FULL_SCREEN_BUTTON:int = 14;
public static const BUFFERING_BAR:int = 16;
public static const VERSION:String = "2.1.0.14";
public static const VOLUME_BAR_HANDLE:int = 11;
public static const PAUSE_BUTTON:int = 0;
flvplayback_internal static const SKIN_AUTO_HIDE_INTERVAL:Number = 200;
public static const OVER_STATE:uint = 1;
flvplayback_internal static const SKIN_FADING_INTERVAL:Number = 100;
public static const VOLUME_BAR:int = 18;
public static const SHORT_VERSION:String = "2.1";
public static const SEEK_BAR_INTERVAL_DEFAULT:Number = 250;
flvplayback_internal static const SKIN_FADING_MAX_TIME_DEFAULT:Number = 500;
public static const SEEK_BAR_HIT:int = 4;
public static const PLAY_PAUSE_BUTTON:int = 13;
public static const BUFFERING_DELAY_INTERVAL_DEFAULT:Number = 1000;
public static const MUTE_ON_BUTTON:int = 9;
public static const FULL_SCREEN_SOURCE_RECT_MIN_HEIGHT:uint = 240;
public static const NUM_CONTROLS:int = 19;
public static const VOLUME_BAR_INTERVAL_DEFAULT:Number = 250;
public static const FULL_SCREEN_SOURCE_RECT_MIN_WIDTH:uint = 320;
flvplayback_internal static var layoutNameToIndexMappings:Object = null;
flvplayback_internal static var buttonSkinLinkageIDs:Array = ["upLinkageID", "overLinkageID", "downLinkageID"];
flvplayback_internal static var layoutNameArray:Array = ["pause_mc", "play_mc", "stop_mc", null, null, "back_mc", "forward_mc", null, null, null, null, null, null, "playpause_mc", "fullScreenToggle_mc", "volumeMute_mc", "bufferingBar_mc", "seekBar_mc", "volumeBar_mc", "seekBarHandle_mc", "seekBarHit_mc", "seekBarProgress_mc", "seekBarFullness_mc", "volumeBarHandle_mc", "volumeBarHit_mc", "volumeBarProgress_mc", "volumeBarFullness_mc", "progressFill_mc"];
flvplayback_internal static var skinClassPrefixes:Array = ["pauseButton", "playButton", "stopButton", null, null, "backButton", "forwardButton", "fullScreenButtonOn", "fullScreenButtonOff", "muteButtonOn", "muteButtonOff", null, null, null, null, null, "bufferingBar", "seekBar", "volumeBar"];
flvplayback_internal static var customComponentClassNames:Array = ["PauseButton", "PlayButton", "StopButton", null, null, "BackButton", "ForwardButton", null, null, null, null, null, null, "PlayPauseButton", "FullScreenButton", "MuteButton", "BufferingBar", "SeekBar", "VolumeBar"];
public function UIManager(_arg1:FLVPlayback){
var vc = _arg1;
super();
_vc = vc;
_skin = null;
_skinAutoHide = false;
cacheSkinAutoHide = _skinAutoHide;
_skinFadingMaxTime = SKIN_FADING_MAX_TIME_DEFAULT;
_skinAutoHideMotionTimeout = SKIN_AUTO_HIDE_MOTION_TIMEOUT_DEFAULT;
_skinReady = true;
__visible = false;
_bufferingBarHides = false;
_controlsEnabled = true;
_lastScrubPos = 0;
_lastVolumePos = 0;
cachedSoundLevel = _vc.volume;
_isMuted = false;
controls = new Array();
customClips = null;
ctrlDataDict = new Dictionary(true);
skin_mc = null;
skinLoader = null;
skinTemplate = null;
layout_mc = null;
border_mc = null;
borderCopy = null;
borderPrevRect = null;
borderScale9Rects = null;
borderAlpha = 0.85;
borderColor = 4697035;
borderColorTransform = new ColorTransform(0, 0, 0, 0, 71, 171, 203, (0xFF * borderAlpha));
_seekBarScrubTolerance = SEEK_BAR_SCRUB_TOLERANCE_DEFAULT;
_volumeBarScrubTolerance = VOLUME_BAR_SCRUB_TOLERANCE_DEFAULT;
_bufferingOn = false;
mouseCaptureCtrl = -1;
_seekBarTimer = new Timer(SEEK_BAR_INTERVAL_DEFAULT);
_seekBarTimer.addEventListener(TimerEvent.TIMER, seekBarListener);
_volumeBarTimer = new Timer(VOLUME_BAR_INTERVAL_DEFAULT);
_volumeBarTimer.addEventListener(TimerEvent.TIMER, volumeBarListener);
_bufferingDelayTimer = new Timer(BUFFERING_DELAY_INTERVAL_DEFAULT, 1);
_bufferingDelayTimer.addEventListener(TimerEvent.TIMER, doBufferingDelay);
_skinAutoHideTimer = new Timer(SKIN_AUTO_HIDE_INTERVAL);
_skinAutoHideTimer.addEventListener(TimerEvent.TIMER, skinAutoHideHitTest);
_skinFadingTimer = new Timer(SKIN_FADING_INTERVAL);
_skinFadingTimer.addEventListener(TimerEvent.TIMER, skinFadeMore);
_vc.addEventListener(MetadataEvent.METADATA_RECEIVED, handleIVPEvent);
_vc.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
_vc.addEventListener(VideoProgressEvent.PROGRESS, handleIVPEvent);
_vc.addEventListener(VideoEvent.STATE_CHANGE, handleIVPEvent);
_vc.addEventListener(VideoEvent.READY, handleIVPEvent);
_vc.addEventListener(LayoutEvent.LAYOUT, handleLayoutEvent);
_vc.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleLayoutEvent);
_vc.addEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.addEventListener(Event.REMOVED_FROM_STAGE, handleEvent);
fullScreenSourceRectMinWidth = FULL_SCREEN_SOURCE_RECT_MIN_WIDTH;
fullScreenSourceRectMinHeight = FULL_SCREEN_SOURCE_RECT_MIN_HEIGHT;
fullScreenSourceRectMinAspectRatio = (FULL_SCREEN_SOURCE_RECT_MIN_WIDTH / FULL_SCREEN_SOURCE_RECT_MIN_HEIGHT);
_fullScreen = false;
_fullScreenTakeOver = true;
_fullScreenBgColor = 0;
_fullScreenAccel = false;
if (_vc.stage != null){
try {
_fullScreen = (_vc.stage.displayState == StageDisplayState.FULL_SCREEN);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
} catch(se:SecurityError) {
};
};
if (layoutNameToIndexMappings == null){
initLayoutNameToIndexMappings();
};
}
public function get seekBarScrubTolerance():Number{
return (_seekBarScrubTolerance);
}
flvplayback_internal function removeButtonListeners(_arg1:Sprite):void{
if (_arg1 == null){
return;
};
_arg1.removeEventListener(MouseEvent.ROLL_OVER, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.ROLL_OUT, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, handleButtonEvent);
_arg1.removeEventListener(MouseEvent.CLICK, handleButtonEvent);
_arg1.removeEventListener(Event.ENTER_FRAME, skinButtonControl);
}
public function set skinFadeTime(_arg1:int):void{
_skinFadingMaxTime = _arg1;
}
public function get skinFadeTime():int{
return (_skinFadingMaxTime);
}
flvplayback_internal function finishLoad(_arg1:Event):void{
var i:int;
var cachedActivePlayerIndex:int;
var state:String;
var j:int;
var e = _arg1;
try {
skinLoadDelayCount++;
if (skinLoadDelayCount < 2){
return;
} else {
_vc.removeEventListener(Event.ENTER_FRAME, finishLoad);
};
i = 0;
while (i < NUM_CONTROLS) {
if (delayedControls[i] != undefined){
setControl(i, delayedControls[i]);
};
i = (i + 1);
};
if (_fullScreenTakeOver){
enterFullScreenTakeOver();
} else {
exitFullScreenTakeOver();
};
layoutSkin();
setupSkinAutoHide(false);
skin_mc.visible = __visible;
_vc.addChild(skin_mc);
_skinReady = true;
_vc.skinLoaded();
cachedActivePlayerIndex = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
state = _vc.state;
j = 0;
while (j < NUM_CONTROLS) {
if (controls[j] == undefined){
} else {
setEnabledAndVisibleForState(j, state);
if (j < NUM_BUTTONS){
skinButtonControl(controls[j]);
};
};
j = (j + 1);
};
_vc.activeVideoPlayerIndex = cachedActivePlayerIndex;
} catch(err:Error) {
_vc.skinError(err.message);
removeSkin();
};
}
flvplayback_internal function downloadSkin():void{
if (skinLoader == null){
skinLoader = new Loader();
skinLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoad);
skinLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleLoadErrorEvent);
skinLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleLoadErrorEvent);
};
skinLoader.load(new URLRequest(_skin));
}
flvplayback_internal function removeSkin():void{
var i:int;
if (skinLoader != null){
try {
skinLoader.close();
} catch(e1:Error) {
};
skinLoader = null;
};
if (skin_mc != null){
i = 0;
while (i < NUM_CONTROLS) {
if (controls[i] == undefined){
} else {
if (i < NUM_BUTTONS){
removeButtonListeners(controls[i]);
};
delete ctrlDataDict[controls[i]];
delete controls[i];
};
i = (i + 1);
};
try {
skin_mc.parent.removeChild(skin_mc);
} catch(e2:Error) {
};
skin_mc = null;
};
skinTemplate = null;
layout_mc = null;
border_mc = null;
borderCopy = null;
borderPrevRect = null;
borderScale9Rects = null;
}
flvplayback_internal function positionBar(_arg1:Sprite, _arg2:String, _arg3:Number):void{
var ctrlData:ControlData;
var bar:DisplayObject;
var barData:ControlData;
var ctrl = _arg1;
var type = _arg2;
var percent = _arg3;
try {
if ((((ctrl["positionBar"] is Function)) && (ctrl["positionBar"](type, percent)))){
return;
};
} catch(re2:ReferenceError) {
};
ctrlData = ctrlDataDict[ctrl];
bar = ctrlData[(type + "_mc")];
if (bar == null){
return;
};
barData = ctrlDataDict[bar];
if (bar.parent == ctrl){
if (barData.fill_mc == null){
bar.scaleX = ((barData.origScaleX * percent) / 100);
} else {
positionMaskedFill(bar, percent);
};
} else {
bar.x = (ctrl.x + barData.leftMargin);
bar.y = (ctrl.y + barData.origY);
if (barData.fill_mc == null){
bar.width = ((((ctrl.width - barData.leftMargin) - barData.rightMargin) * percent) / 100);
} else {
positionMaskedFill(bar, percent);
};
};
}
flvplayback_internal function setupButtonSkin(_arg1:int):Sprite{
var _local2:String;
var _local3:Sprite;
var _local4:ControlData;
_local2 = skinClassPrefixes[_arg1];
if (_local2 == null){
return (null);
};
_local3 = new Sprite();
_local4 = new ControlData(this, _local3, null, _arg1);
ctrlDataDict[_local3] = _local4;
_local4.state_mc = new Array();
_local4.state_mc[NORMAL_STATE] = setupButtonSkinState(_local3, skinTemplate, (_local2 + "NormalState"));
_local4.state_mc[NORMAL_STATE].visible = true;
_local4.state_mc[OVER_STATE] = setupButtonSkinState(_local3, skinTemplate, (_local2 + "OverState"), _local4.state_mc[NORMAL_STATE]);
_local4.state_mc[DOWN_STATE] = setupButtonSkinState(_local3, skinTemplate, (_local2 + "DownState"), _local4.state_mc[NORMAL_STATE]);
_local4.disabled_mc = setupButtonSkinState(_local3, skinTemplate, (_local2 + "DisabledState"), _local4.state_mc[NORMAL_STATE]);
return (_local3);
}
public function get skinReady():Boolean{
return (_skinReady);
}
public function get skinAutoHide():Boolean{
return (_skinAutoHide);
}
flvplayback_internal function dispatchMessage(_arg1:int):void{
var cachedActivePlayerIndex:int;
var ctrl:Sprite;
var ctrlData:ControlData;
var handle:Sprite;
var index = _arg1;
if ((((index == SEEK_BAR_HANDLE)) || ((index == SEEK_BAR_HIT)))){
_vc._scrubStart();
};
cachedActivePlayerIndex = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
switch (index){
case PAUSE_BUTTON:
_vc.pause();
break;
case PLAY_BUTTON:
_vc.play();
break;
case STOP_BUTTON:
_vc.stop();
break;
case SEEK_BAR_HIT:
case SEEK_BAR_HANDLE:
ctrl = controls[SEEK_BAR];
ctrlData = ctrlDataDict[ctrl];
calcPercentageFromHandle(ctrl);
_lastScrubPos = ctrlData.percentage;
if (index == SEEK_BAR_HIT){
handle = controls[SEEK_BAR_HANDLE];
handle.x = handle.parent.mouseX;
handle.y = handle.parent.mouseY;
};
_vc.removeEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
if (((_vc.playing) || (_vc.buffering))){
_playAfterScrub = true;
} else {
if (_vc.state != VideoState.SEEKING){
_playAfterScrub = false;
};
};
_seekBarTimer.start();
startHandleDrag(ctrl);
_vc.pause();
break;
case VOLUME_BAR_HIT:
case VOLUME_BAR_HANDLE:
ctrl = controls[VOLUME_BAR];
ctrlData = ctrlDataDict[ctrl];
calcPercentageFromHandle(ctrl);
_lastVolumePos = ctrlData.percentage;
if (index == VOLUME_BAR_HIT){
handle = controls[VOLUME_BAR_HANDLE];
handle.x = handle.parent.mouseX;
handle.y = handle.parent.mouseY;
};
_vc.removeEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
_volumeBarTimer.start();
startHandleDrag(ctrl);
break;
case BACK_BUTTON:
_vc.seekToPrevNavCuePoint();
break;
case FORWARD_BUTTON:
_vc.seekToNextNavCuePoint();
break;
case MUTE_ON_BUTTON:
if (!_isMuted){
_isMuted = true;
cachedSoundLevel = _vc.volume;
_vc.volume = 0;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
break;
case MUTE_OFF_BUTTON:
if (_isMuted){
_isMuted = false;
_vc.volume = cachedSoundLevel;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
break;
case FULL_SCREEN_ON_BUTTON:
if (((!(_fullScreen)) && (!((_vc.stage == null))))){
enterFullScreenDisplayState();
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
};
break;
case FULL_SCREEN_OFF_BUTTON:
if (((_fullScreen) && (!((_vc.stage == null))))){
try {
_vc.stage.displayState = StageDisplayState.NORMAL;
} catch(se:SecurityError) {
};
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
};
break;
default:
throw (new Error("Unknown ButtonControl"));
};
_vc.activeVideoPlayerIndex = cachedActivePlayerIndex;
}
flvplayback_internal function handleFullScreenEvent(_arg1:FullScreenEvent):void{
_fullScreen = _arg1.fullScreen;
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
if (((_fullScreen) && (_fullScreenTakeOver))){
enterFullScreenTakeOver();
} else {
if (!_fullScreen){
exitFullScreenTakeOver();
};
};
}
flvplayback_internal function handleLayoutEvent(_arg1:LayoutEvent):void{
var _local2:int;
if (((((((_fullScreen) && (_fullScreenTakeOver))) && (_fullScreenAccel))) && (!((_vc.stage == null))))){
if (((((((((!((_vc.registrationX == 0))) || (!((_vc.registrationY == 0))))) || (!((_vc.parent == _vc.stage))))) || (!((_vc.registrationWidth == _vc.stage.stageWidth))))) || (!((_vc.registrationHeight == _vc.stage.stageHeight))))){
_vc.stage.displayState = StageDisplayState.NORMAL;
return;
};
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
if (_vc.align != VideoAlign.CENTER){
cacheFLVPlaybackAlign[_vc.visibleVideoPlayerIndex] = _vc.align;
_vc.align = VideoAlign.CENTER;
};
if (_vc.scaleMode != VideoScaleMode.MAINTAIN_ASPECT_RATIO){
cacheFLVPlaybackScaleMode[_vc.visibleVideoPlayerIndex] = _vc.scaleMode;
_vc.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
_vc.activeVideoPlayerIndex = _local2;
return;
};
_vc.activeVideoPlayerIndex = _local2;
};
layoutSkin();
setupSkinAutoHide(false);
}
flvplayback_internal function seekBarListener(_arg1:TimerEvent):void{
var _local2:int;
var _local3:Sprite;
var _local4:ControlData;
var _local5:Number;
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
_local3 = controls[SEEK_BAR];
if (_local3 == null){
return;
};
_local4 = ctrlDataDict[_local3];
calcPercentageFromHandle(_local3);
_local5 = _local4.percentage;
if (_arg1 == null){
_seekBarTimer.stop();
if (_local5 != _lastScrubPos){
_vc.seekPercent(_local5);
};
_vc.addEventListener(VideoEvent.PLAYHEAD_UPDATE, handleIVPEvent);
if (_playAfterScrub){
_vc.play();
};
} else {
if (_vc.getVideoPlayer(_vc.visibleVideoPlayerIndex).state == VideoState.SEEKING){
} else {
if ((((((((_seekBarScrubTolerance <= 0)) || ((Math.abs((_local5 - _lastScrubPos)) > _seekBarScrubTolerance)))) || ((_local5 < _seekBarScrubTolerance)))) || ((_local5 > (100 - _seekBarScrubTolerance))))){
if (_local5 != _lastScrubPos){
_lastScrubPos = _local5;
_vc.seekPercent(_local5);
};
};
};
};
_vc.activeVideoPlayerIndex = _local2;
}
public function get seekBarInterval():Number{
return (_seekBarTimer.delay);
}
public function set skinAutoHide(_arg1:Boolean):void{
if (_arg1 == _skinAutoHide){
return;
};
_skinAutoHide = _arg1;
cacheSkinAutoHide = _arg1;
setupSkinAutoHide(true);
}
flvplayback_internal function setCustomClip(_arg1:DisplayObject):void{
var dCopy:DisplayObject;
var ctrlData:ControlData;
var scale9Grid:Rectangle;
var diff:Number;
var numBorderBitmaps:int;
var i:int;
var lastXDim:Number;
var floorLastXDim:Number;
var lastYDim:Number;
var floorLastYDim:Number;
var newRect:Rectangle;
var dispObj = _arg1;
dCopy = new (dispObj["constructor"]);
skin_mc.addChild(dCopy);
ctrlData = new ControlData(this, dCopy, null, -1);
ctrlDataDict[dCopy] = ctrlData;
ctrlData.avatar = dispObj;
customClips.push(dCopy);
if (dispObj.name == "border_mc"){
border_mc = dCopy;
try {
borderCopy = (ctrlData.avatar["colorMe"]) ? new Sprite() : null;
} catch(re:ReferenceError) {
borderCopy = null;
};
if (borderCopy != null){
border_mc.visible = false;
scale9Grid = border_mc.scale9Grid;
scale9Grid.x = Math.round(scale9Grid.x);
scale9Grid.y = Math.round(scale9Grid.y);
scale9Grid.width = Math.round(scale9Grid.width);
diff = ((scale9Grid.x + scale9Grid.width) - border_mc.scale9Grid.right);
if (diff > 0.5){
scale9Grid.width--;
} else {
if (diff < -0.5){
scale9Grid.width++;
};
};
scale9Grid.height = Math.round(scale9Grid.height);
diff = ((scale9Grid.y + scale9Grid.height) - border_mc.scale9Grid.bottom);
if (diff > 0.5){
scale9Grid.height--;
} else {
if (diff < -0.5){
scale9Grid.height++;
};
};
if (scale9Grid != null){
borderScale9Rects = new Array();
lastXDim = (border_mc.width - (scale9Grid.x + scale9Grid.width));
floorLastXDim = Math.floor(lastXDim);
if ((lastXDim - floorLastXDim) < 0.05){
lastXDim = floorLastXDim;
} else {
lastXDim = (floorLastXDim + 1);
};
lastYDim = (border_mc.height - (scale9Grid.y + scale9Grid.height));
floorLastYDim = Math.floor(lastYDim);
if ((lastYDim - floorLastYDim) < 0.05){
lastYDim = floorLastYDim;
} else {
lastYDim = (floorLastYDim + 1);
};
newRect = new Rectangle(0, 0, scale9Grid.x, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, 0, scale9Grid.width, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), 0, lastXDim, scale9Grid.y);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(0, scale9Grid.y, scale9Grid.x, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, scale9Grid.y, scale9Grid.width, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), scale9Grid.y, lastXDim, scale9Grid.height);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(0, (scale9Grid.y + scale9Grid.height), scale9Grid.x, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle(scale9Grid.x, (scale9Grid.y + scale9Grid.height), scale9Grid.width, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
newRect = new Rectangle((scale9Grid.x + scale9Grid.width), (scale9Grid.y + scale9Grid.height), lastXDim, lastYDim);
borderScale9Rects.push(((((newRect.width < 1)) || ((newRect.height < 1)))) ? null : newRect);
i = 0;
while (i < borderScale9Rects.length) {
if (borderScale9Rects[i] != null){
break;
};
i = (i + 1);
};
if (i >= borderScale9Rects.length){
borderScale9Rects = null;
};
};
numBorderBitmaps = ((borderScale9Rects)==null) ? 1 : 9;
i = 0;
while (i < numBorderBitmaps) {
if ((((borderScale9Rects == null)) || (!((borderScale9Rects[i] == null))))){
borderCopy.addChild(new Bitmap());
};
i = (i + 1);
};
skin_mc.addChild(borderCopy);
borderPrevRect = null;
};
};
}
public function get fullScreenSkinDelay():int{
return (_skinAutoHideMotionTimeout);
}
flvplayback_internal function doBufferingDelay(_arg1:TimerEvent):void{
var _local2:int;
_bufferingDelayTimer.reset();
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
if (_vc.state == VideoState.BUFFERING){
_bufferingOn = true;
handleIVPEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, VideoState.BUFFERING, NaN, _vc.visibleVideoPlayerIndex));
};
_vc.activeVideoPlayerIndex = _local2;
}
flvplayback_internal function volumeBarListener(_arg1:TimerEvent):void{
var _local2:Sprite;
var _local3:ControlData;
var _local4:Number;
var _local5:Boolean;
_local2 = controls[VOLUME_BAR];
if (_local2 == null){
return;
};
_local3 = ctrlDataDict[_local2];
calcPercentageFromHandle(_local2);
_local4 = _local3.percentage;
_local5 = (_arg1 == null);
if (_local5){
_volumeBarTimer.stop();
_vc.addEventListener(SoundEvent.SOUND_UPDATE, handleSoundEvent);
};
if (((((((((_local5) || ((_volumeBarScrubTolerance <= 0)))) || ((Math.abs((_local4 - _lastVolumePos)) > _volumeBarScrubTolerance)))) || ((_local4 < _volumeBarScrubTolerance)))) || ((_local4 > (100 - _volumeBarScrubTolerance))))){
if (_local4 != _lastVolumePos){
if (_isMuted){
cachedSoundLevel = (_local4 / 100);
} else {
_vc.volume = (_local4 / 100);
};
_lastVolumePos = _local4;
};
};
}
public function get visible():Boolean{
return (__visible);
}
flvplayback_internal function fixUpBar(_arg1:DisplayObject, _arg2:String, _arg3:DisplayObject, _arg4:String):void{
var ctrlData:ControlData;
var bar:DisplayObject;
var barData:ControlData;
var definitionHolder = _arg1;
var propPrefix = _arg2;
var ctrl = _arg3;
var name = _arg4;
ctrlData = ctrlDataDict[ctrl];
if (ctrlData[name] != null){
return;
};
try {
bar = ctrl[name];
} catch(re:ReferenceError) {
bar = null;
};
if (bar == null){
try {
bar = createSkin(definitionHolder, (propPrefix + "LinkageID"));
} catch(ve:VideoError) {
bar = null;
};
if (bar == null){
return;
};
if (ctrl.parent != null){
if (getBooleanPropSafe(ctrl, (propPrefix + "Below"))){
ctrl.parent.addChildAt(bar, ctrl.parent.getChildIndex(ctrl));
} else {
ctrl.parent.addChild(bar);
};
};
};
ctrlData[name] = bar;
barData = ctrlDataDict[bar];
if (barData == null){
barData = new ControlData(this, bar, ctrl, -1);
ctrlDataDict[bar] = barData;
};
}
public function get volumeBarInterval():Number{
return (_volumeBarTimer.delay);
}
public function get bufferingBarHidesAndDisablesOthers():Boolean{
return (_bufferingBarHides);
}
flvplayback_internal function calcLayoutControl(_arg1:DisplayObject):Rectangle{
var rect:Rectangle;
var ctrlData:ControlData;
var anchorRight:Boolean;
var anchorLeft:Boolean;
var anchorTop:Boolean;
var anchorBottom:Boolean;
var ctrl = _arg1;
rect = new Rectangle();
if (ctrl == null){
return (rect);
};
ctrlData = ctrlDataDict[ctrl];
if (ctrlData == null){
return (rect);
};
if (ctrlData.avatar == null){
return (rect);
};
anchorRight = false;
anchorLeft = true;
anchorTop = false;
anchorBottom = true;
try {
anchorRight = ctrlData.avatar["anchorRight"];
} catch(re1:ReferenceError) {
anchorRight = false;
};
try {
anchorLeft = ctrlData.avatar["anchorLeft"];
} catch(re1:ReferenceError) {
anchorLeft = true;
};
try {
anchorTop = ctrlData.avatar["anchorTop"];
} catch(re1:ReferenceError) {
anchorTop = false;
};
try {
anchorBottom = ctrlData.avatar["anchorBottom"];
} catch(re1:ReferenceError) {
anchorBottom = true;
};
if (anchorRight){
if (anchorLeft){
rect.x = ((ctrlData.avatar.x - placeholderLeft) + videoLeft);
rect.width = ((((ctrlData.avatar.x + ctrlData.avatar.width) - placeholderRight) + videoRight) - rect.x);
ctrlData.origWidth = NaN;
} else {
rect.x = ((ctrlData.avatar.x - placeholderRight) + videoRight);
rect.width = ctrl.width;
};
} else {
rect.x = ((ctrlData.avatar.x - placeholderLeft) + videoLeft);
rect.width = ctrl.width;
};
if (anchorTop){
if (anchorBottom){
rect.y = ((ctrlData.avatar.y - placeholderTop) + videoTop);
rect.height = ((((ctrlData.avatar.y + ctrlData.avatar.height) - placeholderBottom) + videoBottom) - rect.y);
ctrlData.origHeight = NaN;
} else {
rect.y = ((ctrlData.avatar.y - placeholderTop) + videoTop);
rect.height = ctrl.height;
};
} else {
rect.y = ((ctrlData.avatar.y - placeholderBottom) + videoBottom);
rect.height = ctrl.height;
};
try {
if ((ctrl["layoutSelf"] is Function)){
rect = ctrl["layoutSelf"](rect);
};
} catch(re3:ReferenceError) {
};
return (rect);
}
flvplayback_internal function skinFadeMore(_arg1:TimerEvent):void{
var _local2:Number;
if (((((!(_skinFadingIn)) && ((skin_mc.alpha <= 0.5)))) || (((_skinFadingIn) && ((skin_mc.alpha >= 0.95)))))){
skin_mc.visible = _skinFadingIn;
skin_mc.alpha = 1;
_skinFadingTimer.stop();
} else {
_local2 = ((getTimer() - _skinFadeStartTime) / _skinFadingMaxTime);
if (!_skinFadingIn){
_local2 = (1 - _local2);
};
if (_local2 < 0){
_local2 = 0;
} else {
if (_local2 > 1){
_local2 = 1;
};
};
skin_mc.alpha = _local2;
};
}
flvplayback_internal function bitmapCopyBorder():void{
var _local1:Rectangle;
var _local2:BitmapData;
var _local3:Matrix;
var _local4:Number;
var _local5:Number;
var _local6:Rectangle;
var _local7:int;
var _local8:Number;
var _local9:Number;
var _local10:int;
var _local11:Bitmap;
var _local12:Number;
var _local13:Number;
if ((((border_mc == null)) || ((borderCopy == null)))){
return;
};
_local1 = border_mc.getBounds(skin_mc);
if ((((borderPrevRect == null)) || (!(borderPrevRect.equals(_local1))))){
borderCopy.x = _local1.x;
borderCopy.y = _local1.y;
_local3 = new Matrix(border_mc.scaleX, 0, 0, border_mc.scaleY, 0, 0);
if (borderScale9Rects == null){
_local2 = new BitmapData(_local1.width, _local1.height, true, 0);
_local2.draw(border_mc, _local3, borderColorTransform);
Bitmap(borderCopy.getChildAt(0)).bitmapData = _local2;
} else {
_local4 = 0;
_local5 = 0;
_local6 = new Rectangle(0, 0, 0, 0);
_local7 = 0;
_local8 = 0;
if (borderScale9Rects[3] != null){
_local8 = (_local8 + borderScale9Rects[3].width);
};
if (borderScale9Rects[5] != null){
_local8 = (_local8 + borderScale9Rects[5].width);
};
_local9 = 0;
if (borderScale9Rects[1] != null){
_local9 = (_local9 + borderScale9Rects[1].height);
};
if (borderScale9Rects[7] != null){
_local9 = (_local9 + borderScale9Rects[7].height);
};
_local10 = 0;
while (_local10 < borderScale9Rects.length) {
if ((_local10 % 3) == 0){
_local4 = 0;
_local5 = (_local5 + _local6.height);
};
if (borderScale9Rects[_local10] == null){
} else {
_local6 = Rectangle(borderScale9Rects[_local10]).clone();
_local3.a = 1;
if ((((((_local10 == 1)) || ((_local10 == 4)))) || ((_local10 == 7)))){
_local12 = ((_local1.width - _local8) / _local6.width);
_local6.x = (_local6.x * _local12);
_local6.width = (_local6.width * _local12);
_local6.width = Math.round(_local6.width);
_local3.a = (_local3.a * _local12);
};
_local3.tx = -(_local6.x);
_local6.x = 0;
_local3.d = 1;
if ((((_local10 >= 3)) && ((_local10 <= 5)))){
_local13 = ((_local1.height - _local9) / _local6.height);
_local6.y = (_local6.y * _local13);
_local6.height = (_local6.height * _local13);
_local6.height = Math.round(_local6.height);
_local3.d = (_local3.d * _local13);
};
_local3.ty = -(_local6.y);
_local6.y = 0;
_local2 = new BitmapData(_local6.width, _local6.height, true, 0);
_local2.draw(border_mc, _local3, borderColorTransform, null, _local6, false);
_local11 = Bitmap(borderCopy.getChildAt(_local7));
_local7++;
_local11.bitmapData = _local2;
_local11.x = _local4;
_local11.y = _local5;
_local4 = (_local4 + _local6.width);
};
_local10++;
};
};
borderPrevRect = _local1;
};
}
flvplayback_internal function resetPlayPause():void{
var _local1:int;
if (controls[PLAY_PAUSE_BUTTON] == undefined){
return;
};
_local1 = PAUSE_BUTTON;
while (_local1 <= PLAY_BUTTON) {
removeButtonListeners(controls[_local1]);
delete ctrlDataDict[controls[_local1]];
delete controls[_local1];
_local1++;
};
delete ctrlDataDict[controls[PLAY_PAUSE_BUTTON]];
delete controls[PLAY_PAUSE_BUTTON];
}
public function setControl(_arg1:int, _arg2:Sprite):void{
var ctrlData:ControlData;
var index = _arg1;
var ctrl = _arg2;
if (ctrl == controls[index]){
return;
};
switch (index){
case PAUSE_BUTTON:
case PLAY_BUTTON:
resetPlayPause();
break;
case PLAY_PAUSE_BUTTON:
if ((((ctrl == null)) || (!((ctrl.parent == skin_mc))))){
resetPlayPause();
};
if (ctrl != null){
setControl(PAUSE_BUTTON, Sprite(ctrl.getChildByName("pause_mc")));
setControl(PLAY_BUTTON, Sprite(ctrl.getChildByName("play_mc")));
};
break;
case FULL_SCREEN_BUTTON:
if (ctrl != null){
setControl(FULL_SCREEN_ON_BUTTON, Sprite(ctrl.getChildByName("on_mc")));
setControl(FULL_SCREEN_OFF_BUTTON, Sprite(ctrl.getChildByName("off_mc")));
};
break;
case MUTE_BUTTON:
if (ctrl != null){
setControl(MUTE_ON_BUTTON, Sprite(ctrl.getChildByName("on_mc")));
setControl(MUTE_OFF_BUTTON, Sprite(ctrl.getChildByName("off_mc")));
};
break;
};
if (controls[index] != null){
try {
delete controls[index]["uiMgr"];
} catch(re:ReferenceError) {
};
if (index < NUM_BUTTONS){
removeButtonListeners(controls[index]);
};
delete ctrlDataDict[controls[index]];
delete controls[index];
};
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
if (ctrlData == null){
ctrlData = new ControlData(this, ctrl, null, index);
ctrlDataDict[ctrl] = ctrlData;
} else {
ctrlData.index = index;
};
if (index >= NUM_BUTTONS){
controls[index] = ctrl;
switch (index){
case SEEK_BAR:
addBarControl(ctrl);
break;
case VOLUME_BAR:
addBarControl(ctrl);
ctrlData.percentage = (_vc.volume * 100);
break;
case BUFFERING_BAR:
if (ctrl.parent == skin_mc){
finishAddBufferingBar();
} else {
ctrl.addEventListener(Event.ENTER_FRAME, finishAddBufferingBar);
};
break;
};
setEnabledAndVisibleForState(index, _vc.state);
} else {
controls[index] = ctrl;
addButtonControl(ctrl);
};
}
flvplayback_internal function createSkin(_arg1:DisplayObject, _arg2:String):DisplayObject{
var stateSkinDesc:*;
var theClass:Class;
var definitionHolder = _arg1;
var skinName = _arg2;
try {
stateSkinDesc = definitionHolder[skinName];
if ((stateSkinDesc is String)){
try {
theClass = Class(definitionHolder.loaderInfo.applicationDomain.getDefinition(stateSkinDesc));
} catch(err1:Error) {
theClass = Class(getDefinitionByName(stateSkinDesc));
};
return (DisplayObject(new (theClass)));
} else {
if ((stateSkinDesc is Class)){
return (new (stateSkinDesc));
} else {
if ((stateSkinDesc is DisplayObject)){
return (stateSkinDesc);
};
};
};
} catch(err2:Error) {
throw (new VideoError(VideoError.MISSING_SKIN_STYLE, skinName));
};
return (null);
}
flvplayback_internal function addButtonControl(_arg1:Sprite):void{
var _local2:ControlData;
var _local3:int;
if (_arg1 == null){
return;
};
_local2 = ctrlDataDict[_arg1];
_arg1.mouseChildren = false;
_local3 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
_local2.state = NORMAL_STATE;
setEnabledAndVisibleForState(_local2.index, _vc.state);
_arg1.addEventListener(MouseEvent.ROLL_OVER, handleButtonEvent);
_arg1.addEventListener(MouseEvent.ROLL_OUT, handleButtonEvent);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, handleButtonEvent);
_arg1.addEventListener(MouseEvent.CLICK, handleButtonEvent);
if (_arg1.parent == skin_mc){
skinButtonControl(_arg1);
} else {
_arg1.addEventListener(Event.ENTER_FRAME, skinButtonControl);
};
_vc.activeVideoPlayerIndex = _local3;
}
flvplayback_internal function hookUpCustomComponents():void{
var searchHash:Object;
var doTheSearch:Boolean;
var i:int;
var dispObj:DisplayObject;
var name:String;
var index:int;
var ctrl:Sprite;
searchHash = new Object();
doTheSearch = false;
i = 0;
while (i < NUM_CONTROLS) {
if (controls[i] == null){
searchHash[customComponentClassNames[i]] = i;
doTheSearch = true;
};
i = (i + 1);
};
if (!doTheSearch){
return;
};
i = 0;
while (i < _vc.parent.numChildren) {
dispObj = _vc.parent.getChildAt(i);
name = getQualifiedClassName(dispObj);
if (searchHash[name] != undefined){
if (typeof(searchHash[name]) == "number"){
index = int(searchHash[name]);
try {
ctrl = Sprite(dispObj);
if ((((((index >= NUM_BUTTONS)) || ((ctrl["placeholder_mc"] is DisplayObject)))) && ((ctrl["uiMgr"] == null)))){
setControl(index, ctrl);
searchHash[name] = ctrl;
};
} catch(err:Error) {
};
};
};
i = (i + 1);
};
}
flvplayback_internal function positionHandle(_arg1:Sprite):void{
var _local2:ControlData;
var _local3:Sprite;
var _local4:ControlData;
var _local5:Number;
var _local6:Number;
if (_arg1 == null){
return;
};
if ((((_arg1["positionHandle"] is Function)) && (_arg1["positionHandle"]()))){
return;
};
_local2 = ctrlDataDict[_arg1];
_local3 = _local2.handle_mc;
if (_local3 == null){
return;
};
_local4 = ctrlDataDict[_local3];
_local5 = (isNaN(_local2.origWidth)) ? _arg1.width : _local2.origWidth;
_local6 = ((_local5 - _local4.rightMargin) - _local4.leftMargin);
_local3.x = ((_arg1.x + _local4.leftMargin) + ((_local6 * _local2.percentage) / 100));
_local3.y = (_arg1.y + _local4.origY);
if (_local2.fullness_mc != null){
positionBar(_arg1, "fullness", _local2.percentage);
};
}
flvplayback_internal function exitFullScreenTakeOver():void{
var fullScreenBG:Sprite;
var cacheActiveIndex:int;
var i:int;
var vp:VideoPlayer;
if (cacheFLVPlaybackParent == null){
return;
};
_vc.removeEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.stage.removeEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
try {
if (_fullScreenAccel){
_vc.stage.fullScreenSourceRect = new Rectangle(0, 0, -1, -1);
} else {
_vc.stage.align = cacheStageAlign;
_vc.stage.scaleMode = cacheStageScaleMode;
};
fullScreenBG = Sprite(_vc.getChildByName("fullScreenBG"));
if (fullScreenBG != null){
_vc.removeChild(fullScreenBG);
};
if (_vc.parent != cacheFLVPlaybackParent){
cacheFLVPlaybackParent.addChildAt(_vc, cacheFLVPlaybackIndex);
} else {
cacheFLVPlaybackParent.setChildIndex(_vc, cacheFLVPlaybackIndex);
};
cacheActiveIndex = _vc.activeVideoPlayerIndex;
i = 0;
while (i < _vc.videoPlayers.length) {
vp = (_vc.videoPlayers[i] as VideoPlayer);
if (vp != null){
_vc.activeVideoPlayerIndex = i;
if (cacheFLVPlaybackScaleMode[i] != undefined){
_vc.scaleMode = cacheFLVPlaybackScaleMode[i];
};
if (cacheFLVPlaybackAlign[i]){
_vc.align = cacheFLVPlaybackAlign[i];
};
};
i = (i + 1);
};
_vc.activeVideoPlayerIndex = cacheActiveIndex;
_vc.registrationX = cacheFLVPlaybackLocation.x;
_vc.registrationY = cacheFLVPlaybackLocation.y;
_vc.setSize(cacheFLVPlaybackLocation.width, cacheFLVPlaybackLocation.height);
} catch(err:Error) {
};
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
_fullScreen = false;
_fullScreenAccel = false;
cacheStageAlign = null;
cacheStageScaleMode = null;
cacheFLVPlaybackParent = null;
cacheFLVPlaybackIndex = 0;
cacheFLVPlaybackLocation = null;
cacheFLVPlaybackScaleMode = null;
cacheFLVPlaybackAlign = null;
if (_skinAutoHide != cacheSkinAutoHide){
_skinAutoHide = cacheSkinAutoHide;
setupSkinAutoHide(false);
};
}
flvplayback_internal function positionMaskedFill(_arg1:DisplayObject, _arg2:Number):void{
var ctrlData:ControlData;
var fill:DisplayObject;
var mask:DisplayObject;
var fillData:ControlData;
var maskData:ControlData;
var slideReveal:Boolean;
var maskSprite:Sprite;
var barData:ControlData;
var ctrl = _arg1;
var percent = _arg2;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
fill = ctrlData.fill_mc;
if (fill == null){
return;
};
mask = ctrlData.mask_mc;
if (ctrlData.mask_mc == null){
try {
var _local4 = ctrl["mask_mc"];
mask = _local4;
ctrlData.mask_mc = _local4;
} catch(re:ReferenceError) {
ctrlData.mask_mc = null;
};
if (ctrlData.mask_mc == null){
maskSprite = new Sprite();
_local4 = maskSprite;
mask = _local4;
ctrlData.mask_mc = _local4;
maskSprite.graphics.beginFill(0xFFFFFF);
maskSprite.graphics.drawRect(0, 0, 1, 1);
maskSprite.graphics.endFill();
barData = ctrlDataDict[fill];
maskSprite.x = barData.origX;
maskSprite.y = barData.origY;
maskSprite.width = barData.origWidth;
maskSprite.height = barData.origHeight;
maskSprite.visible = false;
fill.parent.addChild(maskSprite);
fill.mask = maskSprite;
};
if (ctrlData.mask_mc != null){
calcBarMargins(ctrl, "mask", true);
};
};
fillData = ctrlDataDict[fill];
maskData = ctrlDataDict[mask];
try {
slideReveal = fill["slideReveal"];
} catch(re:ReferenceError) {
slideReveal = false;
};
if (fill.parent == ctrl){
if (slideReveal){
fill.x = ((maskData.origX - fillData.origWidth) + ((fillData.origWidth * percent) / 100));
} else {
mask.width = ((fillData.origWidth * percent) / 100);
};
} else {
if (fill.parent == ctrl.parent){
if (slideReveal){
mask.x = (ctrl.x + maskData.leftMargin);
mask.y = (ctrl.y + maskData.topMargin);
mask.width = ((ctrl.width - maskData.rightMargin) - maskData.leftMargin);
mask.height = ((ctrl.height - maskData.topMargin) - maskData.bottomMargin);
fill.x = ((mask.x - fillData.origWidth) + ((maskData.origWidth * percent) / 100));
fill.y = (ctrl.y + fillData.topMargin);
} else {
fill.x = (ctrl.x + fillData.leftMargin);
fill.y = (ctrl.y + fillData.topMargin);
mask.x = fill.x;
mask.y = fill.y;
mask.width = ((((ctrl.width - fillData.rightMargin) - fillData.leftMargin) * percent) / 100);
mask.height = ((ctrl.height - fillData.topMargin) - fillData.bottomMargin);
};
};
};
}
flvplayback_internal function calcPercentageFromHandle(_arg1:Sprite):void{
var _local2:ControlData;
var _local3:Sprite;
var _local4:ControlData;
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg1 == null){
return;
};
_local2 = ctrlDataDict[_arg1];
if ((((_arg1["calcPercentageFromHandle"] is Function)) && (_arg1["calcPercentageFromHandle"]()))){
if (_local2.percentage < 0){
_local2.percentage = 0;
};
if (_local2.percentage > 100){
_local2.percentage = 100;
};
return;
};
_local3 = _local2.handle_mc;
if (_local3 == null){
return;
};
_local4 = ctrlDataDict[_local3];
_local5 = (isNaN(_local2.origWidth)) ? _arg1.width : _local2.origWidth;
_local6 = ((_local5 - _local4.rightMargin) - _local4.leftMargin);
_local7 = (_local3.x - (_arg1.x + _local4.leftMargin));
_local2.percentage = ((_local7 / _local6) * 100);
if (_local2.percentage < 0){
_local2.percentage = 0;
};
if (_local2.percentage > 100){
_local2.percentage = 100;
};
if (_local2.fullness_mc != null){
positionBar(_arg1, "fullness", _local2.percentage);
};
}
flvplayback_internal function handleRelease(_arg1:int):void{
var _local2:int;
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
if (_arg1 == SEEK_BAR){
seekBarListener(null);
} else {
if (_arg1 == VOLUME_BAR){
volumeBarListener(null);
};
};
stopHandleDrag(controls[_arg1]);
_vc.activeVideoPlayerIndex = _local2;
if (_arg1 == SEEK_BAR){
_vc._scrubFinish();
};
}
flvplayback_internal function setTwoButtonHolderSkin(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:String):Sprite{
var _local6:Sprite;
var _local7:Sprite;
var _local8:ControlData;
_local7 = new Sprite();
_local8 = new ControlData(this, _local7, null, _arg1);
ctrlDataDict[_local7] = _local8;
skin_mc.addChild(_local7);
_local6 = setupButtonSkin(_arg2);
_local6.name = _arg3;
_local6.visible = true;
_local7.addChild(_local6);
_local6 = setupButtonSkin(_arg4);
_local6.name = _arg5;
_local6.visible = false;
_local7.addChild(_local6);
return (_local7);
}
flvplayback_internal function skinAutoHideHitTest(_arg1:TimerEvent, _arg2:Boolean=true):void{
var visibleVP:VideoPlayer;
var hit:Boolean;
var e = _arg1;
var doFade = _arg2;
try {
if (!__visible){
skin_mc.visible = false;
} else {
if (_vc.stage != null){
visibleVP = _vc.getVideoPlayer(_vc.visibleVideoPlayerIndex);
hit = visibleVP.hitTestPoint(_vc.stage.mouseX, _vc.stage.mouseY, true);
if (((((_fullScreen) && (_fullScreenTakeOver))) && (!((e == null))))){
if ((((_vc.stage.mouseX == _skinAutoHideMouseX)) && ((_vc.stage.mouseY == _skinAutoHideMouseY)))){
if ((getTimer() - _skinAutoHideLastMotionTime) > _skinAutoHideMotionTimeout){
hit = false;
};
} else {
_skinAutoHideLastMotionTime = getTimer();
_skinAutoHideMouseX = _vc.stage.mouseX;
_skinAutoHideMouseY = _vc.stage.mouseY;
};
};
if (((!(hit)) && (!((border_mc == null))))){
hit = border_mc.hitTestPoint(_vc.stage.mouseX, _vc.stage.mouseY, true);
if (((((hit) && (_fullScreen))) && (_fullScreenTakeOver))){
_skinAutoHideLastMotionTime = getTimer();
};
};
if (((!(doFade)) || ((_skinFadingMaxTime <= 0)))){
_skinFadingTimer.stop();
skin_mc.visible = hit;
skin_mc.alpha = 1;
} else {
if (((((((hit) && (skin_mc.visible))) && (((!(_skinFadingTimer.running)) || (_skinFadingIn))))) || (((!(hit)) && (((!(skin_mc.visible)) || (((_skinFadingTimer.running) && (!(_skinFadingIn)))))))))){
} else {
_skinFadingTimer.stop();
_skinFadingIn = hit;
if (((_skinFadingIn) && ((skin_mc.alpha == 1)))){
skin_mc.alpha = 0;
};
_skinFadeStartTime = getTimer();
_skinFadingTimer.start();
skin_mc.visible = true;
};
};
};
};
} catch(se:SecurityError) {
_skinAutoHideTimer.stop();
_skinFadingTimer.stop();
skin_mc.visible = __visible;
skin_mc.alpha = 1;
};
}
public function set seekBarInterval(_arg1:Number):void{
if (_seekBarTimer.delay == _arg1){
return;
};
_seekBarTimer.delay = _arg1;
}
flvplayback_internal function layoutControl(_arg1:DisplayObject):void{
var _local2:ControlData;
var _local3:Rectangle;
var _local4:Sprite;
var _local5:Rectangle;
if (_arg1 == null){
return;
};
_local2 = ctrlDataDict[_arg1];
if (_local2 == null){
return;
};
if (_local2.avatar == null){
return;
};
_local3 = calcLayoutControl(_arg1);
_arg1.x = _local3.x;
_arg1.y = _local3.y;
_arg1.width = _local3.width;
_arg1.height = _local3.height;
switch (_local2.index){
case SEEK_BAR:
case VOLUME_BAR:
if (((!((_local2.hit_mc == null))) && ((_local2.hit_mc.parent == skin_mc)))){
_local4 = _local2.hit_mc;
_local5 = calcLayoutControl(_local4);
_local4.x = _local5.x;
_local4.y = _local5.y;
_local4.width = _local5.width;
_local4.height = _local5.height;
};
if (_local2.progress_mc != null){
if (isNaN(_progressPercent)){
_progressPercent = (_vc.isRTMP) ? 100 : 0;
};
positionBar(Sprite(_arg1), "progress", _progressPercent);
};
positionHandle(Sprite(_arg1));
break;
case BUFFERING_BAR:
positionMaskedFill(_arg1, 100);
break;
};
}
public function set fullScreenSkinDelay(_arg1:int):void{
_skinAutoHideMotionTimeout = _arg1;
}
flvplayback_internal function captureMouseEvent(_arg1:MouseEvent):void{
_arg1.stopPropagation();
}
flvplayback_internal function handleMouseUp(_arg1:MouseEvent):void{
var _local2:Sprite;
var _local3:ControlData;
_local2 = controls[mouseCaptureCtrl];
if (_local2 != null){
_local3 = ctrlDataDict[_local2];
_local3.state = (_local2.hitTestPoint(_arg1.stageX, _arg1.stageY, true)) ? OVER_STATE : NORMAL_STATE;
skinButtonControl(_local2);
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
handleRelease(SEEK_BAR);
break;
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
handleRelease(VOLUME_BAR);
break;
};
};
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_OUT, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_OVER, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
_arg1.currentTarget.removeEventListener(MouseEvent.ROLL_OUT, captureMouseEvent, true);
_arg1.currentTarget.removeEventListener(MouseEvent.ROLL_OVER, captureMouseEvent, true);
}
public function set visible(_arg1:Boolean):void{
if (__visible == _arg1){
return;
};
__visible = _arg1;
if (!__visible){
skin_mc.visible = false;
} else {
setupSkinAutoHide(false);
};
}
public function get bufferingDelayInterval():Number{
return (_bufferingDelayTimer.delay);
}
public function set fullScreenBackgroundColor(_arg1:uint):void{
if (_fullScreenBgColor != _arg1){
_fullScreenBgColor = _arg1;
if (_vc){
};
};
}
public function get fullScreenTakeOver():Boolean{
return (_fullScreenTakeOver);
}
public function set skin(_arg1:String):void{
var _local2:String;
if (_arg1 == null){
removeSkin();
_skin = null;
_skinReady = true;
} else {
_local2 = String(_arg1);
if (_arg1 == _skin){
return;
};
removeSkin();
_skin = String(_arg1);
_skinReady = (_skin == "");
if (!_skinReady){
downloadSkin();
};
};
}
public function set volumeBarInterval(_arg1:Number):void{
if (_volumeBarTimer.delay == _arg1){
return;
};
_volumeBarTimer.delay = _arg1;
}
flvplayback_internal function setSkin(_arg1:int, _arg2:DisplayObject):void{
var _local3:Sprite;
var _local4:ControlData;
var _local5:String;
if (_arg1 >= NUM_CONTROLS){
return;
};
if (_arg1 < NUM_BUTTONS){
_local3 = setupButtonSkin(_arg1);
skin_mc.addChild(_local3);
_local4 = ctrlDataDict[_local3];
} else {
switch (_arg1){
case PLAY_PAUSE_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, PLAY_BUTTON, "play_mc", PAUSE_BUTTON, "pause_mc");
_local4 = ctrlDataDict[_local3];
break;
case FULL_SCREEN_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, FULL_SCREEN_ON_BUTTON, "on_mc", FULL_SCREEN_OFF_BUTTON, "off_mc");
_local4 = ctrlDataDict[_local3];
break;
case MUTE_BUTTON:
_local3 = setTwoButtonHolderSkin(_arg1, MUTE_ON_BUTTON, "on_mc", MUTE_OFF_BUTTON, "off_mc");
_local4 = ctrlDataDict[_local3];
break;
case SEEK_BAR:
case VOLUME_BAR:
_local5 = skinClassPrefixes[_arg1];
_local3 = Sprite(createSkin(skinTemplate, _local5));
if (_local3 != null){
skin_mc.addChild(_local3);
_local4 = new ControlData(this, _local3, null, _arg1);
ctrlDataDict[_local3] = _local4;
_local4.progress_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Progress"), "progress_mc");
_local4.fullness_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Fullness"), "fullness_mc");
_local4.hit_mc = Sprite(setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Hit"), "hit_mc"));
_local4.handle_mc = Sprite(setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Handle"), "handle_mc", true));
_local3.width = _arg2.width;
_local3.height = _arg2.height;
};
break;
case BUFFERING_BAR:
_local5 = skinClassPrefixes[_arg1];
_local3 = Sprite(createSkin(skinTemplate, _local5));
if (_local3 != null){
skin_mc.addChild(_local3);
_local4 = new ControlData(this, _local3, null, _arg1);
ctrlDataDict[_local3] = _local4;
_local4.fill_mc = setupBarSkinPart(_local3, _arg2, skinTemplate, (_local5 + "Fill"), "fill_mc");
_local3.width = _arg2.width;
_local3.height = _arg2.height;
};
break;
};
};
_local4.avatar = _arg2;
ctrlDataDict[_local3] = _local4;
delayedControls[_arg1] = _local3;
}
public function set bufferingBarHidesAndDisablesOthers(_arg1:Boolean):void{
_bufferingBarHides = _arg1;
}
flvplayback_internal function handleSoundEvent(_arg1:SoundEvent):void{
var _local2:Sprite;
var _local3:ControlData;
if (((_isMuted) && ((_arg1.soundTransform.volume > 0)))){
_isMuted = false;
setEnabledAndVisibleForState(MUTE_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_OFF_BUTTON]);
setEnabledAndVisibleForState(MUTE_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[MUTE_ON_BUTTON]);
};
_local2 = controls[VOLUME_BAR];
if (_local2 != null){
_local3 = ctrlDataDict[_local2];
_local3.percentage = ((_isMuted) ? cachedSoundLevel : _arg1.soundTransform.volume * 100);
if (_local3.percentage < 0){
_local3.percentage = 0;
} else {
if (_local3.percentage > 100){
_local3.percentage = 100;
};
};
positionHandle(_local2);
};
}
flvplayback_internal function stopHandleDrag(_arg1:Sprite):void{
var ctrlData:ControlData;
var handle:Sprite;
var ctrl = _arg1;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
try {
if ((((ctrl["stopHandleDrag"] is Function)) && (ctrl["stopHandleDrag"]()))){
ctrlData.isDragging = false;
return;
};
} catch(re:ReferenceError) {
};
handle = ctrlData.handle_mc;
if (handle == null){
return;
};
handle.stopDrag();
ctrlData.isDragging = false;
}
public function set skinBackgroundAlpha(_arg1:Number):void{
if (borderAlpha != _arg1){
borderAlpha = _arg1;
borderColorTransform.alphaOffset = (0xFF * _arg1);
borderPrevRect = null;
layoutSkin();
};
}
public function getControl(_arg1:int):Sprite{
return (controls[_arg1]);
}
public function set skinScaleMaximum(_arg1:Number):void{
_skinScaleMaximum = _arg1;
}
flvplayback_internal function handleLoad(_arg1:Event):void{
var i:int;
var dispObj:DisplayObject;
var index:Number;
var e = _arg1;
try {
skin_mc = new Sprite();
if (e != null){
skinTemplate = Sprite(skinLoader.content);
};
layout_mc = skinTemplate;
customClips = new Array();
delayedControls = new Array();
i = 0;
while (i < layout_mc.numChildren) {
dispObj = layout_mc.getChildAt(i);
index = layoutNameToIndexMappings[dispObj.name];
if (!isNaN(index)){
setSkin(int(index), dispObj);
} else {
if (dispObj.name != "video_mc"){
setCustomClip(dispObj);
};
};
i = (i + 1);
};
skinLoadDelayCount = 0;
_vc.addEventListener(Event.ENTER_FRAME, finishLoad);
} catch(err:Error) {
_vc.skinError(err.message);
removeSkin();
};
}
flvplayback_internal function calcBarMargins(_arg1:DisplayObject, _arg2:String, _arg3:Boolean):void{
var ctrlData:ControlData;
var bar:DisplayObject;
var barData:ControlData;
var ctrl = _arg1;
var type = _arg2;
var symmetricMargins = _arg3;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
bar = ctrlData[(type + "_mc")];
if (bar == null){
try {
bar = ctrl[(type + "_mc")];
} catch(re:ReferenceError) {
bar = null;
};
if (bar == null){
return;
};
ctrlData[(type + "_mc")] = bar;
};
barData = ctrlDataDict[bar];
if (barData == null){
barData = new ControlData(this, bar, ctrl, -1);
ctrlDataDict[bar] = barData;
};
barData.leftMargin = getNumberPropSafe(ctrl, (type + "LeftMargin"));
if (((isNaN(barData.leftMargin)) && ((bar.parent == ctrl.parent)))){
barData.leftMargin = (bar.x - ctrl.x);
};
barData.rightMargin = getNumberPropSafe(ctrl, (type + "RightMargin"));
if (isNaN(barData.rightMargin)){
if (symmetricMargins){
barData.rightMargin = barData.leftMargin;
} else {
if (bar.parent == ctrl.parent){
barData.rightMargin = (((ctrl.width - bar.width) - bar.x) + ctrl.x);
};
};
};
barData.topMargin = getNumberPropSafe(ctrl, (type + "TopMargin"));
if (((isNaN(barData.topMargin)) && ((bar.parent == ctrl.parent)))){
barData.topMargin = (bar.y - ctrl.y);
};
barData.bottomMargin = getNumberPropSafe(ctrl, (type + "BottomMargin"));
if (isNaN(barData.bottomMargin)){
if (symmetricMargins){
barData.bottomMargin = barData.topMargin;
} else {
if (bar.parent == ctrl.parent){
barData.bottomMargin = (((ctrl.height - bar.height) - bar.y) + ctrl.y);
};
};
};
barData.origX = getNumberPropSafe(ctrl, (type + "X"));
if (isNaN(barData.origX)){
if (bar.parent == ctrl.parent){
barData.origX = (bar.x - ctrl.x);
} else {
if (bar.parent == ctrl){
barData.origX = bar.x;
};
};
};
barData.origY = getNumberPropSafe(ctrl, (type + "Y"));
if (isNaN(barData.origY)){
if (bar.parent == ctrl.parent){
barData.origY = (bar.y - ctrl.y);
} else {
if (bar.parent == ctrl){
barData.origY = bar.y;
};
};
};
barData.origWidth = bar.width;
barData.origHeight = bar.height;
barData.origScaleX = bar.scaleX;
barData.origScaleY = bar.scaleY;
}
public function set skinBackgroundColor(_arg1:uint):void{
if (borderColor != _arg1){
borderColor = _arg1;
borderColorTransform.redOffset = ((borderColor >> 16) & 0xFF);
borderColorTransform.greenOffset = ((borderColor >> 8) & 0xFF);
borderColorTransform.blueOffset = (borderColor & 0xFF);
borderPrevRect = null;
layoutSkin();
};
}
public function set volumeBarScrubTolerance(_arg1:Number):void{
_volumeBarScrubTolerance = _arg1;
}
flvplayback_internal function finishAddBufferingBar(_arg1:Event=null):void{
var _local2:Sprite;
if (_arg1 != null){
_arg1.currentTarget.removeEventListener(Event.ENTER_FRAME, finishAddBufferingBar);
};
_local2 = controls[BUFFERING_BAR];
calcBarMargins(_local2, "fill", true);
fixUpBar(_local2, "fill", _local2, "fill_mc");
positionMaskedFill(_local2, 100);
}
flvplayback_internal function handleButtonEvent(_arg1:MouseEvent):void{
var ctrlData:ControlData;
var topLevel:DisplayObject;
var e = _arg1;
ctrlData = ctrlDataDict[e.currentTarget];
switch (e.type){
case MouseEvent.ROLL_OVER:
ctrlData.state = OVER_STATE;
break;
case MouseEvent.ROLL_OUT:
ctrlData.state = NORMAL_STATE;
break;
case MouseEvent.MOUSE_DOWN:
ctrlData.state = DOWN_STATE;
mouseCaptureCtrl = ctrlData.index;
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
dispatchMessage(ctrlData.index);
break;
};
topLevel = _vc.stage;
try {
topLevel.addEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
} catch(se:SecurityError) {
topLevel = _vc.root;
topLevel.addEventListener(MouseEvent.MOUSE_DOWN, captureMouseEvent, true);
};
topLevel.addEventListener(MouseEvent.MOUSE_OUT, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.MOUSE_OVER, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
topLevel.addEventListener(MouseEvent.ROLL_OUT, captureMouseEvent, true);
topLevel.addEventListener(MouseEvent.ROLL_OVER, captureMouseEvent, true);
break;
case MouseEvent.CLICK:
switch (mouseCaptureCtrl){
case SEEK_BAR_HANDLE:
case SEEK_BAR_HIT:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
break;
default:
dispatchMessage(ctrlData.index);
break;
};
return;
};
skinButtonControl(e.currentTarget);
}
flvplayback_internal function applySkinState(_arg1:ControlData, _arg2:DisplayObject):void{
if (_arg2 != _arg1.currentState_mc){
if (_arg1.currentState_mc != null){
_arg1.currentState_mc.visible = false;
};
_arg1.currentState_mc = _arg2;
_arg1.currentState_mc.visible = true;
};
}
flvplayback_internal function handleLoadErrorEvent(_arg1:ErrorEvent):void{
_skinReady = true;
_vc.skinError(_arg1.toString());
}
flvplayback_internal function addBarControl(_arg1:Sprite):void{
var _local2:ControlData;
_local2 = ctrlDataDict[_arg1];
_local2.isDragging = false;
_local2.percentage = 0;
if ((((_arg1.parent == skin_mc)) && (!((skin_mc == null))))){
finishAddBarControl(_arg1);
} else {
_arg1.addEventListener(Event.REMOVED_FROM_STAGE, cleanupHandle);
_arg1.addEventListener(Event.ENTER_FRAME, finishAddBarControl);
};
}
flvplayback_internal function handleEvent(_arg1:Event):void{
var e = _arg1;
switch (e.type){
case Event.ADDED_TO_STAGE:
_fullScreen = false;
if (_vc.stage != null){
try {
_fullScreen = (_vc.stage.displayState == StageDisplayState.FULL_SCREEN);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
} catch(se:SecurityError) {
};
};
if (!_fullScreen){
_fullScreenAccel = false;
};
setEnabledAndVisibleForState(FULL_SCREEN_OFF_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_OFF_BUTTON]);
setEnabledAndVisibleForState(FULL_SCREEN_ON_BUTTON, VideoState.PLAYING);
skinButtonControl(controls[FULL_SCREEN_ON_BUTTON]);
if (((_fullScreen) && (_fullScreenTakeOver))){
enterFullScreenTakeOver();
} else {
if (!_fullScreen){
exitFullScreenTakeOver();
};
};
layoutSkin();
setupSkinAutoHide(false);
break;
case Event.REMOVED_FROM_STAGE:
_vc.stage.removeEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
break;
};
}
flvplayback_internal function skinButtonControl(_arg1:Object):void{
var ctrl:Sprite;
var ctrlData:ControlData;
var e:Event;
var ctrlOrEvent = _arg1;
if (ctrlOrEvent == null){
return;
};
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
ctrl = Sprite(e.currentTarget);
ctrl.removeEventListener(Event.ENTER_FRAME, skinButtonControl);
} else {
ctrl = Sprite(ctrlOrEvent);
};
ctrlData = ctrlDataDict[ctrl];
if (ctrlData == null){
return;
};
try {
if (ctrl["placeholder_mc"] != undefined){
ctrl.removeChild(ctrl["placeholder_mc"]);
ctrl["placeholder_mc"] = null;
};
} catch(re:ReferenceError) {
};
if (ctrlData.state_mc == null){
ctrlData.state_mc = new Array();
};
if (ctrlData.state_mc[NORMAL_STATE] == undefined){
ctrlData.state_mc[NORMAL_STATE] = setupButtonSkinState(ctrl, ctrl, buttonSkinLinkageIDs[NORMAL_STATE], null);
};
if (((ctrlData.enabled) && (_controlsEnabled))){
if (ctrlData.state_mc[ctrlData.state] == undefined){
ctrlData.state_mc[ctrlData.state] = setupButtonSkinState(ctrl, ctrl, buttonSkinLinkageIDs[ctrlData.state], ctrlData.state_mc[NORMAL_STATE]);
};
if (ctrlData.state_mc[ctrlData.state] != ctrlData.currentState_mc){
if (ctrlData.currentState_mc != null){
ctrlData.currentState_mc.visible = false;
};
ctrlData.currentState_mc = ctrlData.state_mc[ctrlData.state];
ctrlData.currentState_mc.visible = true;
};
applySkinState(ctrlData, ctrlData.state_mc[ctrlData.state]);
} else {
ctrlData.state = NORMAL_STATE;
if (ctrlData.disabled_mc == null){
ctrlData.disabled_mc = setupButtonSkinState(ctrl, ctrl, "disabledLinkageID", ctrlData.state_mc[NORMAL_STATE]);
};
applySkinState(ctrlData, ctrlData.disabled_mc);
};
}
public function set controlsEnabled(_arg1:Boolean):void{
var _local2:int;
if (_controlsEnabled == _arg1){
return;
};
_controlsEnabled = _arg1;
_local2 = 0;
while (_local2 < NUM_BUTTONS) {
skinButtonControl(controls[_local2]);
_local2++;
};
}
flvplayback_internal function setupSkinAutoHide(_arg1:Boolean):void{
if (((_skinAutoHide) && (!((skin_mc == null))))){
skinAutoHideHitTest(null, _arg1);
_skinAutoHideTimer.start();
} else {
if (skin_mc != null){
if (((((((_arg1) && ((_skinFadingMaxTime > 0)))) && (((!(skin_mc.visible)) || ((skin_mc.alpha < 1)))))) && (__visible))){
_skinFadingTimer.stop();
_skinFadeStartTime = getTimer();
_skinFadingIn = true;
if (skin_mc.alpha == 1){
skin_mc.alpha = 0;
};
_skinFadingTimer.start();
} else {
if (_skinFadingMaxTime <= 0){
_skinFadingTimer.stop();
skin_mc.alpha = 1;
};
};
skin_mc.visible = __visible;
};
_skinAutoHideTimer.stop();
};
}
public function enterFullScreenDisplayState():void{
var theRect:Rectangle;
var vp:VideoPlayer;
var effectiveWidth:int;
var effectiveHeight:int;
var videoAspectRatio:Number;
var screenAspectRatio:Number;
var effectiveMinWidth:int;
var effectiveMinHeight:int;
var skinScaleMinWidth:int;
var skinScaleMinHeight:int;
if (((!(_fullScreen)) && (!((_vc.stage == null))))){
if (_fullScreenTakeOver){
try {
theRect = _vc.stage.fullScreenSourceRect;
_fullScreenAccel = true;
vp = _vc.getVideoPlayer(_vc.visibleVideoPlayerIndex);
effectiveWidth = vp.videoWidth;
effectiveHeight = vp.videoHeight;
videoAspectRatio = (effectiveWidth / effectiveHeight);
screenAspectRatio = (_vc.stage.fullScreenWidth / _vc.stage.fullScreenHeight);
if (videoAspectRatio > screenAspectRatio){
effectiveHeight = (effectiveWidth / screenAspectRatio);
} else {
if (videoAspectRatio < screenAspectRatio){
effectiveWidth = (effectiveHeight * screenAspectRatio);
};
};
effectiveMinWidth = fullScreenSourceRectMinWidth;
effectiveMinHeight = fullScreenSourceRectMinHeight;
if (fullScreenSourceRectMinAspectRatio > screenAspectRatio){
effectiveMinHeight = (effectiveMinWidth / screenAspectRatio);
} else {
if (fullScreenSourceRectMinAspectRatio < screenAspectRatio){
effectiveMinWidth = (effectiveMinHeight * screenAspectRatio);
};
};
skinScaleMinWidth = (_vc.stage.fullScreenWidth / _skinScaleMaximum);
skinScaleMinHeight = (_vc.stage.fullScreenHeight / _skinScaleMaximum);
if ((((effectiveMinWidth < skinScaleMinWidth)) || ((effectiveMinHeight < skinScaleMinHeight)))){
effectiveMinWidth = skinScaleMinWidth;
effectiveMinHeight = skinScaleMinHeight;
};
if ((((effectiveWidth < effectiveMinWidth)) || ((effectiveHeight < effectiveMinHeight)))){
effectiveWidth = effectiveMinWidth;
effectiveHeight = effectiveMinHeight;
};
_vc.stage.fullScreenSourceRect = new Rectangle(0, 0, effectiveWidth, effectiveHeight);
_vc.stage.displayState = StageDisplayState.FULL_SCREEN;
} catch(re:ReferenceError) {
_fullScreenAccel = false;
} catch(re:SecurityError) {
_fullScreenAccel = false;
};
};
try {
_vc.stage.displayState = StageDisplayState.FULL_SCREEN;
} catch(se:SecurityError) {
};
};
}
public function get skin():String{
return (_skin);
}
flvplayback_internal function finishAddBarControl(_arg1:Object):void{
var ctrl:Sprite;
var ctrlData:ControlData;
var e:Event;
var ctrlOrEvent = _arg1;
if (ctrlOrEvent == null){
return;
};
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
ctrl = Sprite(e.currentTarget);
ctrl.removeEventListener(Event.ENTER_FRAME, finishAddBarControl);
} else {
ctrl = Sprite(ctrlOrEvent);
};
ctrlData = ctrlDataDict[ctrl];
try {
if ((ctrl["addBarControl"] is Function)){
var _local3 = ctrl;
_local3["addBarControl"]();
};
} catch(re:ReferenceError) {
};
ctrlData.origWidth = ctrl.width;
ctrlData.origHeight = ctrl.height;
fixUpBar(ctrl, "progress", ctrl, "progress_mc");
calcBarMargins(ctrl, "progress", false);
if (ctrlData.progress_mc != null){
fixUpBar(ctrl, "progressBarFill", ctrlData.progress_mc, "fill_mc");
calcBarMargins(ctrlData.progress_mc, "fill", false);
calcBarMargins(ctrlData.progress_mc, "mask", false);
if (isNaN(_progressPercent)){
_progressPercent = (_vc.isRTMP) ? 100 : 0;
};
positionBar(ctrl, "progress", _progressPercent);
};
fixUpBar(ctrl, "fullness", ctrl, "fullness_mc");
calcBarMargins(ctrl, "fullness", false);
if (ctrlData.fullness_mc != null){
fixUpBar(ctrl, "fullnessBarFill", ctrlData.fullness_mc, "fill_mc");
calcBarMargins(ctrlData.fullness_mc, "fill", false);
calcBarMargins(ctrlData.fullness_mc, "mask", false);
};
fixUpBar(ctrl, "hit", ctrl, "hit_mc");
fixUpBar(ctrl, "handle", ctrl, "handle_mc");
calcBarMargins(ctrl, "handle", true);
switch (ctrlData.index){
case SEEK_BAR:
setControl(SEEK_BAR_HANDLE, ctrlData.handle_mc);
if (ctrlData.hit_mc != null){
setControl(SEEK_BAR_HIT, ctrlData.hit_mc);
};
break;
case VOLUME_BAR:
setControl(VOLUME_BAR_HANDLE, ctrlData.handle_mc);
if (ctrlData.hit_mc != null){
setControl(VOLUME_BAR_HIT, ctrlData.hit_mc);
};
break;
};
positionHandle(ctrl);
}
public function get fullScreenBackgroundColor():uint{
return (_fullScreenBgColor);
}
flvplayback_internal function startHandleDrag(_arg1:Sprite):void{
var ctrlData:ControlData;
var handle:Sprite;
var handleData:ControlData;
var theY:Number;
var theWidth:Number;
var bounds:Rectangle;
var ctrl = _arg1;
if (ctrl == null){
return;
};
ctrlData = ctrlDataDict[ctrl];
try {
if ((((ctrl["startHandleDrag"] is Function)) && (ctrl["startHandleDrag"]()))){
ctrlData.isDragging = true;
return;
};
} catch(re:ReferenceError) {
};
handle = ctrlData.handle_mc;
if (handle == null){
return;
};
handleData = ctrlDataDict[handle];
theY = (ctrl.y + handleData.origY);
theWidth = (isNaN(ctrlData.origWidth)) ? ctrl.width : ctrlData.origWidth;
bounds = new Rectangle((ctrl.x + handleData.leftMargin), theY, (theWidth - handleData.rightMargin), 0);
handle.startDrag(false, bounds);
ctrlData.isDragging = true;
}
flvplayback_internal function setupBarSkinPart(_arg1:Sprite, _arg2:DisplayObject, _arg3:Sprite, _arg4:String, _arg5:String, _arg6:Boolean=false):DisplayObject{
var part:DisplayObject;
var partAvatar:DisplayObject;
var ctrlData:ControlData;
var partData:ControlData;
var ctrl = _arg1;
var avatar = _arg2;
var definitionHolder = _arg3;
var skinName = _arg4;
var partName = _arg5;
var required = _arg6;
try {
part = ctrl[partName];
} catch(re:ReferenceError) {
part = null;
};
if (part == null){
try {
part = createSkin(definitionHolder, skinName);
} catch(ve:VideoError) {
if (required){
throw (ve);
};
};
if (part != null){
skin_mc.addChild(part);
part.x = ctrl.x;
part.y = ctrl.y;
partAvatar = layout_mc.getChildByName((skinName + "_mc"));
if (partAvatar != null){
if (partName == "hit_mc"){
ctrlData = ctrlDataDict[ctrl];
partData = new ControlData(this, part, controls[ctrlData.index], -1);
partData.avatar = partAvatar;
ctrlDataDict[part] = partData;
} else {
part.x = (part.x + (partAvatar.x - avatar.x));
part.y = (part.y + (partAvatar.y - avatar.y));
part.width = partAvatar.width;
part.height = partAvatar.height;
};
};
};
};
if (((required) && ((part == null)))){
throw (new VideoError(VideoError.MISSING_SKIN_STYLE, skinName));
};
return (part);
}
public function get skinBackgroundAlpha():Number{
return (borderAlpha);
}
public function get volumeBarScrubTolerance():Number{
return (_volumeBarScrubTolerance);
}
public function get skinScaleMaximum():Number{
return (_skinScaleMaximum);
}
public function get skinBackgroundColor():uint{
return (borderColor);
}
public function get controlsEnabled():Boolean{
return (_controlsEnabled);
}
flvplayback_internal function handleIVPEvent(_arg1:IVPEvent):void{
var _local2:uint;
var _local3:int;
var _local4:VideoEvent;
var _local5:Sprite;
var _local6:ControlData;
var _local7:VideoProgressEvent;
var _local8:VideoPlayerState;
var _local9:Number;
var _local10:Number;
var _local11:Number;
if (_arg1.vp != _vc.visibleVideoPlayerIndex){
return;
};
_local2 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
switch (_arg1.type){
case VideoEvent.STATE_CHANGE:
_local4 = VideoEvent(_arg1);
if (_local4.state == VideoState.BUFFERING){
if (!_bufferingOn){
_bufferingDelayTimer.reset();
_bufferingDelayTimer.start();
};
} else {
_bufferingDelayTimer.reset();
_bufferingOn = false;
};
if (_local4.state == VideoState.LOADING){
_progressPercent = (_vc.getVideoPlayer(_arg1.vp).isRTMP) ? 100 : 0;
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (controls[_local3] == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
};
_local3 = 0;
while (_local3 < NUM_CONTROLS) {
if (controls[_local3] == undefined){
} else {
setEnabledAndVisibleForState(_local3, _local4.state);
if (_local3 < NUM_BUTTONS){
skinButtonControl(controls[_local3]);
};
};
_local3++;
};
break;
case VideoEvent.READY:
case MetadataEvent.METADATA_RECEIVED:
_local3 = 0;
while (_local3 < NUM_CONTROLS) {
if (controls[_local3] == undefined){
} else {
setEnabledAndVisibleForState(_local3, _vc.state);
if (_local3 < NUM_BUTTONS){
skinButtonControl(controls[_local3]);
};
};
_local3++;
};
if (_vc.getVideoPlayer(_arg1.vp).isRTMP){
_progressPercent = 100;
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (_local5 == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
};
break;
case VideoEvent.PLAYHEAD_UPDATE:
if (((((((!((controls[SEEK_BAR] == undefined))) && (!(_vc.isLive)))) && (!(isNaN(_vc.totalTime))))) && (!((_vc.getVideoPlayer(_vc.visibleVideoPlayerIndex).state == VideoState.SEEKING))))){
_local4 = VideoEvent(_arg1);
_local10 = ((_local4.playheadTime / _vc.totalTime) * 100);
if (_local10 < 0){
_local10 = 0;
} else {
if (_local10 > 100){
_local10 = 100;
};
};
_local5 = controls[SEEK_BAR];
_local6 = ctrlDataDict[_local5];
_local6.percentage = _local10;
positionHandle(_local5);
};
break;
case VideoProgressEvent.PROGRESS:
_local7 = VideoProgressEvent(_arg1);
_progressPercent = ((_local7.bytesTotal)<=0) ? 100 : ((_local7.bytesLoaded / _local7.bytesTotal) * 100);
_local8 = _vc.videoPlayerStates[_arg1.vp];
_local9 = _local8.minProgressPercent;
if (((!(isNaN(_local9))) && ((_local9 > _progressPercent)))){
_progressPercent = _local9;
};
if (!isNaN(_vc.totalTime)){
_local11 = ((_vc.playheadTime / _vc.totalTime) * 100);
if (_local11 > _progressPercent){
_progressPercent = _local11;
_local8.minProgressPercent = _progressPercent;
};
};
_local3 = SEEK_BAR;
while (_local3 <= VOLUME_BAR) {
_local5 = controls[_local3];
if (_local5 == null){
} else {
_local6 = ctrlDataDict[_local5];
if (_local6.progress_mc != null){
positionBar(_local5, "progress", _progressPercent);
};
};
_local3++;
};
break;
};
_vc.activeVideoPlayerIndex = _local2;
}
flvplayback_internal function setupButtonSkinState(_arg1:Sprite, _arg2:Sprite, _arg3:String, _arg4:DisplayObject=null):DisplayObject{
var stateSkin:DisplayObject;
var ctrl = _arg1;
var definitionHolder = _arg2;
var skinName = _arg3;
var defaultSkin = _arg4;
try {
stateSkin = createSkin(definitionHolder, skinName);
} catch(ve:VideoError) {
if (defaultSkin != null){
stateSkin = null;
} else {
throw (ve);
};
};
if (stateSkin != null){
stateSkin.visible = false;
ctrl.addChild(stateSkin);
} else {
if (defaultSkin != null){
stateSkin = defaultSkin;
};
};
return (stateSkin);
}
flvplayback_internal function layoutSkin():void{
var video_mc:DisplayObject;
var i:int;
var borderRect:Rectangle;
var forceSkinAutoHide:Boolean;
var minWidth:Number;
var vidWidth:Number;
var minHeight:Number;
var vidHeight:Number;
if (layout_mc == null){
return;
};
if (skinLoadDelayCount < 2){
return;
};
video_mc = layout_mc["video_mc"];
if (video_mc == null){
throw (new Error("No layout_mc.video_mc"));
};
placeholderLeft = video_mc.x;
placeholderRight = (video_mc.x + video_mc.width);
placeholderTop = video_mc.y;
placeholderBottom = (video_mc.y + video_mc.height);
videoLeft = (_vc.x - _vc.registrationX);
videoRight = (videoLeft + _vc.width);
videoTop = (_vc.y - _vc.registrationY);
videoBottom = (videoTop + _vc.height);
if (((((_fullScreen) && (_fullScreenTakeOver))) && (!((border_mc == null))))){
borderRect = calcLayoutControl(border_mc);
forceSkinAutoHide = false;
if ((((borderRect.width > 0)) && ((borderRect.height > 0)))){
if (borderRect.x < 0){
placeholderLeft = (placeholderLeft + (videoLeft - borderRect.x));
forceSkinAutoHide = true;
};
if ((borderRect.x + borderRect.width) > _vc.registrationWidth){
placeholderRight = (placeholderRight + ((borderRect.x + borderRect.width) - videoRight));
forceSkinAutoHide = true;
};
if (borderRect.y < 0){
placeholderTop = (placeholderTop + (videoTop - borderRect.y));
forceSkinAutoHide = true;
};
if ((borderRect.y + borderRect.height) > _vc.registrationHeight){
placeholderBottom = (placeholderBottom + ((borderRect.y + borderRect.height) - videoBottom));
forceSkinAutoHide = true;
};
if (forceSkinAutoHide){
_skinAutoHide = true;
setupSkinAutoHide(true);
};
};
};
try {
if (!isNaN(layout_mc["minWidth"])){
minWidth = layout_mc["minWidth"];
vidWidth = (videoRight - videoLeft);
if ((((minWidth > 0)) && ((minWidth > vidWidth)))){
videoLeft = (videoLeft - ((minWidth - vidWidth) / 2));
videoRight = (minWidth + videoLeft);
};
};
} catch(re1:ReferenceError) {
};
try {
if (!isNaN(layout_mc["minHeight"])){
minHeight = layout_mc["minHeight"];
vidHeight = (videoBottom - videoTop);
if ((((minHeight > 0)) && ((minHeight > vidHeight)))){
videoTop = (videoTop - ((minHeight - vidHeight) / 2));
videoBottom = (minHeight + videoTop);
};
};
} catch(re2:ReferenceError) {
};
i = 0;
while (i < customClips.length) {
layoutControl(customClips[i]);
if (customClips[i] == border_mc){
bitmapCopyBorder();
};
i = (i + 1);
};
i = 0;
while (i < NUM_CONTROLS) {
layoutControl(controls[i]);
i = (i + 1);
};
}
public function set bufferingDelayInterval(_arg1:Number):void{
if (_bufferingDelayTimer.delay == _arg1){
return;
};
_bufferingDelayTimer.delay = _arg1;
}
flvplayback_internal function setEnabledAndVisibleForState(_arg1:int, _arg2:String):void{
var _local3:int;
var _local4:String;
var _local5:Sprite;
var _local6:ControlData;
var _local7:Boolean;
var _local8:ControlData;
var _local9:ControlData;
var _local10:ControlData;
var _local11:ControlData;
_local3 = _vc.activeVideoPlayerIndex;
_vc.activeVideoPlayerIndex = _vc.visibleVideoPlayerIndex;
_local4 = _arg2;
if ((((_local4 == VideoState.BUFFERING)) && (!(_bufferingOn)))){
_local4 = VideoState.PLAYING;
};
_local5 = controls[_arg1];
if (_local5 == null){
return;
};
_local6 = ctrlDataDict[_local5];
if (_local6 == null){
return;
};
switch (_arg1){
case VOLUME_BAR:
case VOLUME_BAR_HANDLE:
case VOLUME_BAR_HIT:
_local6.enabled = true;
break;
case FULL_SCREEN_ON_BUTTON:
_local6.enabled = !(_fullScreen);
if (controls[FULL_SCREEN_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case FULL_SCREEN_OFF_BUTTON:
_local6.enabled = _fullScreen;
if (controls[FULL_SCREEN_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case MUTE_ON_BUTTON:
_local6.enabled = !(_isMuted);
if (controls[MUTE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case MUTE_OFF_BUTTON:
_local6.enabled = _isMuted;
if (controls[MUTE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
default:
switch (_local4){
case VideoState.LOADING:
case VideoState.CONNECTION_ERROR:
_local6.enabled = false;
break;
case VideoState.DISCONNECTED:
_local6.enabled = ((!((_vc.source == null))) && (!((_vc.source == ""))));
break;
case VideoState.SEEKING:
break;
default:
_local6.enabled = true;
break;
};
break;
};
switch (_arg1){
case SEEK_BAR:
switch (_local4){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.REWINDING:
case VideoState.SEEKING:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
default:
_local6.enabled = false;
break;
};
if (_local6.enabled){
_local6.enabled = !(isNaN(_vc.totalTime));
};
if (_local6.handle_mc != null){
_local8 = ctrlDataDict[_local6.handle_mc];
_local8.enabled = _local6.enabled;
_local6.handle_mc.visible = _local8.enabled;
};
if (_local6.hit_mc != null){
_local9 = ctrlDataDict[_local6.hit_mc];
_local9.enabled = _local6.enabled;
_local6.hit_mc.visible = _local9.enabled;
};
_local7 = ((((((!(_bufferingBarHides)) || (_local6.enabled))) || ((controls[BUFFERING_BAR] == undefined)))) || (!(controls[BUFFERING_BAR].visible)));
_local5.visible = _local7;
if (_local6.progress_mc != null){
_local6.progress_mc.visible = _local7;
_local10 = ctrlDataDict[_local6.progress_mc];
if (_local10.fill_mc != null){
_local10.fill_mc.visible = _local7;
};
};
if (_local6.fullness_mc != null){
_local6.fullness_mc.visible = _local7;
_local11 = ctrlDataDict[_local6.fullness_mc];
if (_local11.fill_mc != null){
_local11.fill_mc.visible = _local7;
};
};
break;
case BUFFERING_BAR:
switch (_local4){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.REWINDING:
case VideoState.SEEKING:
_local6.enabled = false;
break;
default:
_local6.enabled = true;
break;
};
_local5.visible = _local6.enabled;
if (_local6.fill_mc != null){
_local6.fill_mc.visible = _local6.enabled;
};
break;
case PAUSE_BUTTON:
switch (_local4){
case VideoState.DISCONNECTED:
case VideoState.STOPPED:
case VideoState.PAUSED:
case VideoState.REWINDING:
_local6.enabled = false;
break;
case VideoState.PLAYING:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
if (controls[PLAY_PAUSE_BUTTON] != undefined){
_local5.visible = _local6.enabled;
};
break;
case PLAY_BUTTON:
switch (_local4){
case VideoState.PLAYING:
_local6.enabled = false;
break;
case VideoState.STOPPED:
case VideoState.PAUSED:
_local6.enabled = true;
break;
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
if (controls[PLAY_PAUSE_BUTTON] != undefined){
_local5.visible = !(controls[PAUSE_BUTTON].visible);
};
break;
case STOP_BUTTON:
switch (_local4){
case VideoState.DISCONNECTED:
case VideoState.STOPPED:
_local6.enabled = false;
break;
case VideoState.PAUSED:
case VideoState.PLAYING:
case VideoState.BUFFERING:
_local6.enabled = true;
break;
};
break;
case BACK_BUTTON:
case FORWARD_BUTTON:
switch (_local4){
case VideoState.BUFFERING:
_local6.enabled = ((!(_bufferingBarHides)) || ((controls[BUFFERING_BAR] == undefined)));
break;
};
};
_local5.mouseEnabled = _local6.enabled;
_vc.activeVideoPlayerIndex = _local3;
}
public function set fullScreenTakeOver(_arg1:Boolean):void{
var v = _arg1;
if (_fullScreenTakeOver != v){
_fullScreenTakeOver = v;
if (_fullScreenTakeOver){
enterFullScreenTakeOver();
} else {
if (((((!((_vc.stage == null))) && (_fullScreen))) && (_fullScreenAccel))){
try {
_vc.stage.displayState = StageDisplayState.NORMAL;
} catch(se:SecurityError) {
};
};
exitFullScreenTakeOver();
};
};
}
flvplayback_internal function enterFullScreenTakeOver():void{
var i:int;
var fullScreenBG:Sprite;
var vp:VideoPlayer;
if (((!(_fullScreen)) || (!((cacheFLVPlaybackParent == null))))){
return;
};
_vc.removeEventListener(LayoutEvent.LAYOUT, handleLayoutEvent);
_vc.removeEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleLayoutEvent);
_vc.removeEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.stage.removeEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
try {
cacheFLVPlaybackScaleMode = new Array();
cacheFLVPlaybackAlign = new Array();
i = 0;
while (i < _vc.videoPlayers.length) {
vp = (_vc.videoPlayers[i] as VideoPlayer);
if (vp != null){
cacheFLVPlaybackScaleMode[i] = vp.scaleMode;
cacheFLVPlaybackAlign[i] = vp.align;
};
i = (i + 1);
};
cacheFLVPlaybackParent = _vc.parent;
cacheFLVPlaybackIndex = _vc.parent.getChildIndex(_vc);
cacheFLVPlaybackLocation = new Rectangle(_vc.registrationX, _vc.registrationY, _vc.registrationWidth, _vc.registrationHeight);
if (!_fullScreenAccel){
cacheStageAlign = _vc.stage.align;
cacheStageScaleMode = _vc.stage.scaleMode;
_vc.stage.align = StageAlign.TOP_LEFT;
_vc.stage.scaleMode = StageScaleMode.NO_SCALE;
};
_vc.align = VideoAlign.CENTER;
_vc.scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
_vc.registrationX = 0;
_vc.registrationY = 0;
_vc.setSize(_vc.stage.stageWidth, _vc.stage.stageHeight);
if (_vc.stage != _vc.parent){
_vc.stage.addChild(_vc);
} else {
_vc.stage.setChildIndex(_vc, (_vc.stage.numChildren - 1));
};
fullScreenBG = Sprite(_vc.getChildByName("fullScreenBG"));
if (fullScreenBG == null){
fullScreenBG = new Sprite();
fullScreenBG.name = "fullScreenBG";
_vc.addChildAt(fullScreenBG, 0);
} else {
_vc.setChildIndex(fullScreenBG, 0);
};
fullScreenBG.graphics.beginFill(_fullScreenBgColor);
fullScreenBG.graphics.drawRect(0, 0, _vc.stage.stageWidth, _vc.stage.stageHeight);
layoutSkin();
setupSkinAutoHide(false);
} catch(err:Error) {
cacheFLVPlaybackParent = null;
};
_vc.addEventListener(LayoutEvent.LAYOUT, handleLayoutEvent);
_vc.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, handleLayoutEvent);
_vc.addEventListener(Event.ADDED_TO_STAGE, handleEvent);
_vc.stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreenEvent);
}
public function set seekBarScrubTolerance(_arg1:Number):void{
_seekBarScrubTolerance = _arg1;
}
flvplayback_internal function cleanupHandle(_arg1:Object):void{
var e:Event;
var ctrl:Sprite;
var ctrlData:ControlData;
var ctrlOrEvent = _arg1;
try {
if ((ctrlOrEvent is Event)){
e = Event(ctrlOrEvent);
};
ctrl = ((e == null)) ? Sprite(ctrlOrEvent) : Sprite(e.currentTarget);
ctrlData = ctrlDataDict[ctrl];
if ((((ctrlData == null)) || ((e == null)))){
ctrl.removeEventListener(Event.REMOVED_FROM_STAGE, cleanupHandle, false);
if (ctrlData == null){
return;
};
};
ctrl.removeEventListener(Event.ENTER_FRAME, finishAddBarControl);
if (ctrlData.handle_mc != null){
if (ctrlData.handle_mc.parent != null){
ctrlData.handle_mc.parent.removeChild(ctrlData.handle_mc);
};
delete ctrlDataDict[ctrlData.handle_mc];
ctrlData.handle_mc = null;
};
if (ctrlData.hit_mc != null){
if (ctrlData.hit_mc.parent != null){
ctrlData.hit_mc.parent.removeChild(ctrlData.hit_mc);
};
delete ctrlDataDict[ctrlData.hit_mc];
ctrlData.hit_mc = null;
};
} catch(err:Error) {
};
}
flvplayback_internal static function getNumberPropSafe(_arg1:Object, _arg2:String):Number{
var numProp:*;
var obj = _arg1;
var propName = _arg2;
try {
numProp = obj[propName];
return (Number(numProp));
} catch(re:ReferenceError) {
};
return (NaN);
}
flvplayback_internal static function getBooleanPropSafe(_arg1:Object, _arg2:String):Boolean{
var boolProp:*;
var obj = _arg1;
var propName = _arg2;
try {
boolProp = obj[propName];
return (Boolean(boolProp));
} catch(re:ReferenceError) {
};
return (false);
}
flvplayback_internal static function initLayoutNameToIndexMappings():void{
var _local1:int;
layoutNameToIndexMappings = new Object();
_local1 = 0;
while (_local1 < layoutNameArray.length) {
if (layoutNameArray[_local1] != null){
layoutNameToIndexMappings[layoutNameArray[_local1]] = _local1;
};
_local1++;
};
}
}
}//package fl.video
Section 56
//VideoAlign (fl.video.VideoAlign)
package fl.video {
public final class VideoAlign {
public static const CENTER:String = "center";
public static const LEFT:String = "left";
public static const BOTTOM_RIGHT:String = "bottomRight";
public static const BOTTOM:String = "bottom";
public static const TOP_LEFT:String = "topLeft";
public static const TOP_RIGHT:String = "topRight";
public static const TOP:String = "top";
public static const BOTTOM_LEFT:String = "bottomLeft";
public static const RIGHT:String = "right";
}
}//package fl.video
Section 57
//VideoError (fl.video.VideoError)
package fl.video {
public class VideoError extends Error {
private var _code:uint;
public static const INVALID_SOURCE:uint = 1004;
flvplayback_internal static const ERROR_MSG:Array = ["Unable to make connection to server or to find FLV on server", "No matching cue point found", "Illegal cue point", "Invalid seek", "Invalid source", "Invalid xml", "No bitrate match, must be no default flv", "Cannot delete default VideoPlayer", "VideoPlayer.iNCManagerClass has not been set or its value is invalid", "Null url parameter sent to load()", "Skin is missing a required style definition or its value is invalid", "Unsupported property", "VideoPlayer.netStreamClientClass has not been set or its value is invalid"];
public static const NULL_URL_LOAD:uint = 1009;
public static const INVALID_XML:uint = 1005;
flvplayback_internal static const BASE_ERROR_CODE:uint = 1000;
public static const DELETE_DEFAULT_PLAYER:uint = 1007;
public static const SHORT_VERSION:String = "2.1";
public static const UNSUPPORTED_PROPERTY:uint = 1011;
public static const ILLEGAL_CUE_POINT:uint = 1002;
public static const INVALID_SEEK:uint = 1003;
public static const NO_CONNECTION:uint = 1000;
public static const MISSING_SKIN_STYLE:uint = 1010;
public static const INCMANAGER_CLASS_UNSET:uint = 1008;
public static const NO_BITRATE_MATCH:uint = 1006;
public static const NETSTREAM_CLIENT_CLASS_UNSET:uint = 1012;
public static const VERSION:String = "2.1.0.14";
public function VideoError(_arg1:uint, _arg2:String=null){
super((((("" + _arg1) + ": ") + ERROR_MSG[(_arg1 - BASE_ERROR_CODE)]) + ((_arg2)==null) ? "" : (": " + _arg2)));
name = "VideoError";
_code = _arg1;
}
public function get code():uint{
return (_code);
}
}
}//package fl.video
Section 58
//VideoEvent (fl.video.VideoEvent)
package fl.video {
import flash.events.*;
public class VideoEvent extends Event implements IVPEvent {
private var _vp:uint;
private var _playheadTime:Number;
private var _state:String;
public static const FAST_FORWARD:String = "fastForward";
public static const READY:String = "ready";
public static const SKIN_LOADED:String = "skinLoaded";
public static const SCRUB_FINISH:String = "scrubFinish";
public static const BUFFERING_STATE_ENTERED:String = "bufferingStateEntered";
public static const STOPPED_STATE_ENTERED:String = "stoppedStateEntered";
public static const AUTO_REWOUND:String = "autoRewound";
public static const SCRUB_START:String = "scrubStart";
public static const PLAYHEAD_UPDATE:String = "playheadUpdate";
public static const SEEKED:String = "seeked";
public static const PLAYING_STATE_ENTERED:String = "playingStateEntered";
public static const CLOSE:String = "close";
public static const PAUSED_STATE_ENTERED:String = "pausedStateEntered";
public static const COMPLETE:String = "complete";
public static const REWIND:String = "rewind";
public static const STATE_CHANGE:String = "stateChange";
public function VideoEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=null, _arg5:Number=NaN, _arg6:uint=0){
super(_arg1, _arg2, _arg3);
_state = _arg4;
_playheadTime = _arg5;
_vp = _arg6;
}
public function set playheadTime(_arg1:Number):void{
_playheadTime = _arg1;
}
public function get playheadTime():Number{
return (_playheadTime);
}
public function get state():String{
return (_state);
}
public function get vp():uint{
return (_vp);
}
override public function clone():Event{
return (new VideoEvent(type, bubbles, cancelable, state, playheadTime, vp));
}
public function set state(_arg1:String):void{
_state = _arg1;
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
}
}//package fl.video
Section 59
//VideoPlayer (fl.video.VideoPlayer)
package fl.video {
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
public class VideoPlayer extends Video {
protected var _align:String;
protected var _registrationWidth:Number;
flvplayback_internal var _updateProgressTimer:Timer;
flvplayback_internal var _atEndCheckPlayhead:Number;
flvplayback_internal var _hiddenForResize:Boolean;
flvplayback_internal var startProgressTime:Number;
protected var _volume:Number;
flvplayback_internal var _invalidSeekTime:Boolean;
flvplayback_internal var _readyDispatched:Boolean;
flvplayback_internal var lastUpdateTimeStuckCount:Number;
protected var _ns:NetStream;
protected var _isLive:Boolean;
flvplayback_internal var _bufferState:String;
protected var _streamLength:Number;
flvplayback_internal var _rtmpDoSeekTimer:Timer;
protected var _contentPath:String;
flvplayback_internal var lastUpdateTimeStuckCountMax:int;// = 10
protected var _metadata:Object;
protected var __visible:Boolean;
flvplayback_internal var autoResizeMetadataDelayMax:Number;// = 5
protected var _scaleMode:String;
flvplayback_internal var _lastUpdateTime:Number;
flvplayback_internal var _sawPlayStop:Boolean;
flvplayback_internal var _atEnd:Boolean;
flvplayback_internal var _sawSeekNotify:Boolean;
flvplayback_internal var _idleTimeoutTimer:Timer;
flvplayback_internal var _prevVideoWidth:int;
protected var _registrationX:Number;
protected var _registrationY:Number;
protected var _bufferTime:Number;
flvplayback_internal var _cachedState:String;
flvplayback_internal var totalDownloadTime:Number;
flvplayback_internal var _cachedPlayheadTime:Number;
protected var _autoPlay:Boolean;
protected var _autoRewind:Boolean;
flvplayback_internal var _invalidSeekRecovery:Boolean;
flvplayback_internal var _hiddenRewindPlayheadTime:Number;
flvplayback_internal var _prevVideoHeight:int;
protected var _ncMgr:INCManager;
protected var _soundTransform:SoundTransform;
flvplayback_internal var _httpDoSeekCount:Number;
flvplayback_internal var oldRegistrationBounds:Rectangle;
flvplayback_internal var _cmdQueue:Array;
flvplayback_internal var _updateTimeTimer:Timer;
flvplayback_internal var httpDoSeekMaxCount:Number;// = 4
flvplayback_internal var _startingPlay:Boolean;
flvplayback_internal var baselineProgressTime:Number;
flvplayback_internal var _autoResizeTimer:Timer;
flvplayback_internal var _autoResizeDone:Boolean;
flvplayback_internal var _httpDoSeekTimer:Timer;
protected var _state:String;
protected var _videoWidth:int;
flvplayback_internal var _finishAutoResizeTimer:Timer;
flvplayback_internal var _resizeImmediatelyOnMetadata:Boolean;
flvplayback_internal var _currentPos:Number;
flvplayback_internal var oldBounds:Rectangle;
protected var _videoHeight:int;
flvplayback_internal var waitingForEnough:Boolean;
flvplayback_internal var _delayedBufferingTimer:Timer;
protected var _registrationHeight:Number;
flvplayback_internal var _hiddenForResizeMetadataDelay:Number;
flvplayback_internal var autoResizePlayheadTimeout:Number;// = 0.5
flvplayback_internal var _rtmpDoStopAtEndTimer:Timer;
flvplayback_internal var _lastSeekTime:Number;
flvplayback_internal var totalProgressTime:Number;
flvplayback_internal static const FINISH_AUTO_RESIZE_INTERVAL:Number = 250;
flvplayback_internal static const DEFAULT_AUTO_RESIZE_PLAYHEAD_TIMEOUT:Number = 0.5;
flvplayback_internal static const DEFAULT_AUTO_RESIZE_METADATA_DELAY_MAX:Number = 5;
public static const SHORT_VERSION:String = "2.1";
flvplayback_internal static const HTTP_DO_SEEK_INTERVAL:Number = 250;
flvplayback_internal static const DEFAULT_HTTP_DO_SEEK_MAX_COUNT:Number = 4;
flvplayback_internal static const RTMP_DO_SEEK_INTERVAL:Number = 100;
flvplayback_internal static const HTTP_DELAYED_BUFFERING_INTERVAL:Number = 100;
public static const DEFAULT_UPDATE_TIME_INTERVAL:Number = 250;
flvplayback_internal static const AUTO_RESIZE_INTERVAL:Number = 100;
public static const DEFAULT_IDLE_TIMEOUT_INTERVAL:Number = 300000;
flvplayback_internal static const DEFAULT_LAST_UPDATE_TIME_STUCK_COUNT_MAX:int = 10;
flvplayback_internal static const RTMP_DO_STOP_AT_END_INTERVAL:Number = 500;
public static const VERSION:String = "2.1.0.14";
public static const DEFAULT_UPDATE_PROGRESS_INTERVAL:Number = 250;
public static var netStreamClientClass:Object = VideoPlayerClient;
public static var iNCManagerClass:Object = "fl.video.NCManager";
flvplayback_internal static var BUFFER_FLUSH:String = "bufferFlush";
flvplayback_internal static var BUFFER_FULL:String = "bufferFull";
flvplayback_internal static var BUFFER_EMPTY:String = "bufferEmpty";
public function VideoPlayer(_arg1:int=320, _arg2:int=240){
autoResizePlayheadTimeout = DEFAULT_AUTO_RESIZE_PLAYHEAD_TIMEOUT;
autoResizeMetadataDelayMax = DEFAULT_AUTO_RESIZE_METADATA_DELAY_MAX;
httpDoSeekMaxCount = DEFAULT_HTTP_DO_SEEK_MAX_COUNT;
lastUpdateTimeStuckCountMax = DEFAULT_LAST_UPDATE_TIME_STUCK_COUNT_MAX;
super(_arg1, _arg2);
_registrationX = x;
_registrationY = y;
_registrationWidth = _arg1;
_registrationHeight = _arg2;
_state = VideoState.DISCONNECTED;
_cachedState = _state;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_cachedPlayheadTime = 0;
_metadata = null;
_startingPlay = false;
_invalidSeekTime = false;
_invalidSeekRecovery = false;
_currentPos = 0;
_atEnd = false;
_streamLength = 0;
_cmdQueue = new Array();
_readyDispatched = false;
_autoResizeDone = false;
_lastUpdateTime = NaN;
lastUpdateTimeStuckCount = 0;
_sawSeekNotify = false;
_hiddenForResize = false;
_hiddenForResizeMetadataDelay = 0;
_resizeImmediatelyOnMetadata = false;
_videoWidth = -1;
_videoHeight = -1;
_prevVideoWidth = 0;
_prevVideoHeight = 0;
_updateTimeTimer = new Timer(DEFAULT_UPDATE_TIME_INTERVAL);
_updateTimeTimer.addEventListener(TimerEvent.TIMER, doUpdateTime);
_updateProgressTimer = new Timer(DEFAULT_UPDATE_PROGRESS_INTERVAL);
_updateProgressTimer.addEventListener(TimerEvent.TIMER, doUpdateProgress);
_idleTimeoutTimer = new Timer(DEFAULT_IDLE_TIMEOUT_INTERVAL, 1);
_idleTimeoutTimer.addEventListener(TimerEvent.TIMER, doIdleTimeout);
_autoResizeTimer = new Timer(AUTO_RESIZE_INTERVAL);
_autoResizeTimer.addEventListener(TimerEvent.TIMER, doAutoResize);
_rtmpDoStopAtEndTimer = new Timer(RTMP_DO_STOP_AT_END_INTERVAL);
_rtmpDoStopAtEndTimer.addEventListener(TimerEvent.TIMER, rtmpDoStopAtEnd);
_rtmpDoSeekTimer = new Timer(RTMP_DO_SEEK_INTERVAL);
_rtmpDoSeekTimer.addEventListener(TimerEvent.TIMER, rtmpDoSeek);
_httpDoSeekTimer = new Timer(HTTP_DO_SEEK_INTERVAL);
_httpDoSeekTimer.addEventListener(TimerEvent.TIMER, httpDoSeek);
_httpDoSeekCount = 0;
_finishAutoResizeTimer = new Timer(FINISH_AUTO_RESIZE_INTERVAL, 1);
_finishAutoResizeTimer.addEventListener(TimerEvent.TIMER, finishAutoResize);
_delayedBufferingTimer = new Timer(HTTP_DELAYED_BUFFERING_INTERVAL);
_delayedBufferingTimer.addEventListener(TimerEvent.TIMER, doDelayedBuffering);
_isLive = false;
_align = VideoAlign.CENTER;
_scaleMode = VideoScaleMode.MAINTAIN_ASPECT_RATIO;
_autoPlay = true;
_autoRewind = false;
_bufferTime = 0.1;
_soundTransform = new SoundTransform();
_volume = _soundTransform.volume;
__visible = true;
_contentPath = "";
waitingForEnough = false;
baselineProgressTime = NaN;
startProgressTime = NaN;
totalDownloadTime = NaN;
totalProgressTime = NaN;
}
public function get playheadTime():Number{
var _local1:Number;
_local1 = ((_ns)==null) ? _currentPos : _ns.time;
if (((!((_metadata == null))) && (!((_metadata.audiodelay == undefined))))){
_local1 = (_local1 - _metadata.audiodelay);
if (_local1 < 0){
_local1 = 0;
};
};
return (_local1);
}
public function stop():void{
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.STOP);
return;
};
execQueuedCmds();
};
};
if ((((_state == VideoState.STOPPED)) || ((_ns == null)))){
return;
};
if (_ncMgr.isRTMP){
if (((_autoRewind) && (!(_isLive)))){
_currentPos = 0;
_play(0, 0);
_state = VideoState.STOPPED;
setState(VideoState.REWINDING);
} else {
closeNS(true);
setState(VideoState.STOPPED);
};
} else {
_pause(true);
if (_autoRewind){
_seek(0);
_state = VideoState.STOPPED;
setState(VideoState.REWINDING);
} else {
setState(VideoState.STOPPED);
};
};
}
flvplayback_internal function execQueuedCmds():void{
var nextCmd:Object;
while ((((((_cmdQueue.length > 0)) && (((((stateResponsive) || ((_state == VideoState.DISCONNECTED)))) || ((_state == VideoState.CONNECTION_ERROR)))))) && (((!((_cmdQueue[0].url == null))) || (((!((_state == VideoState.DISCONNECTED))) && (!((_state == VideoState.CONNECTION_ERROR))))))))) {
try {
nextCmd = _cmdQueue.shift();
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
switch (nextCmd.type){
case QueuedCommand.PLAY:
play(nextCmd.url, nextCmd.time, nextCmd.isLive);
break;
case QueuedCommand.LOAD:
load(nextCmd.url, nextCmd.time, nextCmd.isLive);
break;
case QueuedCommand.PAUSE:
pause();
break;
case QueuedCommand.STOP:
stop();
break;
case QueuedCommand.SEEK:
seek(nextCmd.time);
break;
case QueuedCommand.PLAY_WHEN_ENOUGH:
playWhenEnoughDownloaded();
break;
};
} finally {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
};
};
};
}
public function setScale(_arg1:Number, _arg2:Number):void{
super.scaleX = _arg1;
super.scaleY = _arg2;
_registrationWidth = width;
_registrationHeight = height;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.x = _registrationX;
super.y = _registrationY;
break;
};
}
public function set playheadTime(_arg1:Number):void{
seek(_arg1);
}
override public function get videoWidth():int{
if (_videoWidth > 0){
return (_videoWidth);
};
if (((((!((_metadata == null))) && (!(isNaN(_metadata.width))))) && (!(isNaN(_metadata.height))))){
if ((((_metadata.width == _metadata.height)) && (_readyDispatched))){
return (super.videoWidth);
};
return (int(_metadata.width));
};
if (_readyDispatched){
return (super.videoWidth);
};
return (-1);
}
public function get scaleMode():String{
return (_scaleMode);
}
public function get progressInterval():Number{
return (_updateProgressTimer.delay);
}
public function set align(_arg1:String):void{
if (_align != _arg1){
switch (_arg1){
case VideoAlign.CENTER:
case VideoAlign.TOP:
case VideoAlign.LEFT:
case VideoAlign.BOTTOM:
case VideoAlign.RIGHT:
case VideoAlign.TOP_LEFT:
case VideoAlign.TOP_RIGHT:
case VideoAlign.BOTTOM_LEFT:
case VideoAlign.BOTTOM_RIGHT:
break;
default:
return;
};
_align = _arg1;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
};
}
public function set scaleMode(_arg1:String):void{
if (_scaleMode != _arg1){
switch (_arg1){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
case VideoScaleMode.EXACT_FIT:
break;
default:
return;
};
if ((((((_scaleMode == VideoScaleMode.EXACT_FIT)) && (_resizeImmediatelyOnMetadata))) && ((((_videoWidth < 0)) || ((_videoHeight < 0)))))){
_resizeImmediatelyOnMetadata = false;
};
_scaleMode = _arg1;
startAutoResize();
};
}
public function get source():String{
return (_contentPath);
}
flvplayback_internal function doUpdateTime(_arg1:TimerEvent=null):void{
var _local2:Number;
_local2 = playheadTime;
if (_local2 != _atEndCheckPlayhead){
_atEndCheckPlayhead = NaN;
};
switch (_state){
case VideoState.STOPPED:
case VideoState.PAUSED:
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_updateTimeTimer.stop();
break;
case VideoState.PLAYING:
case VideoState.BUFFERING:
if (((((((((!((_ncMgr == null))) && (!(_ncMgr.isRTMP)))) && ((_lastUpdateTime == _local2)))) && (!((_ns == null))))) && ((_ns.bytesLoaded == _ns.bytesTotal)))){
if (lastUpdateTimeStuckCount > lastUpdateTimeStuckCountMax){
lastUpdateTimeStuckCount = 0;
httpDoStopAtEnd();
} else {
lastUpdateTimeStuckCount++;
};
};
};
if (_lastUpdateTime != _local2){
dispatchEvent(new VideoEvent(VideoEvent.PLAYHEAD_UPDATE, false, false, _state, _local2));
_lastUpdateTime = _local2;
lastUpdateTimeStuckCount = 0;
};
}
flvplayback_internal function rtmpNetStatus(_arg1:NetStatusEvent):void{
if (_state == VideoState.CONNECTION_ERROR){
return;
};
switch (_arg1.info.code){
case "NetStream.Play.Stop":
if (_startingPlay){
return;
};
switch (_state){
case VideoState.RESIZING:
if (_hiddenForResize){
finishAutoResize();
};
break;
case VideoState.LOADING:
case VideoState.STOPPED:
case VideoState.PAUSED:
break;
default:
_sawPlayStop = true;
if (((!(_rtmpDoStopAtEndTimer.running)) && ((((_bufferState == BUFFER_FLUSH)) || ((((_ns.bufferTime <= 0.1)) && ((_ns.bufferLength <= 0.1)))))))){
_cachedPlayheadTime = playheadTime;
_rtmpDoStopAtEndTimer.reset();
_rtmpDoStopAtEndTimer.start();
};
break;
};
break;
case "NetStream.Buffer.Empty":
switch (_bufferState){
case BUFFER_FULL:
if (_sawPlayStop){
rtmpDoStopAtEnd();
} else {
if (_state == VideoState.PLAYING){
setState(VideoState.BUFFERING);
};
};
break;
};
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
break;
case "NetStream.Buffer.Flush":
if (((_sawSeekNotify) && ((_state == VideoState.SEEKING)))){
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
};
if (((((!(_rtmpDoStopAtEndTimer.running)) && (_sawPlayStop))) && ((((_bufferState == BUFFER_EMPTY)) || ((((_ns.bufferTime <= 0.1)) && ((_ns.bufferLength <= 0.1)))))))){
_cachedPlayheadTime = playheadTime;
_rtmpDoStopAtEndTimer.reset();
_rtmpDoStopAtEndTimer.start();
};
switch (_bufferState){
case BUFFER_EMPTY:
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
};
_bufferState = BUFFER_FLUSH;
break;
default:
if (_state == VideoState.BUFFERING){
setStateFromCachedState();
};
break;
};
break;
case "NetStream.Buffer.Full":
if (((_sawSeekNotify) && ((_state == VideoState.SEEKING)))){
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
};
switch (_bufferState){
case BUFFER_EMPTY:
_bufferState = BUFFER_FULL;
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
if (_rtmpDoStopAtEndTimer.running){
_sawPlayStop = true;
_rtmpDoStopAtEndTimer.reset();
};
};
break;
case BUFFER_FLUSH:
_bufferState = BUFFER_FULL;
if (_rtmpDoStopAtEndTimer.running){
_sawPlayStop = true;
_rtmpDoStopAtEndTimer.reset();
};
break;
};
if (_state == VideoState.BUFFERING){
setStateFromCachedState();
};
break;
case "NetStream.Pause.Notify":
if ((((_state == VideoState.RESIZING)) && (_hiddenForResize))){
finishAutoResize();
};
break;
case "NetStream.Unpause.Notify":
if (_state == VideoState.PAUSED){
_state = VideoState.PLAYING;
setState(VideoState.BUFFERING);
} else {
_cachedState = VideoState.PLAYING;
};
break;
case "NetStream.Play.Start":
_rtmpDoStopAtEndTimer.reset();
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
if (_startingPlay){
_startingPlay = false;
_cachedPlayheadTime = playheadTime;
} else {
if (_state == VideoState.PLAYING){
setState(VideoState.BUFFERING);
};
};
break;
case "NetStream.Play.Reset":
_rtmpDoStopAtEndTimer.reset();
if (_state == VideoState.REWINDING){
_rtmpDoSeekTimer.reset();
if ((((playheadTime == 0)) || ((playheadTime < _cachedPlayheadTime)))){
setStateFromCachedState();
} else {
_cachedPlayheadTime = playheadTime;
_rtmpDoSeekTimer.start();
};
};
break;
case "NetStream.Seek.Notify":
if (playheadTime != _cachedPlayheadTime){
setStateFromCachedState(false);
doUpdateTime();
execQueuedCmds();
} else {
_sawSeekNotify = true;
_rtmpDoSeekTimer.start();
};
break;
case "Netstream.Play.UnpublishNotify":
break;
case "Netstream.Play.PublishNotify":
break;
case "NetStream.Play.StreamNotFound":
if (!_ncMgr.connectAgain()){
setState(VideoState.CONNECTION_ERROR);
};
break;
case "NetStream.Play.Failed":
case "NetStream.Failed":
case "NetStream.Play.FileStructureInvalid":
case "NetStream.Play.NoSupportedTrackFound":
setState(VideoState.CONNECTION_ERROR);
break;
};
}
public function set progressInterval(_arg1:Number):void{
_updateProgressTimer.delay = _arg1;
}
flvplayback_internal function onCuePoint(_arg1:Object):void{
if (((!(_hiddenForResize)) || (((!(isNaN(_hiddenRewindPlayheadTime))) && ((playheadTime < _hiddenRewindPlayheadTime)))))){
dispatchEvent(new MetadataEvent(MetadataEvent.CUE_POINT, false, false, _arg1));
};
}
flvplayback_internal function createINCManager():void{
var theClass:Class;
theClass = null;
try {
if ((iNCManagerClass is String)){
theClass = Class(getDefinitionByName(String(iNCManagerClass)));
} else {
if ((iNCManagerClass is Class)){
theClass = Class(iNCManagerClass);
};
};
} catch(e:Error) {
theClass = null;
};
if (theClass == null){
throw (new VideoError(VideoError.INCMANAGER_CLASS_UNSET, ((iNCManagerClass)==null) ? "null" : iNCManagerClass.toString()));
};
_ncMgr = new (theClass);
_ncMgr.videoPlayer = this;
}
flvplayback_internal function doAutoResize(_arg1:TimerEvent=null):void{
var _local2:Boolean;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:Number;
if (_autoResizeTimer.running){
switch (_state){
case VideoState.RESIZING:
case VideoState.LOADING:
break;
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_autoResizeTimer.reset();
return;
default:
if (!stateResponsive){
return;
};
};
if (((((((((!((super.videoWidth == _prevVideoWidth))) || (!((super.videoHeight == _prevVideoHeight))))) || ((_bufferState == BUFFER_FULL)))) || ((_bufferState == BUFFER_FLUSH)))) || ((_ns.time > autoResizePlayheadTimeout)))){
if (((((_hiddenForResize) && (!(_ns.client.ready)))) && ((_hiddenForResizeMetadataDelay < autoResizeMetadataDelayMax)))){
_hiddenForResizeMetadataDelay++;
return;
};
_autoResizeTimer.reset();
} else {
return;
};
};
if (_autoResizeDone){
setState(_cachedState);
return;
};
oldBounds = new Rectangle(x, y, width, height);
oldRegistrationBounds = new Rectangle(registrationX, registrationY, registrationWidth, registrationHeight);
_autoResizeDone = true;
_local2 = _readyDispatched;
_readyDispatched = true;
_local3 = videoWidth;
_local4 = videoHeight;
_readyDispatched = _local2;
switch (_scaleMode){
case VideoScaleMode.NO_SCALE:
super.width = _local3;
super.height = _local4;
break;
case VideoScaleMode.EXACT_FIT:
super.width = registrationWidth;
super.height = registrationHeight;
break;
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
default:
_local5 = ((_local3 * _registrationHeight) / _local4);
_local6 = ((_local4 * _registrationWidth) / _local3);
if (_local6 < _registrationHeight){
super.width = _registrationWidth;
super.height = _local6;
} else {
if (_local5 < _registrationWidth){
super.width = _local5;
super.height = _registrationHeight;
} else {
super.width = _registrationWidth;
super.height = _registrationHeight;
};
};
};
switch (_align){
case VideoAlign.CENTER:
case VideoAlign.TOP:
case VideoAlign.BOTTOM:
default:
super.x = (_registrationX + ((_registrationWidth - width) / 2));
break;
case VideoAlign.LEFT:
case VideoAlign.TOP_LEFT:
case VideoAlign.BOTTOM_LEFT:
super.x = _registrationX;
break;
case VideoAlign.RIGHT:
case VideoAlign.TOP_RIGHT:
case VideoAlign.BOTTOM_RIGHT:
super.x = (_registrationX + (_registrationWidth - width));
break;
};
switch (_align){
case VideoAlign.CENTER:
case VideoAlign.LEFT:
case VideoAlign.RIGHT:
default:
super.y = (_registrationY + ((_registrationHeight - height) / 2));
break;
case VideoAlign.TOP:
case VideoAlign.TOP_LEFT:
case VideoAlign.TOP_RIGHT:
super.y = _registrationY;
break;
case VideoAlign.BOTTOM:
case VideoAlign.BOTTOM_LEFT:
case VideoAlign.BOTTOM_RIGHT:
super.y = (_registrationY + (_registrationHeight - height));
break;
};
if (_hiddenForResize){
_hiddenRewindPlayheadTime = playheadTime;
if (_state == VideoState.LOADING){
_cachedState = VideoState.PLAYING;
};
if (!_ncMgr.isRTMP){
_pause(true);
_seek(0);
_finishAutoResizeTimer.reset();
_finishAutoResizeTimer.start();
} else {
if (!_isLive){
_currentPos = 0;
_play(0, 0);
setState(VideoState.RESIZING);
} else {
if (_autoPlay){
_finishAutoResizeTimer.reset();
_finishAutoResizeTimer.start();
} else {
finishAutoResize();
};
};
};
} else {
dispatchEvent(new AutoLayoutEvent(AutoLayoutEvent.AUTO_LAYOUT, false, false, oldBounds, oldRegistrationBounds));
};
}
public function get totalTime():Number{
return (_streamLength);
}
public function get ncMgr():INCManager{
if (_ncMgr == null){
createINCManager();
};
return (_ncMgr);
}
public function set volume(_arg1:Number):void{
var _local2:SoundTransform;
_local2 = soundTransform;
_local2.volume = _arg1;
soundTransform = _local2;
}
flvplayback_internal function _play(_arg1:int=0, _arg2:int=-1):void{
waitingForEnough = false;
_rtmpDoStopAtEndTimer.reset();
_startingPlay = true;
_ns.play(_ncMgr.streamName, (_isLive) ? -1 : _arg1, _arg2);
}
flvplayback_internal function finishAutoResize(_arg1:TimerEvent=null):void{
if (stateResponsive){
return;
};
_hiddenForResize = false;
super.visible = __visible;
volume = _volume;
dispatchEvent(new AutoLayoutEvent(AutoLayoutEvent.AUTO_LAYOUT, false, false, oldBounds, oldRegistrationBounds));
if (_autoPlay){
if (_ncMgr.isRTMP){
if (!_isLive){
_currentPos = 0;
_play(0);
};
if (_state == VideoState.RESIZING){
setState(VideoState.LOADING);
_cachedState = VideoState.PLAYING;
};
} else {
waitingForEnough = true;
_cachedState = _state;
_state = VideoState.PAUSED;
checkReadyForPlay(bytesLoaded, bytesTotal);
if (waitingForEnough){
_state = _cachedState;
setState(VideoState.PAUSED);
} else {
_cachedState = VideoState.PLAYING;
};
};
} else {
setState(VideoState.STOPPED);
};
}
public function set soundTransform(_arg1:SoundTransform):void{
if (_arg1 == null){
return;
};
if (_hiddenForResize){
_volume = _arg1.volume;
};
_soundTransform = new SoundTransform();
_soundTransform.volume = (_hiddenForResize) ? 0 : _arg1.volume;
_soundTransform.leftToLeft = _arg1.leftToLeft;
_soundTransform.leftToRight = _arg1.leftToRight;
_soundTransform.rightToLeft = _arg1.rightToLeft;
_soundTransform.rightToRight = _arg1.rightToRight;
if (_ns != null){
_ns.soundTransform = _soundTransform;
};
}
flvplayback_internal function httpDoSeek(_arg1:TimerEvent):void{
var _local2:Boolean;
_local2 = (((_state == VideoState.REWINDING)) || ((_state == VideoState.SEEKING)));
if (((((_local2) && ((_httpDoSeekCount < httpDoSeekMaxCount)))) && ((((_cachedPlayheadTime == playheadTime)) || (_invalidSeekTime))))){
_httpDoSeekCount++;
return;
};
_httpDoSeekCount = 0;
_httpDoSeekTimer.reset();
if (!_local2){
return;
};
setStateFromCachedState(false);
if (_invalidSeekTime){
_invalidSeekTime = false;
_invalidSeekRecovery = true;
seek(playheadTime);
} else {
doUpdateTime();
_lastSeekTime = playheadTime;
execQueuedCmds();
};
}
public function get bytesLoaded():uint{
if ((((_ns == null)) || (_ncMgr.isRTMP))){
return (uint.MIN_VALUE);
};
return (_ns.bytesLoaded);
}
override public function set height(_arg1:Number):void{
super.height = (_registrationHeight = _arg1);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.height = _arg1;
break;
};
}
flvplayback_internal function httpNetStatus(_arg1:NetStatusEvent):void{
switch (_arg1.info.code){
case "NetStream.Play.Stop":
_delayedBufferingTimer.reset();
if (_invalidSeekTime){
_invalidSeekTime = false;
_invalidSeekRecovery = true;
setState(_cachedState);
seek(playheadTime);
} else {
switch (_state){
case VideoState.SEEKING:
httpDoSeek(null);
case VideoState.PLAYING:
case VideoState.BUFFERING:
httpDoStopAtEnd();
break;
};
};
break;
case "NetStream.Seek.InvalidTime":
if (_invalidSeekRecovery){
_invalidSeekTime = false;
_invalidSeekRecovery = false;
setState(_cachedState);
seek(0);
} else {
_invalidSeekTime = true;
_httpDoSeekCount = 0;
_httpDoSeekTimer.start();
};
break;
case "NetStream.Buffer.Empty":
_bufferState = BUFFER_EMPTY;
if (_state == VideoState.PLAYING){
_delayedBufferingTimer.reset();
_delayedBufferingTimer.start();
};
break;
case "NetStream.Buffer.Full":
case "NetStream.Buffer.Flush":
_delayedBufferingTimer.reset();
_bufferState = BUFFER_FULL;
if (!_hiddenForResize){
if ((((((_state == VideoState.LOADING)) && ((_cachedState == VideoState.PLAYING)))) || ((_state == VideoState.BUFFERING)))){
setState(VideoState.PLAYING);
} else {
if (_cachedState == VideoState.BUFFERING){
_cachedState = VideoState.PLAYING;
};
};
};
break;
case "NetStream.Seek.Notify":
_invalidSeekRecovery = false;
switch (_state){
case VideoState.SEEKING:
case VideoState.REWINDING:
_httpDoSeekCount = 0;
_httpDoSeekTimer.start();
break;
};
break;
case "NetStream.Play.StreamNotFound":
case "NetStream.Play.FileStructureInvalid":
case "NetStream.Play.NoSupportedTrackFound":
setState(VideoState.CONNECTION_ERROR);
break;
};
}
public function get netConnection():NetConnection{
if (_ncMgr != null){
return (_ncMgr.netConnection);
};
return (null);
}
public function set bufferTime(_arg1:Number):void{
_bufferTime = _arg1;
if (_ns != null){
_ns.bufferTime = _bufferTime;
};
}
flvplayback_internal function onMetaData(_arg1:Object):void{
if (_metadata != null){
return;
};
_metadata = _arg1;
if (isNaN(_streamLength)){
_streamLength = _arg1.duration;
};
if (((_resizeImmediatelyOnMetadata) && (_ns.client.ready))){
_resizeImmediatelyOnMetadata = false;
_autoResizeTimer.reset();
_autoResizeDone = false;
doAutoResize();
};
dispatchEvent(new MetadataEvent(MetadataEvent.METADATA_RECEIVED, false, false, _arg1));
}
flvplayback_internal function queueCmd(_arg1:Number, _arg2:String=null, _arg3:Boolean=false, _arg4:Number=NaN):void{
_cmdQueue.push(new QueuedCommand(_arg1, _arg2, _arg3, _arg4));
}
public function set registrationHeight(_arg1:Number):void{
height = _arg1;
}
override public function get visible():Boolean{
if (!_hiddenForResize){
__visible = super.visible;
};
return (__visible);
}
public function seek(_arg1:Number):void{
if (_invalidSeekTime){
return;
};
if (((isNaN(_arg1)) || ((_arg1 < 0)))){
throw (new VideoError(VideoError.INVALID_SEEK));
};
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
flushQueuedCmds();
queueCmd(QueuedCommand.SEEK, null, false, _arg1);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
_ncMgr.reconnect();
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.SEEK, null, false, _arg1);
return;
};
execQueuedCmds();
};
};
if (_ns == null){
_createStream();
};
if (((_atEnd) && ((_arg1 < playheadTime)))){
_atEnd = false;
};
switch (_state){
case VideoState.PLAYING:
_state = VideoState.BUFFERING;
case VideoState.BUFFERING:
case VideoState.PAUSED:
_seek(_arg1);
setState(VideoState.SEEKING);
break;
case VideoState.STOPPED:
if (_ncMgr.isRTMP){
_play(0);
_pause(true);
};
_seek(_arg1);
_state = VideoState.PAUSED;
setState(VideoState.SEEKING);
break;
};
}
public function get state():String{
return (_state);
}
public function set autoRewind(_arg1:Boolean):void{
_autoRewind = _arg1;
}
override public function set scaleX(_arg1:Number):void{
super.scaleX = _arg1;
_registrationWidth = width;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
}
override public function set scaleY(_arg1:Number):void{
super.scaleY = _arg1;
_registrationHeight = height;
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
};
}
public function get registrationWidth():Number{
return (_registrationWidth);
}
flvplayback_internal function flushQueuedCmds():void{
while (_cmdQueue.length > 0) {
_cmdQueue.pop();
};
}
public function get registrationX():Number{
return (_registrationX);
}
flvplayback_internal function _setUpStream():void{
if (((!(isNaN(_ncMgr.streamLength))) && ((_ncMgr.streamLength >= 0)))){
_streamLength = _ncMgr.streamLength;
};
_videoWidth = ((_ncMgr.streamWidth)>=0) ? _ncMgr.streamWidth : -1;
_videoHeight = ((_ncMgr.streamHeight)>=0) ? _ncMgr.streamHeight : -1;
_resizeImmediatelyOnMetadata = (((((_videoWidth >= 0)) && ((_videoHeight >= 0)))) || ((_scaleMode == VideoScaleMode.EXACT_FIT)));
if (!_hiddenForResize){
__visible = super.visible;
super.visible = false;
_volume = volume;
volume = 0;
_hiddenForResize = true;
};
_hiddenForResizeMetadataDelay = 0;
_play(0);
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
};
_autoResizeTimer.reset();
_autoResizeTimer.start();
}
public function get registrationY():Number{
return (_registrationY);
}
flvplayback_internal function httpDoStopAtEnd():void{
if ((((((_atEndCheckPlayhead == playheadTime)) && (!((_atEndCheckPlayhead == _lastUpdateTime))))) && (!((playheadTime == 0))))){
_atEnd = false;
_seek(0);
return;
};
_atEndCheckPlayhead = NaN;
_atEnd = true;
if (isNaN(_streamLength)){
_streamLength = _ns.time;
};
_pause(true);
setState(VideoState.STOPPED);
if (_state != VideoState.STOPPED){
return;
};
doUpdateTime();
if (_state != VideoState.STOPPED){
return;
};
dispatchEvent(new VideoEvent(VideoEvent.COMPLETE, false, false, _state, playheadTime));
if (_state != VideoState.STOPPED){
return;
};
if (_autoRewind){
_atEnd = false;
_pause(true);
_seek(0);
setState(VideoState.REWINDING);
};
}
public function ncConnected():void{
if ((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))){
setState(VideoState.CONNECTION_ERROR);
} else {
if (_ns == null){
_createStream();
_setUpStream();
};
};
}
override public function set visible(_arg1:Boolean):void{
__visible = _arg1;
if (!_hiddenForResize){
super.visible = __visible;
};
}
public function load(_arg1:String, _arg2:Number=NaN, _arg3:Boolean=false):void{
if (_arg1 == null){
throw (new VideoError(VideoError.NULL_URL_LOAD));
};
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (((((!(stateResponsive)) && (!((_state == VideoState.DISCONNECTED))))) && (!((_state == VideoState.CONNECTION_ERROR))))){
queueCmd(QueuedCommand.LOAD, _arg1, _arg3, _arg2);
return;
};
execQueuedCmds();
};
_autoPlay = false;
_load(_arg1, _arg2, _arg3);
}
override public function set x(_arg1:Number):void{
var _local2:Number;
if (this.x != _arg1){
_local2 = (_arg1 - this.x);
super.x = _arg1;
_registrationX = (_registrationX + _local2);
};
}
override public function set y(_arg1:Number):void{
var _local2:Number;
if (this.y != _arg1){
_local2 = (_arg1 - this.y);
super.y = _arg1;
_registrationY = (_registrationY + _local2);
};
}
flvplayback_internal function _pause(_arg1:Boolean):void{
_atEndCheckPlayhead = playheadTime;
_rtmpDoStopAtEndTimer.reset();
if (_arg1){
_ns.pause();
} else {
_ns.resume();
};
}
public function get playheadUpdateInterval():Number{
return (_updateTimeTimer.delay);
}
flvplayback_internal function doDelayedBuffering(_arg1:TimerEvent):void{
switch (_state){
case VideoState.LOADING:
case VideoState.RESIZING:
break;
case VideoState.PLAYING:
_delayedBufferingTimer.reset();
if (((((((((!(isNaN(totalTime))) && ((totalTime > 0)))) && ((bytesLoaded > 0)))) && ((bytesLoaded < uint.MAX_VALUE)))) && ((bytesLoaded < bytesTotal)))){
pause();
if (_state == VideoState.PAUSED){
waitingForEnough = true;
playWhenEnoughDownloaded();
};
} else {
setState(VideoState.BUFFERING);
};
break;
default:
_delayedBufferingTimer.reset();
break;
};
}
flvplayback_internal function createNetStreamClient():Object{
var theClass:Class;
var theInst:Object;
theClass = null;
theInst = null;
try {
if ((netStreamClientClass is String)){
theClass = Class(getDefinitionByName(String(netStreamClientClass)));
} else {
if ((netStreamClientClass is Class)){
theClass = Class(netStreamClientClass);
};
};
if (theClass != null){
theInst = new theClass(this);
};
} catch(e:Error) {
theClass = null;
theInst = null;
};
if (theInst == null){
throw (new VideoError(VideoError.NETSTREAM_CLIENT_CLASS_UNSET, ((netStreamClientClass)==null) ? "null" : netStreamClientClass.toString()));
};
return (theInst);
}
public function get align():String{
return (_align);
}
public function set registrationWidth(_arg1:Number):void{
width = _arg1;
}
public function get stateResponsive():Boolean{
switch (_state){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
return (true);
default:
return (false);
};
}
public function get volume():Number{
return (soundTransform.volume);
}
public function get soundTransform():SoundTransform{
var _local1:SoundTransform;
if (_ns != null){
_soundTransform = _ns.soundTransform;
};
_local1 = new SoundTransform();
_local1.volume = (_hiddenForResize) ? _volume : _soundTransform.volume;
_local1.leftToLeft = _soundTransform.leftToLeft;
_local1.leftToRight = _soundTransform.leftToRight;
_local1.rightToLeft = _soundTransform.rightToLeft;
_local1.rightToRight = _soundTransform.rightToRight;
return (_local1);
}
public function get bufferTime():Number{
if (_ns != null){
_bufferTime = _ns.bufferTime;
};
return (_bufferTime);
}
public function get metadata():Object{
return (_metadata);
}
public function play(_arg1:String=null, _arg2:Number=NaN, _arg3:Boolean=false):void{
if (_arg1 != null){
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (((((!(stateResponsive)) && (!((_state == VideoState.DISCONNECTED))))) && (!((_state == VideoState.CONNECTION_ERROR))))){
queueCmd(QueuedCommand.PLAY, _arg1, _arg3, _arg2);
return;
};
execQueuedCmds();
};
_autoPlay = true;
_load(_arg1, _arg2, _arg3);
return;
};
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
flushQueuedCmds();
queueCmd(QueuedCommand.PLAY);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
_ncMgr.reconnect();
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PLAY);
return;
};
execQueuedCmds();
};
};
if (_ns == null){
_createStream();
};
switch (_state){
case VideoState.BUFFERING:
if (_ncMgr.isRTMP){
_play(0);
if (_atEnd){
_atEnd = false;
_currentPos = 0;
setState(VideoState.REWINDING);
} else {
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
};
};
};
case VideoState.PLAYING:
return;
case VideoState.STOPPED:
if (_ncMgr.isRTMP){
if (_isLive){
_play(-1);
setState(VideoState.BUFFERING);
} else {
_play(0);
if (_atEnd){
_atEnd = false;
_currentPos = 0;
_state = VideoState.BUFFERING;
setState(VideoState.REWINDING);
} else {
if (_currentPos > 0){
_seek(_currentPos);
_currentPos = 0;
setState(VideoState.BUFFERING);
} else {
setState(VideoState.BUFFERING);
};
};
};
} else {
_pause(false);
if (_atEnd){
_atEnd = false;
_seek(0);
_state = VideoState.BUFFERING;
setState(VideoState.REWINDING);
} else {
if (_bufferState == BUFFER_EMPTY){
setState(VideoState.BUFFERING);
} else {
setState(VideoState.PLAYING);
};
};
};
break;
case VideoState.PAUSED:
_pause(false);
if (!_ncMgr.isRTMP){
if (_bufferState == BUFFER_EMPTY){
setState(VideoState.BUFFERING);
} else {
setState(VideoState.PLAYING);
};
} else {
setState(VideoState.BUFFERING);
};
break;
};
}
public function get isLive():Boolean{
return (_isLive);
}
flvplayback_internal function setStateFromCachedState(_arg1:Boolean=true):void{
switch (_cachedState){
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
setState(_cachedState, _arg1);
break;
default:
setState(VideoState.STOPPED, _arg1);
break;
};
}
public function get idleTimeout():Number{
return (_idleTimeoutTimer.delay);
}
public function get registrationHeight():Number{
return (_registrationHeight);
}
public function ncReconnected():void{
if ((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))){
setState(VideoState.CONNECTION_ERROR);
} else {
_ns = null;
_state = VideoState.STOPPED;
execQueuedCmds();
};
}
flvplayback_internal function startAutoResize():void{
switch (_state){
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
return;
default:
if (_ns == null){
return;
};
_autoResizeDone = false;
if (((stateResponsive) && (((((((((!((super.videoWidth == 0))) || (!((super.videoHeight == 0))))) || ((_bufferState == BUFFER_FULL)))) || ((_bufferState == BUFFER_FLUSH)))) || ((_ns.time > autoResizePlayheadTimeout)))))){
doAutoResize();
} else {
_autoResizeTimer.reset();
_autoResizeTimer.start();
};
break;
};
}
flvplayback_internal function setState(_arg1:String, _arg2:Boolean=true):void{
var _local3:String;
if (_arg1 == _state){
return;
};
_hiddenRewindPlayheadTime = NaN;
_cachedState = _state;
_cachedPlayheadTime = playheadTime;
_state = _arg1;
_local3 = _state;
dispatchEvent(new VideoEvent(VideoEvent.STATE_CHANGE, false, false, _local3, playheadTime));
if (!_readyDispatched){
switch (_local3){
case VideoState.STOPPED:
case VideoState.PLAYING:
case VideoState.PAUSED:
case VideoState.BUFFERING:
_readyDispatched = true;
dispatchEvent(new VideoEvent(VideoEvent.READY, false, false, _local3, playheadTime));
break;
};
};
switch (_cachedState){
case VideoState.REWINDING:
dispatchEvent(new VideoEvent(VideoEvent.AUTO_REWOUND, false, false, _local3, playheadTime));
if (((_ncMgr.isRTMP) && ((_local3 == VideoState.STOPPED)))){
closeNS();
};
break;
};
switch (_local3){
case VideoState.STOPPED:
case VideoState.PAUSED:
if (_ncMgr.isRTMP){
_idleTimeoutTimer.reset();
_idleTimeoutTimer.start();
};
break;
case VideoState.SEEKING:
case VideoState.REWINDING:
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_idleTimeoutTimer.reset();
break;
case VideoState.PLAYING:
case VideoState.BUFFERING:
_updateTimeTimer.start();
_idleTimeoutTimer.reset();
break;
case VideoState.LOADING:
case VideoState.RESIZING:
_idleTimeoutTimer.reset();
break;
};
if (_arg2){
execQueuedCmds();
};
}
flvplayback_internal function _seek(_arg1:Number):void{
_rtmpDoStopAtEndTimer.reset();
if (((((!((_metadata == null))) && (!((_metadata.audiodelay == undefined))))) && (((isNaN(_streamLength)) || (((_arg1 + _metadata.audiodelay) < _streamLength)))))){
_arg1 = (_arg1 + _metadata.audiodelay);
};
_ns.seek(_arg1);
_lastSeekTime = _arg1;
_invalidSeekTime = false;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_sawSeekNotify = false;
}
public function get autoRewind():Boolean{
return (_autoRewind);
}
flvplayback_internal function doIdleTimeout(_arg1:TimerEvent):void{
close();
}
public function playWhenEnoughDownloaded():void{
if (((!((_ncMgr == null))) && (_ncMgr.isRTMP))){
play();
return;
};
if (!isXnOK()){
throw (new VideoError(VideoError.NO_CONNECTION));
};
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PLAY_WHEN_ENOUGH);
return;
};
execQueuedCmds();
};
waitingForEnough = true;
checkReadyForPlay(bytesLoaded, bytesTotal);
}
flvplayback_internal function rtmpDoSeek(_arg1:TimerEvent):void{
if (((!((_state == VideoState.REWINDING))) && (!((_state == VideoState.SEEKING))))){
_rtmpDoSeekTimer.reset();
_sawSeekNotify = false;
} else {
if (playheadTime != _cachedPlayheadTime){
_rtmpDoSeekTimer.reset();
_sawSeekNotify = false;
setStateFromCachedState(false);
doUpdateTime();
_lastSeekTime = playheadTime;
execQueuedCmds();
};
};
}
public function get netStream():NetStream{
return (_ns);
}
override public function get videoHeight():int{
if (_videoHeight > 0){
return (_videoHeight);
};
if (((((!((_metadata == null))) && (!(isNaN(_metadata.width))))) && (!(isNaN(_metadata.height))))){
if ((((_metadata.width == _metadata.height)) && (_readyDispatched))){
return (super.videoHeight);
};
return (int(_metadata.height));
};
if (_readyDispatched){
return (super.videoHeight);
};
return (-1);
}
public function set registrationX(_arg1:Number):void{
var _local2:Number;
if (_registrationX != _arg1){
_local2 = (_arg1 - _registrationX);
_registrationX = _arg1;
this.x = (this.x + _local2);
};
}
public function set registrationY(_arg1:Number):void{
var _local2:Number;
if (_registrationY != _arg1){
_local2 = (_arg1 - _registrationY);
_registrationY = _arg1;
this.y = (this.y + _local2);
};
}
flvplayback_internal function doUpdateProgress(_arg1:TimerEvent):void{
var _local2:uint;
var _local3:uint;
if (_ns == null){
return;
};
_local2 = _ns.bytesLoaded;
_local3 = _ns.bytesTotal;
if (_local3 < uint.MAX_VALUE){
dispatchEvent(new VideoProgressEvent(VideoProgressEvent.PROGRESS, false, false, _local2, _local3));
};
if ((((((_state == VideoState.DISCONNECTED)) || ((_state == VideoState.CONNECTION_ERROR)))) || ((_local2 >= _local3)))){
_updateProgressTimer.stop();
};
checkEnoughDownloaded(_local2, _local3);
}
override public function set width(_arg1:Number):void{
super.width = (_registrationWidth = _arg1);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.width = _arg1;
break;
};
}
public function get isRTMP():Boolean{
if (_ncMgr == null){
return (false);
};
return (_ncMgr.isRTMP);
}
public function get bytesTotal():uint{
if ((((_ns == null)) || (_ncMgr.isRTMP))){
return (uint.MAX_VALUE);
};
return (_ns.bytesTotal);
}
public function setSize(_arg1:Number, _arg2:Number):void{
super.width = (_registrationWidth = _arg1);
super.height = (_registrationHeight = _arg2);
switch (_scaleMode){
case VideoScaleMode.MAINTAIN_ASPECT_RATIO:
case VideoScaleMode.NO_SCALE:
startAutoResize();
break;
default:
super.x = _registrationX;
super.y = _registrationY;
break;
};
}
flvplayback_internal function isXnOK():Boolean{
if (_state == VideoState.LOADING){
return (true);
};
if (_state == VideoState.CONNECTION_ERROR){
return (false);
};
if (_state != VideoState.DISCONNECTED){
if ((((((_ncMgr == null)) || ((_ncMgr.netConnection == null)))) || (((_ncMgr.isRTMP) && (!(_ncMgr.netConnection.connected)))))){
setState(VideoState.DISCONNECTED);
return (false);
};
return (true);
};
return (false);
}
flvplayback_internal function _createStream():void{
var _local1:NetStream;
_ns = null;
_local1 = new NetStream(_ncMgr.netConnection);
if (_ncMgr.isRTMP){
_local1.addEventListener(NetStatusEvent.NET_STATUS, rtmpNetStatus);
} else {
_local1.addEventListener(NetStatusEvent.NET_STATUS, httpNetStatus);
};
_local1.client = createNetStreamClient();
_local1.bufferTime = _bufferTime;
_local1.soundTransform = soundTransform;
_ns = _local1;
attachNetStream(_ns);
}
flvplayback_internal function checkReadyForPlay(_arg1:uint, _arg2:uint):void{
var _local3:Number;
if (_arg1 >= _arg2){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
return;
};
if (isNaN(baselineProgressTime)){
return;
};
if (((isNaN(totalTime)) || ((totalTime < 0)))){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
} else {
if (totalDownloadTime > 1.5){
_local3 = ((totalProgressTime - baselineProgressTime) / totalDownloadTime);
if ((totalTime - playheadTime) > ((totalTime - totalProgressTime) / _local3)){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
};
};
}
flvplayback_internal function closeNS(_arg1:Boolean=false):void{
if (_ns != null){
if (_arg1){
doUpdateTime();
_currentPos = _ns.time;
};
_updateTimeTimer.reset();
_updateProgressTimer.reset();
_idleTimeoutTimer.reset();
_autoResizeTimer.reset();
_rtmpDoStopAtEndTimer.reset();
_rtmpDoSeekTimer.reset();
_httpDoSeekTimer.reset();
_finishAutoResizeTimer.reset();
_delayedBufferingTimer.reset();
_ns.removeEventListener(NetStatusEvent.NET_STATUS, rtmpNetStatus);
_ns.removeEventListener(NetStatusEvent.NET_STATUS, httpNetStatus);
_ns.close();
_ns = null;
};
}
flvplayback_internal function _load(_arg1:String, _arg2:Number, _arg3:Boolean):void{
var _local4:Boolean;
_prevVideoWidth = super.videoWidth;
_prevVideoHeight = super.videoHeight;
_autoResizeDone = false;
_cachedPlayheadTime = 0;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_metadata = null;
_startingPlay = false;
_invalidSeekTime = false;
_invalidSeekRecovery = false;
_isLive = _arg3;
_contentPath = _arg1;
_currentPos = 0;
_streamLength = (((isNaN(_arg2)) || ((_arg2 <= 0)))) ? NaN : _arg2;
_atEnd = false;
_readyDispatched = false;
_lastUpdateTime = NaN;
lastUpdateTimeStuckCount = 0;
_sawSeekNotify = false;
waitingForEnough = false;
baselineProgressTime = NaN;
startProgressTime = NaN;
totalDownloadTime = NaN;
totalProgressTime = NaN;
_httpDoSeekCount = 0;
_updateTimeTimer.reset();
_updateProgressTimer.reset();
_idleTimeoutTimer.reset();
_autoResizeTimer.reset();
_rtmpDoStopAtEndTimer.reset();
_rtmpDoSeekTimer.reset();
_httpDoSeekTimer.reset();
_finishAutoResizeTimer.reset();
_delayedBufferingTimer.reset();
closeNS(false);
if (_ncMgr == null){
createINCManager();
};
_local4 = _ncMgr.connectToURL(_contentPath);
setState(VideoState.LOADING);
_cachedState = VideoState.LOADING;
if (_local4){
_createStream();
_setUpStream();
};
if (!_ncMgr.isRTMP){
_updateProgressTimer.start();
};
}
flvplayback_internal function rtmpDoStopAtEnd(_arg1:TimerEvent=null):void{
if (_rtmpDoStopAtEndTimer.running){
switch (_state){
case VideoState.DISCONNECTED:
case VideoState.CONNECTION_ERROR:
_rtmpDoStopAtEndTimer.reset();
return;
};
if ((((_arg1 == null)) || ((_cachedPlayheadTime == playheadTime)))){
_rtmpDoStopAtEndTimer.reset();
} else {
_cachedPlayheadTime = playheadTime;
return;
};
};
if ((((((((_atEndCheckPlayhead == playheadTime)) && (!((_atEndCheckPlayhead == _lastSeekTime))))) && (!(_isLive)))) && (!((playheadTime == 0))))){
_atEnd = false;
_currentPos = 0;
_play(0);
return;
};
_atEndCheckPlayhead = NaN;
_bufferState = BUFFER_EMPTY;
_sawPlayStop = false;
_atEnd = true;
setState(VideoState.STOPPED);
if (_state != VideoState.STOPPED){
return;
};
doUpdateTime();
if (_state != VideoState.STOPPED){
return;
};
dispatchEvent(new VideoEvent(VideoEvent.COMPLETE, false, false, _state, playheadTime));
if (_state != VideoState.STOPPED){
return;
};
if (((((_autoRewind) && (!(_isLive)))) && (!((playheadTime == 0))))){
_atEnd = false;
_currentPos = 0;
_play(0, 0);
setState(VideoState.REWINDING);
} else {
closeNS();
};
}
public function set idleTimeout(_arg1:Number):void{
_idleTimeoutTimer.delay = _arg1;
}
public function set playheadUpdateInterval(_arg1:Number):void{
_updateTimeTimer.delay = _arg1;
}
flvplayback_internal function checkEnoughDownloaded(_arg1:uint, _arg2:uint):void{
if ((((_arg1 == 0)) || ((_arg2 == uint.MAX_VALUE)))){
return;
};
if (((isNaN(totalTime)) || ((totalTime <= 0)))){
if (((waitingForEnough) && (stateResponsive))){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
return;
};
if (_arg1 >= _arg2){
if (waitingForEnough){
waitingForEnough = false;
_cachedState = _state;
_state = VideoState.EXEC_QUEUED_CMD;
play();
execQueuedCmds();
};
return;
};
if (isNaN(baselineProgressTime)){
baselineProgressTime = ((_arg1 / _arg2) * totalTime);
};
if (isNaN(startProgressTime)){
startProgressTime = getTimer();
} else {
totalDownloadTime = ((getTimer() - startProgressTime) / 1000);
totalProgressTime = ((_arg1 / _arg2) * totalTime);
if (waitingForEnough){
checkReadyForPlay(_arg1, _arg2);
};
};
}
public function close():void{
closeNS(true);
if (((!((_ncMgr == null))) && (_ncMgr.isRTMP))){
_ncMgr.close();
};
setState(VideoState.DISCONNECTED);
dispatchEvent(new VideoEvent(VideoEvent.CLOSE, false, false, _state, playheadTime));
}
public function pause():void{
if (!isXnOK()){
if ((((((_state == VideoState.CONNECTION_ERROR)) || ((_ncMgr == null)))) || ((_ncMgr.netConnection == null)))){
throw (new VideoError(VideoError.NO_CONNECTION));
};
return;
} else {
if (_state == VideoState.EXEC_QUEUED_CMD){
_state = _cachedState;
} else {
if (!stateResponsive){
queueCmd(QueuedCommand.PAUSE);
return;
};
execQueuedCmds();
};
};
if ((((((_state == VideoState.PAUSED)) || ((_state == VideoState.STOPPED)))) || ((_ns == null)))){
return;
};
_pause(true);
setState(VideoState.PAUSED);
}
}
}//package fl.video
Section 60
//VideoPlayerClient (fl.video.VideoPlayerClient)
package fl.video {
public dynamic class VideoPlayerClient {
protected var _owner:VideoPlayer;
protected var gotMetadata:Boolean;
public function VideoPlayerClient(_arg1:VideoPlayer){
_owner = _arg1;
gotMetadata = false;
}
public function get ready():Boolean{
return (gotMetadata);
}
public function onMetaData(_arg1:Object, ... _args):void{
_arg1.duration;
_arg1.width;
_arg1.height;
_owner.onMetaData(_arg1);
gotMetadata = true;
}
public function get owner():VideoPlayer{
return (_owner);
}
public function onCuePoint(_arg1:Object, ... _args):void{
_arg1.name;
_arg1.time;
_arg1.type;
_owner.onCuePoint(_arg1);
}
}
}//package fl.video
Section 61
//VideoPlayerState (fl.video.VideoPlayerState)
package fl.video {
public class VideoPlayerState {
public var autoPlay:Boolean;
public var isWaiting:Boolean;
public var isLiveSet:Boolean;
public var index:int;
public var prevState:String;
public var preSeekTime:Number;
public var minProgressPercent:Number;
public var url:String;
public var totalTime:Number;
public var owner:VideoPlayer;
public var isLive:Boolean;
public var cmdQueue:Array;
public var totalTimeSet:Boolean;
public function VideoPlayerState(_arg1:VideoPlayer, _arg2:int){
this.owner = _arg1;
this.index = _arg2;
this.url = "";
this.isLive = false;
this.isLiveSet = true;
this.totalTime = NaN;
this.totalTimeSet = true;
this.autoPlay = (_arg2 == 0);
this.isWaiting = false;
this.preSeekTime = NaN;
this.cmdQueue = null;
}
}
}//package fl.video
Section 62
//VideoProgressEvent (fl.video.VideoProgressEvent)
package fl.video {
import flash.events.*;
public class VideoProgressEvent extends ProgressEvent implements IVPEvent {
private var _vp:uint;
public static const PROGRESS:String = "progress";
public function VideoProgressEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:uint=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
_vp = _arg6;
}
override public function clone():Event{
return (new VideoProgressEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, vp));
}
public function set vp(_arg1:uint):void{
_vp = _arg1;
}
public function get vp():uint{
return (_vp);
}
}
}//package fl.video
Section 63
//VideoScaleMode (fl.video.VideoScaleMode)
package fl.video {
public final class VideoScaleMode {
public static const EXACT_FIT:String = "exactFit";
public static const MAINTAIN_ASPECT_RATIO:String = "maintainAspectRatio";
public static const NO_SCALE:String = "noScale";
}
}//package fl.video
Section 64
//VideoState (fl.video.VideoState)
package fl.video {
public final class VideoState {
public static const CONNECTION_ERROR:String = "connectionError";
public static const BUFFERING:String = "buffering";
public static const SEEKING:String = "seeking";
public static const STOPPED:String = "stopped";
public static const PAUSED:String = "paused";
public static const RESIZING:String = "resizing";
public static const PLAYING:String = "playing";
public static const DISCONNECTED:String = "disconnected";
public static const LOADING:String = "loading";
public static const REWINDING:String = "rewinding";
flvplayback_internal static var EXEC_QUEUED_CMD:String = "execQueuedCmd";
}
}//package fl.video
Section 65
//BigPlayBt (player.BigPlayBt)
package player {
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
import fl.transitions.easing.*;
public class BigPlayBt extends MovieClip {
private var tween:Tween;
private var tween2:Tween;
public function BigPlayBt(){
super();
this.addEventListener(MouseEvent.CLICK, _mouseEventClick);
this.addEventListener(Event.ADDED_TO_STAGE, Init);
this.visible = false;
}
private function Init(e:Event):void{
ReDraw();
}
private function _mouseEventClick(e:Event):void{
var event:Event = new Event(ToolBar.PLAY_PRESSED);
dispatchEvent(event);
this.visible = false;
}
public function ReDraw():void{
this.x = Math.round((this.stage.stageWidth / 2));
this.y = Math.round((this.stage.stageHeight / 2));
}
public function Hide():void{
this.visible = false;
}
public function Display():void{
this.visible = true;
tween = new Tween(this, "scaleX", Bounce.easeOut, 0.01, 1, 1, true);
tween2 = new Tween(this, "scaleY", Bounce.easeOut, 0.01, 1, 1, true);
}
}
}//package player
Section 66
//Buffering (player.Buffering)
package player {
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
import flash.text.*;
import fl.motion.easing.*;
public class Buffering extends MovieClip {
public var buff_text:TextField;
private var thetween:Tween;// = null
private var thetween2:Tween;// = null
private var CurStatus:String;// = "notvisible"
private static const VISIBLE = "visible";
private static const NOTVISIBLE = "notvisible";
public function Buffering(){
super();
addFrameScript(0, frame1);
stop();
this.addEventListener(Event.ADDED_TO_STAGE, CreateBuffer);
}
public function updateBuffering(event){
buff_text.text = (this.currentFrame + " %");
}
private function CreateBuffer(e:Event):void{
trace("Buffering CreateBuffer");
this.removeEventListener(Event.ADDED_TO_STAGE, CreateBuffer);
this.visible = false;
ReDraw();
}
public function ReDraw():void{
this.x = Math.round((this.stage.stageWidth / 2));
this.y = Math.round((this.stage.stageHeight / 2));
}
public function GoAppear():void{
if (CurStatus == NOTVISIBLE){
SetProgression(0);
thetween = new Tween(this, "scaleX", Elastic.easeOut, 0, 1, 1, true);
thetween2 = new Tween(this, "scaleY", Elastic.easeOut, 0, 1, 1, true);
this.visible = true;
CurStatus = VISIBLE;
};
}
public function Desappear():void{
if (CurStatus == VISIBLE){
if (thetween != null){
thetween.stop();
thetween2.stop();
};
thetween = new Tween(this, "scaleX", Elastic.easeOut, 1, 0, 1, true);
thetween2 = new Tween(this, "scaleY", Elastic.easeOut, 1, 0, 1, true);
CurStatus = NOTVISIBLE;
};
}
public function SetProgression(value:Number):void{
if (value > 100){
value = 100;
};
if (value < 0){
value = 0;
};
this.gotoAndStop(value);
}
function frame1(){
this.addEventListener(Event.ENTER_FRAME, updateBuffering);
}
}
}//package player
Section 67
//EmbedMenu (player.EmbedMenu)
package player {
import flash.display.*;
import flash.events.*;
import fl.controls.*;
import flash.text.*;
public class EmbedMenu extends Sprite {
private var _fond:Sprite;
private var _close:SimpleButton;
private var _embedlink:TextArea;
private var _embedHtml:TextArea;
private var _embedPhpBB:TextArea;
private var _embedLinkTitle:TextField;
private var _embedHtmlTitle:TextField;
private var _embedPhpBBTitle:TextField;
public function EmbedMenu(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, InitEmbedMenu);
}
private function InitEmbedMenu(e:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, InitEmbedMenu);
_fond = new Sprite();
var graph:Graphics = _fond.graphics;
graph.beginFill(0, 0.7);
graph.drawRect(0, 0, 200, 200);
graph.endFill();
_fond.width = this.stage.stageWidth;
_fond.height = this.stage.stageHeight;
addChild(_fond);
_close = new close_button();
_close.addEventListener(MouseEvent.CLICK, _closeHandler);
_close.y = 40;
_close.x = (this.stage.stageWidth - 55);
_close.width = 45;
_close.height = 45;
addChild(_close);
_embedLinkTitle = new TextField();
_embedLinkTitle.x = 50;
_embedLinkTitle.y = 70;
_embedLinkTitle.text = "Gallery URL :";
var myFormat:TextFormat = new TextFormat();
myFormat.bold = true;
myFormat.color = 0xFFFFFF;
myFormat.font = "Verdana";
myFormat.size = 11;
myFormat.align = TextFormatAlign.LEFT;
_embedLinkTitle.setTextFormat(myFormat);
_embedLinkTitle.textColor = 0xFFFFFF;
_embedLinkTitle.autoSize = TextFieldAutoSize.CENTER;
_embedLinkTitle.selectable = false;
_embedLinkTitle.defaultTextFormat = myFormat;
addChild(_embedLinkTitle);
_embedlink = new TextArea();
_embedlink.text = "http://www.vidz.com/";
_embedlink.x = 100;
_embedlink.y = 100;
_embedlink.width = 350;
_embedlink.height = 25;
addChild(_embedlink);
_embedHtmlTitle = new TextField();
_embedHtmlTitle.x = 50;
_embedHtmlTitle.y = 140;
_embedHtmlTitle.text = "Embed Code :";
myFormat = new TextFormat();
myFormat.bold = true;
myFormat.color = 0xFFFFFF;
myFormat.font = "Verdana";
myFormat.size = 11;
myFormat.align = TextFormatAlign.LEFT;
_embedHtmlTitle.setTextFormat(myFormat);
_embedHtmlTitle.textColor = 0xFFFFFF;
_embedHtmlTitle.autoSize = TextFieldAutoSize.CENTER;
_embedHtmlTitle.selectable = false;
_embedHtmlTitle.defaultTextFormat = myFormat;
addChild(_embedHtmlTitle);
_embedHtml = new TextArea();
_embedHtml.width = 350;
_embedHtml.height = 80;
_embedHtml.wordWrap = false;
_embedHtml.text = "";
_embedHtml.x = 100;
_embedHtml.y = 170;
_embedHtml.editable = false;
addChild(_embedHtml);
_embedPhpBBTitle = new TextField();
_embedPhpBBTitle.x = 50;
_embedPhpBBTitle.y = 250;
_embedPhpBBTitle.text = "PhpBB Code :";
myFormat = new TextFormat();
myFormat.bold = true;
myFormat.color = 0xFFFFFF;
myFormat.font = "Verdana";
myFormat.size = 11;
myFormat.align = TextFormatAlign.LEFT;
_embedPhpBBTitle.setTextFormat(myFormat);
_embedPhpBBTitle.textColor = 0xFFFFFF;
_embedPhpBBTitle.autoSize = TextFieldAutoSize.CENTER;
_embedPhpBBTitle.selectable = false;
_embedPhpBBTitle.defaultTextFormat = myFormat;
addChild(_embedPhpBBTitle);
_embedPhpBB = new TextArea();
_embedPhpBB.width = 350;
_embedPhpBB.height = 60;
_embedPhpBB.wordWrap = false;
_embedPhpBB.text = "";
_embedPhpBB.x = 100;
_embedPhpBB.y = 270;
_embedPhpBB.editable = false;
addChild(_embedPhpBB);
this.visible = false;
ReDraw();
}
private function _closeHandler(e:Event):void{
hideMenu();
}
public function ReDraw():void{
var info:InfoLoader = InfoLoader.GetInstance();
var x_offset:Number = (this.stage.stageWidth / 10);
if (x_offset > 80){
x_offset = 80;
};
var y_offset:Number = (this.stage.stageHeight / 15);
if (y_offset > 80){
y_offset = 80;
};
_fond.width = this.stage.stageWidth;
_fond.height = this.stage.stageHeight;
_close.x = (this.stage.stageWidth - 37);
_embedLinkTitle.x = x_offset;
_embedLinkTitle.y = y_offset;
_embedlink.width = ((this.stage.stageWidth - x_offset) - 20);
_embedlink.x = (x_offset + 10);
_embedlink.y = (y_offset + 20);
_embedHtmlTitle.y = (y_offset + 60);
_embedHtmlTitle.x = x_offset;
_embedHtml.width = ((this.stage.stageWidth - x_offset) - 20);
_embedHtml.x = (x_offset + 10);
_embedHtml.y = (y_offset + 80);
_embedPhpBBTitle.y = (y_offset + 170);
_embedPhpBBTitle.x = x_offset;
_embedPhpBB.width = ((this.stage.stageWidth - x_offset) - 20);
_embedPhpBB.x = (x_offset + 10);
_embedPhpBB.y = (y_offset + 190);
_embedHtml.text = (("<iframe src=\"http://flashservice.xvideos.com/embedframe/" + info.getVideoId()) + "\" frameborder=0 width=510 height=400 scrolling=no></iframe>");
_embedHtml.wordWrap = true;
_embedPhpBB.text = (("[flash=510,400]http://static.xvideos.com/swf/flv_player_site_v4.swf?id_video=" + info.getVideoId()) + "[/flash]");
if (info.getLinkUrl() != ""){
_embedlink.text = info.getLinkUrl();
} else {
_embedlink.text = (("http://www.xvideos.com/video" + info.getVideoId()) + "/embed_link");
};
}
public function showMenu():void{
this.visible = true;
}
public function hideMenu():void{
this.visible = false;
}
}
}//package player
Section 68
//InfoLoader (player.InfoLoader)
package player {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import com.dynamicflash.util.*;
import com.brokenfunction.json.*;
import flash.external.*;
public class InfoLoader extends EventDispatcher {
private var _VideoUrl:String;// = ""
private var _FlvEmbed:String;// = ""
private var _ThumbUrl:String;// = ""
private var _VideoLink:String;// = ""
private var _Record2257:String;// = ""
private var _RelatedArray:Array;
private var _VideoId:String;// = ""
private var _CdnId:String;// = ""
private var _Key:String;// = ""
private var _TheSkin:String;// = ""
private var amfphpConnection:NetConnection;
private var amfphpBufferConnection:NetConnection;
private var amfphpEmbedUrl:String;// = "http://flashembed.xvideos.com/flashservices/gateway.php"
private var _LinkUrl:String;// = ""
private var _JoinUrl:String;// = ""
private var _SponsorName:String;// = ""
private var _SponsorDesc:String;// = ""
private var _SponsorUrl:String;// = ""
private var _SponsorDynamicAd:String;// = ""
private var _Categories:String;// = ""
private var _StartSeek:Number;// = 0
private var _DisplayShare:Boolean;// = false
private var _IsEmbed:Boolean;// = false
private var _IsDeleted:Boolean;// = false
private var timer:Timer;
private var _Loaded:Boolean;// = false
private var _RPCLauched:Boolean;// = false
private var _bufferStatsSended:Boolean;// = false
private var _mozaiqueUrl:String;// = ""
private var _mozaiqueFullUrl:String;// = ""
private var _httpProtocol:String;// = "http://"
private var dynAdUrlLoader:URLLoader;
public static const LOADED:String = "loaded";
public static const ERROR:String = "error";
private static const CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMabcdefghijklmnopqrstuvwxyzabcdefghijklm";
private static var infoloader:InfoLoader = null;
public function InfoLoader(){
super();
}
public function loadParameters(params:Object){
var item:String;
var tmp_related:String;
var results:Array;
var line:String;
var tmp:Array;
var entries:Array;
var sponsor_json:*;
var sponsor:*;
var index:*;
var i:String;
var encoded:String;
var encodArr:*;
var encodedUrl:String;
var charNum:int;
var hash:String;
var value:Number;
var event:Event;
for (item in params) {
trace(item, " : ", params[item]);
if (item == "flv_url"){
_VideoUrl = params[item];
};
if (item == "flv_embed"){
_FlvEmbed = params[item];
};
if (item == "url_bigthumb"){
_ThumbUrl = params[item];
};
if (item == "related"){
tmp_related = params[item];
results = tmp_related.split(/;/);
_RelatedArray = new Array();
for each (line in results) {
tmp = new Array();
entries = line.split(/\|/);
tmp["name"] = unescape(entries[0].replace(/\+/g, " "));
tmp["video_url"] = entries[1];
tmp["url_thumb"] = entries[2];
tmp["length"] = entries[3];
_RelatedArray.push(tmp);
};
};
if (item == "id_video"){
_VideoId = params[item];
};
if (item == "id_cdn"){
_CdnId = params[item];
};
if (item == "key"){
_Key = params[item];
};
if (item == "theskin"){
_TheSkin = params[item];
};
if (item == "linkurl"){
_LinkUrl = params[item];
};
if (item == "joinurl"){
_JoinUrl = params[item];
};
if (item == "videolink"){
_VideoLink = params[item];
};
if (item == "mozaique"){
_mozaiqueUrl = params[item];
};
if (item == "mozaiquefull"){
_mozaiqueFullUrl = params[item];
};
if (item == "sponsor"){
sponsor_json = params[item];
sponsor = decodeJson(sponsor_json);
if (!sponsor){
//unresolved jump
};
if (sponsor.length != 0){
index = Math.floor((Math.random() * sponsor.length));
_SponsorName = InfoLoader.htmlDecode(sponsor[index].name);
_SponsorUrl = sponsor[index].link;
_SponsorDesc = InfoLoader.htmlDecode(sponsor[index].desc);
};
};
if (item == "categories"){
_Categories = unescape(params[item]);
};
if (item == "protocol"){
_httpProtocol = unescape(params[item]);
};
if (item == "displayshare"){
if (params[item] == "true"){
_DisplayShare = true;
} else {
_DisplayShare = false;
};
};
if (item == "encoded"){
encoded = params[item];
encoded = Base64.decode(encoded);
encodArr = encoded.split(/-/);
encodedUrl = "";
for (i in encodArr) {
charNum = parseInt(encodArr[i]);
if (charNum == 0){
} else {
encodedUrl = (encodedUrl + String.fromCharCode(charNum));
};
};
_VideoUrl = calculate(encodedUrl);
};
};
_DisplayShare = true;
if (((_VideoId) && ((_VideoUrl == "")))){
lauchRPCRequest();
} else {
ExternalInterface.call("eval", "function getHashValue() {\n return window.location.hash;\n }\n");
hash = ExternalInterface.call("getHashValue");
if (((!((hash === null))) && ((hash.length > 1)))){
if (hash.charAt(0) == "#"){
hash = hash.substr(1);
value = parseInt(hash);
if (!isNaN(value)){
_StartSeek = value;
};
};
};
//unresolved jump
var _slot1 = e;
if (_SponsorDynamicAd == ""){
event = new Event(LOADED, true);
dispatchEvent(event);
} else {
dynAdUrlLoader = new URLLoader();
dynAdUrlLoader.addEventListener(Event.COMPLETE, _dynAdUrlLoaderCompleteHandler);
dynAdUrlLoader.addEventListener(IOErrorEvent.IO_ERROR, _dynAdUrlLoaderErrorHandler);
dynAdUrlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, _dynAdUrlLoaderErrorHandler);
dynAdUrlLoader.load(new URLRequest(_SponsorDynamicAd));
};
};
}
private function _dynAdUrlLoaderCompleteHandler(e:Event):void{
var result:* = decodeJson(e.target.data);
if (((((((result.link) && (result.title))) && (result.desc))) && (result.bottom))){
_SponsorUrl = result.link;
_SponsorName = result.title;
_SponsorDesc = ((result.desc + " ") + result.bottom);
trace("Ok, dynamic ad loaded");
} else {
trace("Error missing entries in ", e.target.data);
};
var event:Event = new Event(LOADED, true);
dispatchEvent(event);
}
private function _dynAdUrlLoaderErrorHandler(e:IOErrorEvent):void{
trace("Error .loading dynamic ad");
var event:Event = new Event(LOADED, true);
dispatchEvent(event);
}
private function lauchRPCRequest():void{
_RPCLauched = true;
trace("Lauching RPC ...");
NetConnection.defaultObjectEncoding = ObjectEncoding.DEFAULT;
amfphpConnection = new NetConnection();
amfphpConnection.addEventListener(NetStatusEvent.NET_STATUS, _amfphpListener);
amfphpConnection.objectEncoding = ObjectEncoding.DEFAULT;
amfphpConnection.connect(amfphpEmbedUrl);
amfphpConnection.call("flashRpc.getVideo", new Responder(_amfphpVideoResponse, _amfphpListener), _VideoId, _TheSkin, _Key, _CdnId);
}
public function forceRPCLauch():Boolean{
if (_RPCLauched){
return (false);
};
lauchRPCRequest();
return (true);
}
private function _timerComplete(e:TimerEvent):void{
var event:Event;
timer.stop();
if (!_Loaded){
_Loaded = true;
event = new Event(LOADED, true);
dispatchEvent(event);
};
}
private function _amfphpVideoResponse(e):void{
var index:*;
var event:Event;
if (e[0]["id"]){
_VideoId = e[0]["id"];
};
if (e[0]["url"]){
_VideoUrl = e[0]["url"];
};
if (e[0]["url_thumblll"]){
_ThumbUrl = e[0]["url_thumblll"];
};
if (e[0]["mozaique"]){
_mozaiqueUrl = e[0]["mozaique"];
};
if (e[0]["mozaiquefull"]){
_mozaiqueFullUrl = e[0]["mozaiquefull"];
};
if (e[0]["video_url"]){
_LinkUrl = e[0]["video_url"];
};
if (e[0]["related"]){
_RelatedArray = e[0]["related"];
};
if (e[0]["id_cdn"]){
_CdnId = e[0]["id_cdn"];
};
if (e[0]["is_embed"]){
_IsEmbed = e[0]["is_embed"];
};
if (((e[0]["sponsor"]) && (!((e[0]["sponsor"].length == 0))))){
index = Math.floor((Math.random() * e[0]["sponsor"].length));
_SponsorName = e[0]["sponsor"][index].name;
_SponsorUrl = e[0]["sponsor"][index].link;
_SponsorDesc = e[0]["sponsor"][index].desc;
};
if (e[0]["categories"]){
_Categories = e[0]["categories"];
};
if (e["VIDEODELETED"]){
_IsDeleted = e["VIDEODELETED"];
};
if (!_Loaded){
_Loaded = true;
event = new Event(LOADED, true);
dispatchEvent(event);
};
}
private function _amfphpListener(e=null):void{
var event:Event;
trace("_amfphpListener : ", e.info.code, " For video id ", _VideoId);
if (e.info.level == "error"){
event = new Event(ERROR, true);
if (_VideoUrl != ""){
event = new Event(LOADED, true);
};
dispatchEvent(event);
};
}
public function sendBufferStats(duration):void{
if (_bufferStatsSended){
trace("Buffer Stats RPC already sended");
return;
};
_bufferStatsSended = true;
trace("Lauching Buffer Stats RPC with duration", duration, "with cdn", _CdnId);
NetConnection.defaultObjectEncoding = ObjectEncoding.DEFAULT;
amfphpBufferConnection = new NetConnection();
amfphpBufferConnection.addEventListener(NetStatusEvent.NET_STATUS, _amfphpBufferStatsListener);
amfphpBufferConnection.objectEncoding = ObjectEncoding.DEFAULT;
amfphpBufferConnection.connect(amfphpEmbedUrl);
amfphpBufferConnection.call("flashRpc.playbackStat", new Responder(_amfphpBufferStatsResponse, _amfphpBufferStatsListener), _VideoId, _CdnId, duration);
}
private function _amfphpBufferStatsResponse(e):void{
trace("_amfphpBufferStatsResponse : ", e);
}
private function _amfphpBufferStatsListener(e=null):void{
trace("_amfphpBufferStatsListener : ", e.info.code, " For video id ", _VideoId);
}
public function getFlvEmbedUrl():String{
if (_FlvEmbed != ""){
return (_FlvEmbed);
};
return (_VideoUrl);
}
public function getIsEmbed():Boolean{
return (_IsEmbed);
}
public function getIsDeleted():Boolean{
return (_IsDeleted);
}
public function getVideoUrl():String{
return (_VideoUrl);
}
public function getLinkUrl():String{
return (_LinkUrl);
}
public function getHttpProtocol():String{
return (_httpProtocol);
}
public function getJoinUrl():String{
return (_JoinUrl);
}
public function getThumbUrl():String{
return (_ThumbUrl);
}
public function getRelatedArray():Array{
return (_RelatedArray);
}
public function getVideoLink():String{
return (_VideoLink);
}
public function getDisplayShare():Boolean{
return (_DisplayShare);
}
public function getVideoId():String{
return (_VideoId);
}
public function getSponsorName():String{
return (_SponsorName);
}
public function getSponsorDesc():String{
return (_SponsorDesc);
}
public function getSponsorUrl():String{
return (_SponsorUrl);
}
public function getStartSeek():Number{
return (_StartSeek);
}
public function getRecord2257():String{
return (_Record2257);
}
public function getCategories():String{
return (_Categories);
}
public function getCdnId():String{
return (_CdnId);
}
public function getMozaiqueUrl():String{
return (_mozaiqueUrl);
}
public function getMozaiqueFullUrl():String{
return (_mozaiqueFullUrl);
}
private function calculate(src:String):String{
var character:String;
var pos:Number;
var calculated:String = new String("");
var i:Number = 0;
while (i < src.length) {
character = src.charAt(i);
pos = CHARS.indexOf(character);
if (pos > -1){
character = CHARS.charAt((pos + 13));
};
calculated = (calculated + character);
i++;
};
return (calculated);
}
public static function GetInstance(){
if (infoloader == null){
infoloader = new (InfoLoader);
};
return (infoloader);
}
public static function htmlDecode(value:String):String{
var entities:Object;
var replace:Function;
var value = value;
replace = function (match:String, name:String, num:int, index:int, original:String):String{
var code:int = (name) ? entities[name] : num;
return ((code) ? String.fromCharCode(code) : "");
};
entities = {quot:34, amp:38, lt:60, gt:62, nbsp:160, iexcl:161, cent:162, pound:163, curren:164, yen:165, brvbar:166, sect:167, uml:168, copy:169, ordf:170, laquo:171, not:172, shy:173, reg:174, macr:175, deg:176, plusmn:177, sup2:178, sup3:179, acute:180, micro:181, para:182, middot:183, cedil:184, sup1:185, ordm:186, raquo:187, frac14:188, frac12:189, frac34:190, iquest:191, Agrave:192, Aacute:193, Acirc:194, Atilde:195, Auml:196, Aring:197, AElig:198, Ccedil:199, Egrave:200, Eacute:201, Ecirc:202, Euml:203, Igrave:204, Iacute:205, Icirc:206, Iuml:207, ETH:208, Ntilde:209, Ograve:210, Oacute:211, Ocirc:212, Otilde:213, Ouml:214, times:215, Oslash:216, Ugrave:217, Uacute:218, Ucirc:219, Uuml:220, Yacute:221, THORN:222, szlig:223, agrave:224, aacute:225, acirc:226, atilde:227, auml:228, aring:229, aelig:230, ccedil:231, egrave:232, eacute:233, ecirc:234, euml:235, igrave:236, iacute:237, icirc:238, iuml:239, eth:240, ntilde:241, ograve:242, oacute:243, ocirc:244, otilde:245, ouml:246, divide:247, oslash:248, ugrave:249, uacute:250, ucirc:251, uuml:252, yacute:253, thorn:254, yuml:0xFF, OElig:338, oelig:339, Scaron:352, scaron:353, Yuml:376, fnof:402, circ:710, tilde:732, Alpha:913, Beta:914, Gamma:915, Delta:916, Epsilon:917, Zeta:918, Eta:919, Theta:920, Iota:921, Kappa:922, Lambda:923, Mu:924, Nu:925, Xi:926, Omicron:927, Pi:928, Rho :929, Sigma:931, Tau:932, Upsilon:933, Phi:934, Chi:935, Psi:936, Omega:937, alpha:945, beta:946, gamma:947, delta:948, epsilon:949, zeta:950, eta:951, theta:952, iota:953, kappa:954, lambda:955, mu:956, nu:957, xi:958, omicron:959, pi:960, rho:961, sigmaf:962, sigma:963, tau:964, upsilon:965, phi:966, chi:967, psi:968, omega:969, thetasym:977, upsih:978, piv:982, ensp:8194, emsp:8195, thinsp:8201, zwnj:8204, zwj:8205, lrm:8206, rlm:8207, ndash:8211, mdash:8212, lsquo:8216, rsquo:8217, sbquo:8218, ldquo:8220, rdquo:8221, bdquo:8222, dagger:0x2020, Dagger:8225, bull:8226, hellip:8230, permil:8240, prime:8242, Prime:8243, lsaquo:8249, rsaquo:8250, oline:8254, frasl:8260, euro:8364, image:8465, weierp:8472, real:8476, trade:8482, alefsym:8501, larr:8592, uarr:8593, rarr:8594, darr:8595, harr:8596, crarr:8629, lArr:8656, uArr:8657, rArr:8658, dArr:8659, hArr:8660, forall:0x2200, part:8706, exist:8707, empty:8709, nabla:8711, isin:8712, notin:8713, ni:8715, prod:8719, sum:8721, minus:8722, lowast:8727, radic:8730, prop:8733, infin:8734, ang:8736, and:8743, or:8744, cap:8745, cup:8746, int:8747, there4:8756, sim:8764, cong:8773, asymp:8776, ne:8800, equiv:8801, le:8804, ge:8805, sub:8834, sup:8835, nsub:8836, sube:8838, supe:8839, oplus:8853, otimes:8855, perp:8869, sdot:8901, lceil:8968, rceil:8969, lfloor:8970, rfloor:8971, lang:9001, rang:9002, loz:9674, spades:9824, clubs:9827, hearts:9829, diams:9830};
return (value.replace(/&([A-Za-z]+);|&#(\d+);/g, replace));
}
}
}//package player
Section 69
//Loading (player.Loading)
package player {
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
public class Loading extends MovieClip {
private var thetween:Tween;
private var thetween2:Tween;
private var _isDisplayed:Boolean;// = true
public function Loading(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, Init);
}
private function Init(e:Event):void{
this.alpha = 0.5;
ReDraw();
}
public function ReDraw():void{
var scale:Number = (this.stage.stageWidth / 300);
this.scaleX = scale;
this.scaleY = scale;
this.x = (Math.round((this.stage.stageWidth / 2)) - Math.round((this.width / 2)));
this.y = (Math.round((this.stage.stageHeight / 2)) - Math.round((this.height / 2)));
}
public function get isDisplayed():Boolean{
return (_isDisplayed);
}
public function set isDisplayed(value:Boolean):void{
if (_isDisplayed != value){
_isDisplayed = value;
if (value){
this.visible = true;
} else {
this.visible = false;
};
};
}
private function _disapearFinishedHandler(e:TweenEvent):void{
this.visible = false;
}
}
}//package player
Section 70
//MenuElt (player.MenuElt)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import fl.controls.*;
import fl.transitions.*;
import flash.text.*;
import fl.motion.easing.*;
public class MenuElt extends MovieClip {
private var _fond:Sprite;
private var _width:Number;
private var _checkbox:CheckBox;
private var _radio:RadioButton;
private var _text:TextField;
private var _tween:Tween;// = null
private var _eventType:String;// = null
private var _cookie:SharedObject;
private var _id:String;// = null
private var _elt;
private var _type:Number;
public static const OPTION = 1;
public static const SUBELT = 2;
public static const RADIO = 3;
public function MenuElt(type:Number, id:String){
super();
_type = type;
_id = id;
_fond = new Sprite();
var graphics:Graphics = _fond.graphics;
graphics.beginFill(0, 1);
graphics.drawRect(0, 0, 160, 23);
graphics.endFill();
_fond.alpha = 0;
addChild(_fond);
if (_type == OPTION){
_checkbox = new CheckBox();
_elt = _checkbox;
};
if (_type == RADIO){
_radio = new RadioButton();
_elt = _radio;
};
if (_type == SUBELT){
_text = new TextField();
_elt = _text;
};
_elt.x = 8;
var myFormat:TextFormat = new TextFormat();
myFormat.bold = true;
myFormat.color = 0xFFFFFF;
myFormat.font = "Verdana";
myFormat.size = 11;
if (_type == SUBELT){
_text.setTextFormat(myFormat);
_text.textColor = 0xFFFFFF;
_text.defaultTextFormat = myFormat;
_text.autoSize = TextFieldAutoSize.LEFT;
_text.selectable = false;
_text.y = 2;
} else {
_elt.setStyle("textFormat", myFormat);
};
addChild(_elt);
this.addEventListener(MouseEvent.MOUSE_OVER, _mouseOverHandler);
this.addEventListener(MouseEvent.MOUSE_OUT, _mouseOutHandler);
this.addEventListener(MouseEvent.CLICK, _mouseClickHandler);
_cookie = SharedObject.getLocal(("hexaplayerMenuElt" + id));
}
public function loadFromCookie():void{
if (_type == OPTION){
if (_cookie.data.check){
trace("OPTION : ", this._id, " value : ", _cookie.data.check);
if (_cookie.data.check == "YES"){
setChecked(true);
} else {
setChecked(false);
};
};
};
}
private function _mouseClickHandler(e:Event):void{
setChecked(this.checked);
}
public function setChecked(val:Boolean){
if ((((_type == OPTION)) || ((_type == RADIO)))){
this.checked = val;
if (_type == RADIO){
if (val){
_cookie.data.check = this._eventType;
};
} else {
if (val){
_cookie.data.check = "YES";
} else {
_cookie.data.check = "NO";
};
};
trace("Saving value : ", this._id, " value : ", _cookie.data.check);
_cookie.flush();
};
var event:Event = new Event(_eventType, true);
dispatchEvent(event);
}
private function _mouseOutHandler(e:Event):void{
if (_tween != null){
_tween.stop();
};
_tween = new Tween(_fond, "alpha", Linear.easeOut, _fond.alpha, 0, 0.5, true);
}
private function _mouseOverHandler(e:Event):void{
if (_tween != null){
_tween.stop();
};
_tween = new Tween(_fond, "alpha", Linear.easeOut, _fond.alpha, 1, 0.5, true);
}
public function setText(value:String){
if (_type == SUBELT){
_text.text = value;
} else {
_elt.label = value;
};
}
public function set checked(value:Boolean):void{
if ((((_type == OPTION)) || ((_type == RADIO)))){
_elt.selected = value;
};
}
public function get checked():Boolean{
if ((((_type == OPTION)) || ((_type == RADIO)))){
return (_elt.selected);
};
return (false);
}
override public function set width(value:Number):void{
_width = value;
_elt.width = value;
_fond.width = (value + 5);
}
override public function get width():Number{
return (_width);
}
public function get eventType():String{
return (_eventType);
}
public function set eventType(value:String):void{
_eventType = value;
}
}
}//package player
Section 71
//MenuOptions (player.MenuOptions)
package player {
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
import fl.transitions.easing.*;
public class MenuOptions extends MovieClip {
private var cadre:MovieClip;// = null
private var tween:Tween;// = null
private var is_visible;// = false
private var is_moving;// = false
private var x_goal:Number;// = 0
private var _menuQuality:MenuElt;
private var _FullSize:MenuElt;
private var _KeepRatioSize:MenuElt;
private var _OriSize:MenuElt;
private var _Related:MenuElt;
private var _EmbedCode:MenuElt;
private var _FullScreen:MenuElt;
private var _ShowImagePreview:MenuElt;
private var _Report:MenuElt;
private var _Record2257:MenuElt;
private var as_related:Boolean;// = false
private var as_embed:Boolean;// = false
private var as_2257:Boolean;// = false
private var _menu_height:int;// = 210
public function MenuOptions(_as_related:Boolean, _as_embed:Boolean){
super();
as_related = _as_related;
as_embed = _as_embed;
this.x = 10;
this.addEventListener(Event.ADDED_TO_STAGE, CreateMenuOptions);
}
private function CreateMenuOptions(e:Event):void{
var index:Number = _menu_height;
this.removeEventListener(Event.ADDED_TO_STAGE, CreateMenuOptions);
cadre = new MovieClip();
var graphics:Graphics = cadre.graphics;
graphics.beginFill(0, 0.75);
graphics.drawRect(0, 0, 150, 150);
graphics.endFill();
addChild(cadre);
_FullScreen = new MenuElt(MenuElt.SUBELT, "fullscreen");
_FullScreen.width = 150;
_FullScreen.setText("Fullscreen");
_FullScreen.eventType = ToolBar.FULLSCREEN_PRESSED;
addChild(_FullScreen);
_EmbedCode = new MenuElt(MenuElt.SUBELT, "embed");
_EmbedCode.width = 150;
_EmbedCode.setText("Embed Code");
_EmbedCode.eventType = FlashPlayerV1.MENU_EMBED;
addChild(_EmbedCode);
_Related = new MenuElt(MenuElt.SUBELT, "related");
_Related.width = 150;
_Related.setText("Related videos");
_Related.eventType = FlashPlayerV1.MENU_RELATED;
addChild(_Related);
_Report = new MenuElt(MenuElt.SUBELT, "report");
_Report.width = 150;
_Report.setText("Report this video");
_Report.eventType = FlashPlayerV1.MENU_REPORT;
addChild(_Report);
_Record2257 = new MenuElt(MenuElt.SUBELT, "2257");
_Record2257.width = 150;
_Record2257.setText("18 U.S.C. 2257");
_Record2257.eventType = FlashPlayerV1.MENU_2257;
addChild(_Record2257);
_ShowImagePreview = new MenuElt(MenuElt.OPTION, "picturepreview");
_ShowImagePreview.width = 150;
_ShowImagePreview.setText("Preview pictures");
_ShowImagePreview.checked = true;
_ShowImagePreview.eventType = FlashPlayerV1.SHOW_PREVIEW_PICTURES;
addChild(_ShowImagePreview);
_OriSize = new MenuElt(MenuElt.RADIO, "ratio");
_OriSize.width = 150;
_OriSize.setText("Original size");
_OriSize.checked = false;
_OriSize.eventType = VideoPlayerBox.ORI_SIZE;
addChild(_OriSize);
_KeepRatioSize = new MenuElt(MenuElt.RADIO, "ratio");
_KeepRatioSize.width = 150;
_KeepRatioSize.setText("Keep Ratio");
_KeepRatioSize.checked = true;
_KeepRatioSize.eventType = VideoPlayerBox.KEEP_RATIO;
addChild(_KeepRatioSize);
_FullSize = new MenuElt(MenuElt.RADIO, "ratio");
_FullSize.width = 150;
_FullSize.setText("Full Size");
_FullSize.checked = false;
_FullSize.eventType = VideoPlayerBox.FULL_SIZE;
addChild(_FullSize);
_menuQuality = new MenuElt(MenuElt.OPTION, "quality");
_menuQuality.width = 150;
_menuQuality.setText("High Quality");
_menuQuality.checked = true;
_menuQuality.eventType = VideoPlayerBox.HIGH_QUALITY;
addChild(_menuQuality);
}
public function loadPrefFromCookies():void{
trace("Loading pref");
_ShowImagePreview.loadFromCookie();
_OriSize.loadFromCookie();
_KeepRatioSize.loadFromCookie();
_FullSize.loadFromCookie();
_menuQuality.loadFromCookie();
}
public function InvertVisibility():void{
is_visible = !(is_visible);
if (tween != null){
tween.stop();
};
is_moving = true;
if (is_visible){
this.visible = true;
tween = new Tween(this, "x", Regular.easeOut, this.x, x_goal, 1, true);
} else {
tween = new Tween(this, "x", Regular.easeOut, this.x, (x_goal + 160), 1, true);
};
tween.addEventListener(TweenEvent.MOTION_FINISH, tweenlistener);
trace("Invert visibilty : ", is_visible);
}
public function HideMenu():void{
is_visible = false;
if (tween != null){
tween.stop();
};
is_moving = true;
tween = new Tween(this, "x", Regular.easeOut, this.x, (x_goal + 160), 1, true);
tween.addEventListener(TweenEvent.MOTION_FINISH, tweenlistener);
}
private function tweenlistener(e:TweenEvent):void{
if (is_visible == false){
this.visible = false;
};
trace("Anim finished");
}
public function ReDraw():void{
var info:InfoLoader = InfoLoader.GetInstance();
var index:Number = 0;
if (info.getDisplayShare()){
as_embed = true;
} else {
as_embed = false;
};
if (info.getRecord2257()){
as_2257 = true;
} else {
as_2257 = false;
};
_menuQuality.y = index;
index = (index + 25);
_FullSize.y = index;
index = (index + 25);
_KeepRatioSize.y = index;
index = (index + 25);
_OriSize.y = index;
index = (index + 25);
_ShowImagePreview.y = index;
index = (index + 25);
_Report.y = index;
index = (index + 25);
if (as_2257){
_Record2257.y = index;
index = (index + 25);
_Record2257.visible = true;
} else {
_Record2257.visible = false;
};
if (as_embed){
_EmbedCode.y = index;
index = (index + 25);
_EmbedCode.visible = true;
} else {
_EmbedCode.visible = false;
};
if (as_related){
_Related.y = index;
index = (index + 25);
_Related.visible = true;
} else {
_Related.visible = false;
};
_FullScreen.y = index;
index = (index + 25);
cadre.height = index;
}
public function SetXGoal(value:Number):void{
x_goal = value;
}
public function get menu_height():int{
return (_menu_height);
}
}
}//package player
Section 72
//PictureLoader (player.PictureLoader)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class PictureLoader extends EventDispatcher {
private var _url:String;// = ""
private var tmp_picture:Bitmap;
public static const LOADED:String = "loaded_pictureloaded";
public function PictureLoader(url:String){
super();
_url = url;
}
public function load(){
var imgLoader:Loader = new Loader();
var image:URLRequest = new URLRequest(_url);
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, _loadedImage);
imgLoader.load(image);
}
private function _loadedImage(evt:Event):void{
evt.stopPropagation();
var tmpMC:MovieClip = new MovieClip();
tmpMC.addChild(evt.target.content);
var myBitmapData:BitmapData = new BitmapData(tmpMC.width, tmpMC.height);
myBitmapData.draw(tmpMC);
tmp_picture = new Bitmap(myBitmapData);
tmp_picture.smoothing = true;
var event:Event = new Event(LOADED, true);
dispatchEvent(event);
}
public function get picture(){
return (tmp_picture);
}
}
}//package player
Section 73
//RelatedMenu (player.RelatedMenu)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import fl.controls.*;
import flash.utils.*;
import flash.text.*;
public class RelatedMenu extends Sprite {
private var _fond:Sprite;
private var _btprev:Sprite;
private var _btsuiv:Sprite;
private var _close:SimpleButton;
private var _relatedframe:Sprite;
private var _visible:Boolean;// = false
private var _relatedinstances:Array;
private var _relatedPanel:MovieClip;
private var _defilTimer:Timer;// = null
private var _defilType:Number;
private var _defilSpeed:Number;
private var _defilOk:Boolean;// = false
private var _canLoad:Boolean;// = false
private var ReplayBt:Button;
private var ShareBt:Button;
private var JoinBt:Button;
private static const PREV = 1;
private static const SUIV = 2;
public function RelatedMenu(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, InitRelatedMenu);
}
private function InitRelatedMenu(e:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, InitRelatedMenu);
_fond = new Sprite();
var graph:Graphics = _fond.graphics;
graph.beginFill(0, 0.45);
graph.drawRect(0, 0, 200, 200);
graph.endFill();
_fond.width = this.stage.stageWidth;
_fond.height = this.stage.stageHeight;
addChild(_fond);
_relatedPanel = new MovieClip();
_relatedPanel.y = 0;
_relatedPanel.x = 0;
addChild(_relatedPanel);
_close = new close_button();
_close.addEventListener(MouseEvent.CLICK, _closeHandler);
_close.y = 40;
_close.x = (this.stage.stageWidth - 55);
_close.width = 45;
_close.height = 45;
addChild(_close);
var myFormat:TextFormat = new TextFormat();
myFormat.font = "Georgia";
myFormat.size = 15;
myFormat.bold = true;
ReplayBt = new Button();
ReplayBt.label = "Replay";
ReplayBt.width = 90;
ReplayBt.height = 30;
ReplayBt.setStyle("textFormat", myFormat);
ReplayBt.addEventListener(MouseEvent.CLICK, _replayHandler);
addChild(ReplayBt);
ShareBt = new Button();
ShareBt.label = "Share";
ShareBt.width = 90;
ShareBt.height = 30;
ShareBt.setStyle("textFormat", myFormat);
ShareBt.addEventListener(MouseEvent.CLICK, _shareHandler);
addChild(ShareBt);
JoinBt = new Button();
JoinBt.setStyle("textFormat", myFormat);
JoinBt.label = "Join";
JoinBt.width = 90;
JoinBt.height = 30;
JoinBt.addEventListener(MouseEvent.CLICK, _joinHandler);
addChild(JoinBt);
this.visible = false;
_relatedinstances = new Array();
}
private function _joinHandler(e:Event):void{
var info:InfoLoader = InfoLoader.GetInstance();
navigateToURL(new URLRequest(info.getJoinUrl()), "_self");
}
private function _shareHandler(e:Event):void{
trace("Share click");
var evt:Event = new Event(FlashPlayerV1.MENU_EMBED, true);
dispatchEvent(evt);
}
private function _replayHandler(e:Event):void{
var evt:Event = new Event(FlashPlayerV1.REPLAY, true);
dispatchEvent(evt);
trace("Replay Click");
}
private function _mouseOverSuivHandler(e:Event):void{
if (_defilTimer != null){
_defilTimer.stop();
};
_defilTimer = new Timer(50);
_defilTimer.addEventListener(TimerEvent.TIMER, _timerDefilHandler);
_defilTimer.start();
_defilType = SUIV;
_defilSpeed = 1;
_defilOk = true;
}
private function _mouseOutSuivHandler(e:Event):void{
_defilOk = false;
}
private function _mouseOutPrevHandler(e:Event):void{
_defilOk = false;
}
private function _mouseOverPrevHandler(e:Event):void{
if (_defilTimer != null){
_defilTimer.stop();
};
_defilTimer = new Timer(50);
_defilTimer.addEventListener(TimerEvent.TIMER, _timerDefilHandler);
_defilTimer.start();
_defilType = PREV;
_defilSpeed = 1;
_defilOk = true;
}
private function _timerDefilHandler(e:Event):void{
if (_defilType == PREV){
if (_relatedPanel.x < (stage.stageWidth * 0.3)){
_relatedPanel.x = (_relatedPanel.x + _defilSpeed);
};
} else {
if (_relatedPanel.x > -((_relatedPanel.width - (stage.stageWidth * 0.8)))){
_relatedPanel.x = (_relatedPanel.x - _defilSpeed);
};
};
if (_defilOk){
if (_defilSpeed < 20){
_defilSpeed = (_defilSpeed + 1);
};
} else {
if (_defilSpeed <= 1){
_defilTimer.stop();
_defilTimer = null;
} else {
_defilSpeed = (_defilSpeed - 1);
};
};
}
public function showMenu():void{
this._visible = true;
this.visible = true;
if (this._canLoad){
loadRelatedAndDisplay();
};
ReDraw();
}
public function hideMenu():void{
this._visible = false;
this.visible = false;
}
private function _closeHandler(e:Event):void{
hideMenu();
}
public function ReDraw():void{
var video:*;
var x:Number;
var info:InfoLoader = InfoLoader.GetInstance();
_fond.width = this.stage.stageWidth;
_fond.height = (this.stage.stageHeight - 20);
_close.x = (this.stage.stageWidth - 37);
var nb_video_hori:Number = Math.floor((this.stage.stageWidth / 130));
var nb_video_verti:Number = Math.floor(((this.stage.stageHeight - 30) / 150));
trace("Nb video hori : ", nb_video_hori, " Nb video verti : ", nb_video_verti);
var video_height:Number = ((this.stage.stageHeight - 30) / nb_video_verti);
var video_width:Number = (this.stage.stageWidth / nb_video_hori);
trace("video_height : ", video_height, " video_width : ", video_width);
var x_offset:Number = 0;
var y_offset:Number = 0;
var nb_video:Number = 0;
var offset_tmp_x:* = ((video_width - 150) / 2);
var offset_tmp_y:* = ((video_height - 130) / 2);
for each (video in _relatedinstances) {
video.x = (offset_tmp_x + x_offset);
video.y = (offset_tmp_y + y_offset);
x_offset = (x_offset + video_width);
nb_video = (nb_video + 1);
if (x_offset >= (this.stage.stageWidth - 100)){
y_offset = (y_offset + video_height);
x_offset = 0;
};
if (nb_video > (nb_video_hori * nb_video_verti)){
video.visible = false;
} else {
video.visible = true;
};
};
x = -40;
if (info.getDisplayShare()){
x = (x - 60);
ShareBt.visible = true;
} else {
ShareBt.visible = false;
};
if (info.getJoinUrl() == ""){
JoinBt.visible = false;
} else {
x = (x - 60);
JoinBt.visible = true;
};
ReplayBt.x = ((this.stage.stageWidth / 2) + x);
if (ShareBt.visible){
x = (x + 120);
ShareBt.x = ((this.stage.stageWidth / 2) + x);
};
JoinBt.x = (((this.stage.stageWidth / 2) + x) + 120);
ReplayBt.y = (this.stage.stageHeight - 60);
ShareBt.y = (this.stage.stageHeight - 60);
JoinBt.y = (this.stage.stageHeight - 60);
}
private function loadRelatedAndDisplay():void{
var video:*;
var tmp:RelatedVideo;
var info:InfoLoader = InfoLoader.GetInstance();
var related:Array = info.getRelatedArray();
_relatedinstances = new Array();
var x_offset:Number = 0;
var y_offset:Number = 0;
trace("Loading Related ...");
for each (video in related) {
tmp = new RelatedVideo(video["url_thumb"], video["name"], video["video_url"]);
_relatedPanel.addChild(tmp);
tmp.x = x_offset;
x_offset = (x_offset + 200);
tmp.y = 0;
_relatedinstances.push(tmp);
};
this._canLoad = false;
ReDraw();
}
public function loadRelated():void{
this._canLoad = true;
}
}
}//package player
Section 74
//RelatedVideo (player.RelatedVideo)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import fl.transitions.*;
import flash.text.*;
import fl.motion.easing.*;
import com.adrianparr.utils.*;
import flash.filters.*;
import flash.system.*;
public class RelatedVideo extends Sprite {
private var pictureurl:String;
private var videotitle:String;
private var videourl:String;
private var picture:Sprite;
private var tmp_picture:Bitmap;// = null
private var title:TextField;
private var tween1:Tween;// = null
private var tween2:Tween;// = null
private var loadTimer:Timer;// = null
public function RelatedVideo(_pictureurl:String, _videotitle:String, _videourl:String){
super();
var urlArr:Array = _pictureurl.split("/");
trace("Loading : ", urlArr[2]);
if (urlArr.length > 3){
Security.loadPolicyFile((((urlArr[0] + "//") + urlArr[2]) + "/crossdomain.xml"));
};
pictureurl = _pictureurl;
videotitle = _videotitle;
videourl = _videourl;
loadPicture();
loadTimer = new Timer(3000, 3);
loadTimer.addEventListener(TimerEvent.TIMER, _loadTimerHandler);
loadTimer.start();
title = new TextField();
var myFormat:TextFormat = new TextFormat();
myFormat.bold = true;
myFormat.color = 0xFFFFFF;
myFormat.font = "Verdana";
myFormat.size = 10;
myFormat.align = TextFormatAlign.CENTER;
title.setTextFormat(myFormat);
title.textColor = 0xFFFFFF;
title.autoSize = TextFieldAutoSize.CENTER;
title.selectable = false;
title.defaultTextFormat = myFormat;
title.htmlText = HtmlEntities.decode(videotitle);
title.multiline = true;
title.wordWrap = true;
addChild(title);
title.y = 90;
title.width = 108;
var graph:Graphics = this.graphics;
graph.beginFill(0, 0);
graph.drawRect(0, 0, 108, 135);
graph.endFill();
this.buttonMode = true;
this.mouseEnabled = true;
this.useHandCursor = true;
addEventListener(MouseEvent.CLICK, _mouseClickHandler);
addEventListener(MouseEvent.MOUSE_OVER, _mouseOverHandler);
addEventListener(MouseEvent.MOUSE_OUT, _mouseOutHandler);
this.filters = new Array(new DropShadowFilter(4, 45, 0, 0.8));
}
private function _loadTimerHandler(e:Event):void{
if (tmp_picture != null){
loadTimer.stop();
} else {
loadPicture();
};
}
private function loadPicture():void{
var myLoad:* = new Loader();
myLoad.load(new URLRequest(pictureurl));
myLoad.contentLoaderInfo.addEventListener(Event.COMPLETE, handlerLoaderComplete);
}
private function _mouseOutHandler(e:Event):void{
if (tween1 != null){
tween1.stop();
};
if (picture != null){
tween1 = new Tween(picture, "y", Bounce.easeOut, picture.y, 0, 0.5, true);
};
}
private function _mouseOverHandler(e:Event):void{
if (tween1 != null){
tween1.stop();
};
if (picture != null){
tween1 = new Tween(picture, "y", Linear.easeOut, 0, -8, 0.2, true);
};
}
private function _mouseClickHandler(evt:Event):void{
navigateToURL(new URLRequest(videourl), "_blank");
}
private function handlerLoaderComplete(evt:Event){
var tmpMC:MovieClip;
var myBitmapData:BitmapData;
var mask:Sprite;
if (tmp_picture == null){
tmpMC = new MovieClip();
tmpMC.addChild(evt.target.content);
myBitmapData = new BitmapData(tmpMC.width, tmpMC.height);
myBitmapData.draw(tmpMC);
tmp_picture = new Bitmap(myBitmapData);
tmp_picture.smoothing = true;
tmp_picture.width = 108;
tmp_picture.height = 81;
picture = new Sprite();
mask = new Sprite();
mask.graphics.beginFill(0);
mask.graphics.drawRoundRect(0, 0, 108, 81, 10, 10);
picture.addChild(tmp_picture);
addChild(picture);
picture.addChild(mask);
tmp_picture.mask = mask;
};
}
}
}//package player
Section 75
//ReportPoppup (player.ReportPoppup)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import fl.controls.*;
import flash.utils.*;
import fl.transitions.*;
import flash.text.*;
import fl.transitions.easing.*;
public class ReportPoppup extends MovieClip {
private var background:Sprite;// = null
private var hanchor:Sprite;// = null
private var window:Sprite;// = null
private var titre:TextField;// = null
private var titre_warning:TextField;// = null
private var reason_nervermind:RadioButton;// = null
private var reason_spam:RadioButton;// = null
private var reason_notporn:RadioButton;// = null
private var reason_illegal:RadioButton;// = null
private var reason_other:RadioButton;// = null
private var reason_text:TextArea;// = null
private var email_text:TextField;// = null
private var email:TextInput;// = null
private var how_you_know_text:TextField;// = null
private var how_you_know:TextInput;// = null
private var who_are_you_text:TextField;// = null
private var who_are_you:TextInput;// = null
private var button:Button;// = null
private var closebutton:Button;// = null
private var copyrightbutton:Button;// = null
private var tween:Tween;// = null
private var sender:URLLoader;// = null
private var endtext:TextField;// = null
private var endtimer:Timer;// = null
private var finished:Boolean;// = false
private var unlocked:Boolean;// = false
private var unlocked_email:Boolean;// = false
private var error_background:Sprite;// = null
private var error_text:TextField;// = null
private var error_timer:Timer;// = null
public function ReportPoppup(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, _addedToStageHandler);
}
private function _addedToStageHandler(e:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, _addedToStageHandler);
background = new Sprite();
background.graphics.beginFill(0x333333, 0.8);
background.graphics.drawRoundRect(0, 0, 500, 500, 0, 0);
addChild(background);
hanchor = new Sprite();
addChild(hanchor);
window = new Sprite();
window.graphics.beginFill(0);
window.graphics.drawRoundRect(0, 0, 300, 220, 15, 15);
hanchor.addChild(window);
titre = new TextField();
titre.text = "Report this video";
titre.textColor = 0xFFFFFF;
titre.x = 4;
titre.y = 4;
titre.width = 200;
titre.setTextFormat(new TextFormat("Arial", 14, 0xFFFFFF, true));
titre.selectable = false;
hanchor.addChild(titre);
titre_warning = new TextField();
titre_warning.text = "Please fill all information.";
titre_warning.textColor = 16725044;
titre_warning.x = 150;
titre_warning.y = 4;
titre_warning.width = 200;
titre_warning.setTextFormat(new TextFormat("Arial", 12, 16725044, true));
titre_warning.selectable = false;
hanchor.addChild(titre_warning);
var myFormat:TextFormat = new TextFormat();
myFormat.bold = true;
myFormat.color = 0xFFFFFF;
myFormat.font = "Arial";
myFormat.size = 11;
reason_nervermind = new RadioButton();
reason_nervermind.setStyle("textFormat", myFormat);
reason_nervermind.label = "Nevermind";
reason_nervermind.y = 25;
reason_nervermind.addEventListener(MouseEvent.CLICK, _enableButton);
hanchor.addChild(reason_nervermind);
reason_spam = new RadioButton();
reason_spam.setStyle("textFormat", myFormat);
reason_spam.label = "Spam";
reason_spam.y = 25;
reason_spam.x = 120;
reason_spam.addEventListener(MouseEvent.CLICK, _enableButton);
hanchor.addChild(reason_spam);
reason_notporn = new RadioButton();
reason_notporn.setStyle("textFormat", myFormat);
reason_notporn.label = "Not Porn";
reason_notporn.x = 200;
reason_notporn.y = 25;
reason_notporn.addEventListener(MouseEvent.CLICK, _enableButton);
hanchor.addChild(reason_notporn);
reason_illegal = new RadioButton();
reason_illegal.setStyle("textFormat", myFormat);
reason_illegal.label = "Underage";
reason_illegal.x = 70;
reason_illegal.y = 45;
reason_illegal.addEventListener(MouseEvent.CLICK, _enableButton);
hanchor.addChild(reason_illegal);
reason_other = new RadioButton();
reason_other.setStyle("textFormat", myFormat);
reason_other.label = "Other";
reason_other.x = 170;
reason_other.y = 45;
reason_other.addEventListener(MouseEvent.CLICK, _enableButton);
hanchor.addChild(reason_other);
how_you_know_text = new TextField();
how_you_know_text.text = "How you know ?";
how_you_know_text.setTextFormat(new TextFormat("Arial", 11, 0xFFFFFF, true));
how_you_know_text.width = 100;
how_you_know_text.y = 70;
how_you_know_text.x = 10;
hanchor.addChild(how_you_know_text);
how_you_know = new TextInput();
how_you_know.y = 70;
how_you_know.x = 110;
how_you_know.width = 180;
how_you_know.height = 20;
hanchor.addChild(how_you_know);
who_are_you_text = new TextField();
who_are_you_text.text = "Who are you ?";
who_are_you_text.setTextFormat(new TextFormat("Arial", 11, 0xFFFFFF, true));
who_are_you_text.width = 100;
who_are_you_text.y = 95;
who_are_you_text.x = 10;
hanchor.addChild(who_are_you_text);
who_are_you = new TextInput();
who_are_you.y = 95;
who_are_you.x = 110;
who_are_you.width = 180;
who_are_you.height = 20;
hanchor.addChild(who_are_you);
email_text = new TextField();
email_text.text = "Email :";
email_text.setTextFormat(new TextFormat("Arial", 11, 0xFFFFFF, true));
email_text.width = 45;
email_text.y = 70;
email_text.x = 10;
hanchor.addChild(email_text);
email = new TextInput();
email.text = "Please leave your email";
email.addEventListener(MouseEvent.CLICK, _emailClick);
email.addEventListener(Event.CHANGE, _emailClick);
email.y = 70;
email.x = 55;
email.width = 237;
email.height = 20;
hanchor.addChild(email);
reason_text = new TextArea();
reason_text.y = 95;
reason_text.x = 10;
reason_text.width = 283;
reason_text.text = "Please detail or your report will be ignored.";
reason_text.addEventListener(MouseEvent.CLICK, _textClick);
reason_text.addEventListener(Event.CHANGE, _textClick);
hanchor.addChild(reason_text);
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.bold = true;
button = new Button();
button.label = "Report";
button.width = 100;
button.x = 194;
button.y = 145;
button.addEventListener(MouseEvent.CLICK, _buttonValidate);
button.setStyle("textFormat", myTextFormat);
hanchor.addChild(button);
closebutton = new Button();
closebutton.label = "Close";
closebutton.width = 65;
closebutton.x = 10;
closebutton.y = 145;
closebutton.enabled = true;
closebutton.addEventListener(MouseEvent.CLICK, _buttonClose);
hanchor.addChild(closebutton);
var copyrightTextFormat:TextFormat = new TextFormat();
copyrightTextFormat.size = 11;
copyrightbutton = new Button();
copyrightbutton.label = "Content owners click here to send us a take-\ndown request for copyright infringement.";
copyrightbutton.width = 283;
copyrightbutton.height = 40;
copyrightbutton.x = 10;
copyrightbutton.y = 172;
copyrightbutton.enabled = true;
copyrightbutton.setStyle("textFormat", copyrightTextFormat);
copyrightbutton.addEventListener(MouseEvent.CLICK, _buttonCopyright);
hanchor.addChild(copyrightbutton);
error_background = new Sprite();
error_background.graphics.beginFill(0x770000);
error_background.graphics.drawRoundRect(0, 0, 350, 100, 15, 15);
error_text = new TextField();
error_text.setTextFormat(new TextFormat("Arial", 12, 0xFFFFFF, true));
error_text.width = 340;
error_text.x = 10;
error_text.y = 40;
error_text.selectable = false;
error_text.autoSize = TextFieldAutoSize.CENTER;
error_background.addChild(error_text);
this.visible = false;
}
private function displayError(text:String){
error_text.text = text;
error_text.setTextFormat(new TextFormat("Arial", 12, 0xFFFFFF, true));
addChild(error_background);
error_background.x = ((this.stage.stageWidth / 2) - (error_background.width / 2));
error_background.y = ((this.stage.stageHeight / 2) - (error_background.height / 2));
error_timer = new Timer(3000);
error_timer.addEventListener(TimerEvent.TIMER, _errorTimerHandler);
error_timer.start();
}
private function _errorTimerHandler(e:TimerEvent):void{
removeChild(error_background);
error_timer.stop();
error_timer = null;
}
private function _buttonCopyright(e:MouseEvent){
navigateToURL(new URLRequest("http://info.xvideos.com/content/"), "_blank");
}
private function _buttonClose(e:MouseEvent){
hideWindow();
}
private function _enableButton(e:MouseEvent){
button.enabled = true;
ReDraw();
}
private function _buttonValidate(e:MouseEvent){
var info:InfoLoader = InfoLoader.GetInstance();
var reason:String = "";
if (reason_spam.selected){
reason = "spam";
};
if (reason_notporn.selected){
reason = "notporn";
};
if (reason_illegal.selected){
reason = "illegal";
};
if (reason_other.selected){
reason = "other";
};
if (!unlocked_email){
email.text = "";
};
if (!unlocked){
reason_text.text = "";
};
if (reason_nervermind.selected){
displayError("Please select a reason");
return;
};
if (email.text.length < 6){
displayError("Please check your email adress");
return;
};
var pattern:RegExp = /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[a-zA-Z]{2,4}/i;
if (!pattern.exec(email.text)){
displayError("Your email is not correct.");
return;
};
if (reason_illegal.selected){
if (how_you_know.text.length < 10){
displayError("'How you know' is too short, please detail more.");
return;
};
if (who_are_you.text.length < 10){
displayError("'Who are you' is too short, please detail more.");
return;
};
};
var urlstr:String = ((((((((((((("http://report.xvideos.com/videoreport/" + info.getVideoId()) + "/") + info.getIsEmbed()) + "/") + reason) + "/") + escape(reason_text.text)) + "/") + escape(email.text)) + "/") + escape(how_you_know.text)) + "/") + escape(who_are_you.text));
trace("Call : ", urlstr);
var url:URLRequest = new URLRequest(urlstr);
sender = new URLLoader();
sender.addEventListener(Event.COMPLETE, _dataSended);
sender.addEventListener(IOErrorEvent.IO_ERROR, _dataSendedError);
sender.load(url);
button.enabled = false;
tween = new Tween(hanchor, "height", Regular.easeIn, window.height, 0, 1, true);
tween.start();
}
private function _dataSendedError(e:Event){
showText("Error sending report", 16718876);
}
private function _dataSended(e:Event){
showText("Thank you", 0x18AB00);
}
private function showText(text:String, col:uint){
finished = true;
endtext = new TextField();
endtext.text = text;
endtext.autoSize = TextFieldAutoSize.LEFT;
endtext.setTextFormat(new TextFormat("Arial", 18, col, true));
endtext.selectable = false;
addChild(endtext);
endtext.x = ((this.stage.stageWidth / 2) - (endtext.width / 2));
endtext.y = ((this.stage.stageHeight / 2) - (endtext.height / 2));
endtimer = new Timer(1000, 1);
endtimer.addEventListener(TimerEvent.TIMER, _timerEnded);
endtimer.start();
}
private function _timerEnded(e:TimerEvent){
trace("Timer End");
hideWindow();
}
private function _emailClick(e:Event){
email.removeEventListener(MouseEvent.CLICK, _emailClick);
email.removeEventListener(Event.CHANGE, _emailClick);
email.text = "";
unlocked_email = true;
}
private function _textClick(e:Event){
unlocked = true;
reason_text.removeEventListener(MouseEvent.CLICK, _textClick);
reason_text.removeEventListener(Event.CHANGE, _textClick);
reason_text.text = "";
}
public function ReDraw(){
var toadd:Number;
background.width = this.stage.stageWidth;
background.height = this.stage.stageHeight;
if (reason_illegal.selected){
window.height = 270;
how_you_know_text.visible = true;
how_you_know.visible = true;
who_are_you.visible = true;
who_are_you_text.visible = true;
toadd = 52;
email_text.y = (70 + toadd);
email.y = (70 + toadd);
reason_text.y = (95 + toadd);
button.y = (145 + toadd);
closebutton.y = (145 + toadd);
copyrightbutton.y = (172 + toadd);
} else {
window.height = 220;
how_you_know_text.visible = false;
how_you_know.visible = false;
who_are_you.visible = false;
who_are_you_text.visible = false;
email_text.y = 70;
email.y = 70;
reason_text.y = 95;
button.y = 145;
closebutton.y = 145;
copyrightbutton.y = 172;
};
hanchor.x = (((this.stage.stageWidth / 2) - (hanchor.width / 2)) + 25);
hanchor.y = ((this.stage.stageHeight / 2) - (hanchor.height / 2));
}
public function showWindow():void{
reason_nervermind.selected = true;
this.visible = true;
ReDraw();
if (finished){
endtimer = new Timer(1000, 1);
endtimer.addEventListener(TimerEvent.TIMER, _timerEnded);
endtimer.start();
};
}
public function hideWindow():void{
this.visible = false;
}
}
}//package player
Section 76
//SoundVolume (player.SoundVolume)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class SoundVolume extends MovieClip {
private var _volume:int;
private var _volumeCookie:SharedObject;
private var _icon_mute:Bitmap;
private var _icon_vol:Bitmap;
private var _is_mute:Boolean;// = false
public function SoundVolume(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, _InitSoundVolume);
}
private function _InitSoundVolume(e:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, _InitSoundVolume);
_icon_mute = new Bitmap(new icon_sound_mute(20, 20));
_icon_mute.x = -23;
_icon_mute.y = -13;
_icon_mute.visible = false;
this.addChild(_icon_mute);
_icon_vol = new Bitmap(new icon_sound(20, 20));
_icon_vol.x = -23;
_icon_vol.y = -13;
_icon_vol.visible = false;
this.addChild(_icon_vol);
this.stop();
this.addEventListener(MouseEvent.MOUSE_DOWN, _eventMouseDownHandler);
this.addEventListener(MouseEvent.MOUSE_MOVE, _eventMouseDownHandler);
_volumeCookie = SharedObject.getLocal("hexaplayerVolumeCookie");
if (_volumeCookie.data.mute){
this._is_mute = _volumeCookie.data.mute;
};
if (_volumeCookie.data.volume){
this.volume = _volumeCookie.data.volume;
} else {
this.volume = 100;
};
}
private function _eventMouseDownHandler(e:MouseEvent):void{
var vol:*;
if (e.buttonDown){
if (e.localX < 0){
_is_mute = !(_is_mute);
this.volume = _volume;
} else {
_is_mute = false;
vol = Math.round(((100 / 44) * e.localX));
this.volume = vol;
};
};
}
public function get volume():int{
if (_is_mute){
return (0);
};
return (_volume);
}
public function set volume(value:int):void{
if (_is_mute){
_icon_mute.visible = true;
_icon_vol.visible = false;
} else {
_icon_mute.visible = false;
_icon_vol.visible = true;
};
_volume = value;
var event:Event = new Event(ToolBar.VOLUME_CHANGE, true);
_volumeCookie.data.volume = value;
_volumeCookie.data.mute = _is_mute;
_volumeCookie.flush();
this.dispatchEvent(event);
this.gotoAndStop(_volume);
}
override public function set width(value:Number):void{
}
}
}//package player
Section 77
//SponsorPoppup (player.SponsorPoppup)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import fl.transitions.*;
import flash.text.*;
import fl.transitions.easing.*;
public class SponsorPoppup extends MovieClip {
private var text:TextField;// = null
private var textDesc:TextField;// = null
private var currentStatus:String;// = "none"
private var moveTween:Tween;
private var timer:Timer;
private var url:String;
private var loaded:Boolean;// = false
private var background:Sprite;// = null
private var click_zone:Sprite;// = null
private var _close:SimpleButton;
private var _show:SimpleButton;
private var gobackbutton:Sprite;// = null
private var big_size:Number;// = 0
public function SponsorPoppup(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, _addedToStageHandler);
}
private function _addedToStageHandler(e:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, _addedToStageHandler);
background = new Sprite();
background.graphics.beginFill(0x333333, 0.8);
background.graphics.drawRoundRect(0, 0, 500, 50, 5, 5);
addChild(background);
click_zone = new Sprite();
click_zone.graphics.beginFill(0xFFFFFF, 0);
click_zone.graphics.drawRoundRect(0, 0, 500, 50, 5, 5);
click_zone.addEventListener(MouseEvent.CLICK, _handleClick);
addChild(click_zone);
_close = new close();
_close.addEventListener(MouseEvent.CLICK, _closeHandler);
_close.y = 13;
_close.x = 40;
_close.width = 20;
_close.height = 18;
_show = new show();
_show.addEventListener(MouseEvent.CLICK, _showHandler);
_show.y = -30;
_show.width = 20;
_show.height = 18;
_show.visible = false;
addChild(_show);
}
private function _showHandler(e:MouseEvent):void{
startAppear();
}
private function _mouseOverGoBack(e:MouseEvent):void{
startAppear();
}
private function _closeHandler(e:MouseEvent):void{
startDisAppear(true);
}
public function reDraw():void{
var info:InfoLoader = InfoLoader.GetInstance();
if (background != null){
background.width = (this.stage.stageWidth - 20);
click_zone.width = (background.width - 43);
};
if (text != null){
if (((!((text.htmlText.indexOf("This video is sponsored by ", 0) == -1))) || (!((text.htmlText.indexOf("Watch and download more videos at ", 0) == -1))))){
if (text.width > (background.width - 30)){
big_size = text.width;
text.htmlText = (((("<a target='_blank' href='" + info.getSponsorUrl()) + "'><u>") + info.getSponsorName().toUpperCase()) + "</u></a>");
text.setTextFormat(new TextFormat("Arial", 15, 0xFFFFFF, true, false));
};
} else {
if (big_size < (background.width - 35)){
if (info.getSponsorName().indexOf("Vidz.com") == -1){
text.htmlText = (((("This video is sponsored by <a target='_blank' href='" + info.getSponsorUrl()) + "'><u>") + info.getSponsorName().toUpperCase()) + "</u></a>");
} else {
text.htmlText = (((("Watch and download more videos at <a target='_blank' href='" + info.getSponsorUrl()) + "'><u>") + info.getSponsorName().toUpperCase()) + "</u></a>");
};
text.setTextFormat(new TextFormat("Arial", 15, 0xFFFFFF, true, false));
};
};
text.x = (((background.width - 15) / 2) - (text.width / 2));
textDesc.width = background.width;
trace("Desc Height : ", textDesc.height);
background.height = (20 + textDesc.height);
if (currentStatus == "displayed"){
this.y = ((0 - background.height) - 3);
};
_show.x = (background.width - 4);
};
_close.x = (background.width - 15);
if (background != null){
click_zone.height = (background.height - 5);
};
}
private function _handleClick(e:MouseEvent):void{
navigateToURL(new URLRequest(url));
}
private function _handleMouveOut(e:MouseEvent):void{
var info:InfoLoader = InfoLoader.GetInstance();
if (text != null){
text.setTextFormat(new TextFormat("Arial", 15, 0xFFFFFF, true, false));
};
}
private function _handleMouveOver(e:MouseEvent):void{
var info:InfoLoader = InfoLoader.GetInstance();
if (text != null){
text.setTextFormat(new TextFormat("Arial", 15, 0xFF0000, true, false));
};
}
public function updateInfos():void{
var info:InfoLoader = InfoLoader.GetInstance();
if (((((!((info.getSponsorName() == ""))) && ((info.getSponsorName().indexOf("VIDZ") == -1)))) && ((info.getSponsorName().indexOf("XVideos HD porn videos") == -1)))){
loaded = true;
text = new TextField();
if (info.getSponsorName().indexOf("Vidz.com") == -1){
text.htmlText = (((("This video is sponsored by <a target='_blank' href='" + info.getSponsorUrl()) + "'><u>") + info.getSponsorName().toUpperCase()) + "</u></a>");
} else {
text.htmlText = (((("Watch and download more videos at <a target='_blank' href='" + info.getSponsorUrl()) + "'><u>") + info.getSponsorName().toUpperCase()) + "</u></a>");
};
text.selectable = false;
text.textColor = 0xFFFFFF;
text.autoSize = TextFieldAutoSize.LEFT;
text.setTextFormat(new TextFormat("Arial", 15, 0xFFFFFF, true, false));
text.x = ((background.width / 2) - (text.width / 2));
text.autoSize = TextFieldAutoSize.CENTER;
text.addEventListener(MouseEvent.CLICK, _handleClick);
addChild(text);
textDesc = new TextField();
textDesc.y = 20;
textDesc.htmlText = info.getSponsorDesc();
textDesc.x = 0;
textDesc.autoSize = TextFieldAutoSize.CENTER;
textDesc.wordWrap = true;
textDesc.width = this.width;
textDesc.selectable = false;
textDesc.setTextFormat(new TextFormat("Arial", 13, 0xFFFFFF, null, null, null, null, null, TextFormatAlign.CENTER));
addChild(textDesc);
removeChild(click_zone);
addChild(click_zone);
url = info.getSponsorUrl();
addChild(_close);
reDraw();
};
}
public function startAppear():void{
if (loaded){
if (currentStatus == "none"){
moveTween = new Tween(this, "y", Bounce.easeOut, 0, ((0 - background.height) - 3), 2, true);
currentStatus = "displayed";
_show.visible = false;
};
};
}
public function startDelayedDisAppear():void{
if (loaded){
if (currentStatus == "displayed"){
timer = new Timer(20000, 1);
timer.addEventListener(TimerEvent.TIMER, _realDisapear);
timer.start();
currentStatus = "startDisappear";
};
};
}
private function _realDisapear(e:TimerEvent):void{
if ((((currentStatus == "startDisappear")) && (this.loaded))){
timer.stop();
timer = null;
startDisAppear();
};
}
public function startDisAppear(fast:Boolean=false):void{
if (this.loaded != true){
return;
};
var speed:Number = 3;
if (fast){
speed = 0.5;
};
moveTween = new Tween(this, "y", Regular.easeOut, this.y, 15, speed, true);
currentStatus = "startDisappear";
moveTween.addEventListener("motionFinish", _dispapearFinished);
}
private function _dispapearFinished(e:Event):void{
currentStatus = "none";
_show.visible = true;
}
}
}//package player
Section 78
//TimeLine (player.TimeLine)
package player {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import fl.transitions.*;
import flash.text.*;
import fl.motion.easing.*;
import flash.filters.*;
public class TimeLine extends Sprite {
private var _width:Number;// = 200
private var _startPosition:Number;// = 100
private var _seekPosition:Number;// = 0
private var _endPosition:Number;// = 0
private var _cursorPosition:Number;// = 0
private var _totalLength:Number;// = 0
private var _rect:Sprite;// = null
private var _loadingBar:Sprite;// = null
private var _cursor:Sprite;// = null
private var _fakeMouseRect:Sprite;// = null
private var _posdisplay:TextField;// = null
private var positiontext:TextField;// = null
private var positiontext_sprite:Sprite;// = null
private var positiontext_timer:Timer;// = null
private var positiontext_visible:Boolean;// = false
private var thetween:Tween;
private var cursorMoving:Boolean;// = false
private var _images_cache:Array;
private var _curimg:Bitmap;// = null
private var _displayPicturePreview:Boolean;// = true
private var _mozaique:Bitmap;// = null
private var _isMozaiqueFull:Boolean;// = false
private var _currentMozaiqueThumb:Number;// = 0
private var mozaiqueSprite:Sprite;// = null
public function TimeLine(width){
_images_cache = new Array();
super();
_width = width;
mouseChildren = false;
this.addEventListener(Event.ADDED_TO_STAGE, CreateTimeLine);
}
private function CreateTimeLine(e:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, CreateTimeLine);
this.addEventListener(MouseEvent.MOUSE_DOWN, _mouseDownHandler);
this.addEventListener(MouseEvent.MOUSE_OVER, _mouseOverHandler);
this.addEventListener(MouseEvent.MOUSE_OUT, _mouseOutHandler);
this.addEventListener(MouseEvent.MOUSE_MOVE, _mouseMoveHandler);
positiontext_sprite = new Sprite();
positiontext = new TextField();
positiontext.antiAliasType = AntiAliasType.ADVANCED;
positiontext.multiline = false;
positiontext.selectable = false;
var textformat:TextFormat = new TextFormat(null, 12, 0xFFFFFF, true);
positiontext.defaultTextFormat = textformat;
positiontext.text = "00:00";
positiontext_sprite.addChild(positiontext);
positiontext_sprite.alpha = 0;
positiontext.autoSize = TextFieldAutoSize.LEFT;
var textfilter:GlowFilter = new GlowFilter(0, 1);
positiontext_sprite.filters = [textfilter];
positiontext_sprite.y = -22;
this.addChild(positiontext_sprite);
mozaiqueSprite = new Sprite();
positiontext_sprite.addChild(mozaiqueSprite);
_posdisplay = new TextField();
var textformat_posdisplay:TextFormat = new TextFormat(null, 12, 0xFFFFFF, true);
_posdisplay.defaultTextFormat = textformat_posdisplay;
_posdisplay.y = -5;
_posdisplay.x = (_width + 10);
_posdisplay.multiline = false;
_posdisplay.selectable = false;
_posdisplay.text = "00:00 / 00:00";
_posdisplay.autoSize = TextFieldAutoSize.LEFT;
_posdisplay.mouseEnabled = false;
this.addChild(_posdisplay);
ReDraw();
}
public function infoLoaded():Boolean{
var url:String;
var info:InfoLoader = InfoLoader.GetInstance();
if (info.getMozaiqueFullUrl() != ""){
_isMozaiqueFull = true;
url = info.getMozaiqueFullUrl();
} else {
if (info.getMozaiqueUrl() != ""){
url = info.getMozaiqueUrl();
} else {
url = info.getThumbUrl().replace(/\/[a-f0-9]+.[0-9]+.jpg$/, "/mozaique.jpg").replace(/\/thumbslll\//, "/thumbs/");
trace("Detected url", url);
};
};
var loader:PictureLoader = new PictureLoader(url);
loader.addEventListener(PictureLoader.LOADED, _loadedImage);
loader.load();
return (true);
}
private function startLoadingForThumb(num:Number):Boolean{
return (true);
}
private function _loadedImage(evt:Event):void{
evt.stopPropagation();
trace("Mozaique loaded OK");
_mozaique = evt.target.picture;
mozaiqueSprite.addChild(_mozaique);
}
private function secondConvertToString(seconds:Number):String{
var min:Number = Math.floor((seconds / 60));
var sec:Number = Math.floor((seconds - (min * 60)));
return (((((min < 10)) ? ("0" + min) : min + ":") + ((sec < 10)) ? ("0" + sec) : sec));
}
private function _mouseOutHandler(e:MouseEvent):void{
if (positiontext_timer != null){
positiontext_timer.stop();
};
positiontext_timer = new Timer(400, 1);
positiontext_timer.addEventListener(TimerEvent.TIMER_COMPLETE, _mouseOutTimerHandler);
positiontext_timer.start();
}
private function _mouseOutTimerHandler(e:Event):void{
positiontext_visible = false;
new Tween(positiontext_sprite, "alpha", Linear.easeOut, 1, 0, 1, true);
}
private function _mouseOverHandler(e:MouseEvent):void{
if (positiontext_timer != null){
positiontext_timer.stop();
};
if (!positiontext_visible){
new Tween(positiontext_sprite, "alpha", Linear.easeOut, 0, 1, 1, true);
positiontext_visible = true;
};
}
private function _mouseMoveHandler(e:MouseEvent):void{
var toPosition:Number = e.localX;
var tmp_pos:Number = ((_totalLength / _width) * toPosition);
if (tmp_pos < 0){
tmp_pos = 0;
toPosition = 0;
};
if (tmp_pos > _totalLength){
tmp_pos = _totalLength;
toPosition = (_width - 2);
};
positiontext.text = secondConvertToString(tmp_pos);
positiontext_sprite.x = toPosition;
if (_displayPicturePreview){
mozaiqueSprite.visible = true;
if ((_mozaique is Bitmap)){
this.updateThumb(toPosition);
};
} else {
mozaiqueSprite.visible = false;
};
}
private function updateThumb(toPosition:Number){
if (_mozaique == null){
trace("Mozaique not loaded");
return;
};
var thumbnum:Number = (Math.floor(((30 / _width) * toPosition)) + 1);
var thumbwidth:Number = (_mozaique.width / 6);
var thumbheight:Number = (_mozaique.height / 5);
var line:* = Math.floor((thumbnum / 6));
var col:* = (thumbnum - (line * 6));
if (_isMozaiqueFull){
trace("is MozaiqueFull");
thumbnum = (Math.floor(((100 / _width) * toPosition)) + 1);
thumbwidth = (_mozaique.width / 10);
thumbheight = (_mozaique.height / 10);
line = Math.floor((thumbnum / 10));
col = (thumbnum - (line * 10));
};
trace("Thumb width", thumbwidth, "Thumb Height", thumbheight);
if (_currentMozaiqueThumb == thumbnum){
return;
};
mozaiqueSprite.y = (0 - (thumbheight * (line + 1)));
mozaiqueSprite.x = ((0 - (thumbwidth * col)) - (thumbwidth / 2));
var topLeftStage:Point = _mozaique.localToGlobal(new Point(0, 0));
var mask:Sprite = new Sprite();
mask.graphics.beginFill(0);
mask.graphics.drawRoundRect((thumbwidth * col), (thumbheight * line), thumbwidth, thumbheight, 0);
mask.x = topLeftStage.x;
mask.y = topLeftStage.y;
trace(mask.parent);
_mozaique.mask = mask;
}
private function _mouseDownHandler(e:MouseEvent):void{
var toPosition:Number = e.localX;
if (toPosition > _width){
return;
};
_seekPosition = ((_totalLength / _width) * toPosition);
if (_seekPosition < 0){
_seekPosition = 0;
toPosition = 0;
};
if (_seekPosition > _totalLength){
_seekPosition = _totalLength;
toPosition = (_width - 2);
};
thetween = new Tween(_cursor, "x", Sine.easeOut, _cursor.x, toPosition, 0.5, true);
thetween.addEventListener(TweenEvent.MOTION_FINISH, _cursorMovingFinishedHandler);
cursorMoving = true;
var event:Event = new Event(ToolBar.TIME_LINE_CHANGED, true);
dispatchEvent(event);
}
private function _cursorMovingFinishedHandler(e:TweenEvent){
cursorMoving = false;
thetween = null;
}
public function ReDraw():void{
var percent:*;
var start:Number;
var end:Number;
if (_rect != null){
this.removeChild(_rect);
};
_rect = new Sprite();
_rect.graphics.lineStyle(2, 0xFFFFFF);
_rect.graphics.drawRoundRect(0, 0, _width, 10, 6, 6);
this.addChild(_rect);
if (_fakeMouseRect != null){
this.removeChild(_fakeMouseRect);
};
_fakeMouseRect = new Sprite();
_fakeMouseRect.graphics.beginFill(0xFFFFFF);
_fakeMouseRect.graphics.drawRoundRect(0, 0, _width, 15, 0, 0);
_fakeMouseRect.alpha = 0;
this.addChild(_fakeMouseRect);
if (_loadingBar != null){
this.removeChild(_loadingBar);
};
if (_cursor == null){
_cursor = new Sprite();
_cursor.graphics.lineStyle(3, 0xDDDDDD);
_cursor.graphics.moveTo(0, -3);
_cursor.graphics.lineTo(0, 13);
this.addChild(_cursor);
};
if (_totalLength != 0){
_loadingBar = new Sprite();
_loadingBar.graphics.beginFill(0xF70000);
percent = (_width / _totalLength);
start = (percent * _startPosition);
end = (percent * (_endPosition - _startPosition));
if (end < 0){
end = Math.abs(end);
start = (start - end);
};
if (start < 0){
start = 0;
};
if (end > (_width + start)){
end = (_width + start);
};
_loadingBar.graphics.drawRoundRect(start, 1, end, 8, 6, 6);
this.addChild(_loadingBar);
_cursor.visible = true;
if (!cursorMoving){
_cursor.x = ((_width / _totalLength) * _cursorPosition);
if (_cursor.x > _width){
_cursor.x = _width;
};
};
} else {
_cursor.visible = false;
};
setChildIndex(_cursor, (numChildren - 1));
_posdisplay.x = (_width + 7);
}
public function get startPosition():Number{
return (_startPosition);
}
public function set startPosition(value:Number):void{
_startPosition = value;
}
public function get endPosition():Number{
return (_endPosition);
}
public function set endPosition(value:Number):void{
_endPosition = value;
ReDraw();
}
public function get cursorPosition():Number{
return (_cursorPosition);
}
public function set cursorPosition(value:Number):void{
if (!cursorMoving){
_cursorPosition = value;
_posdisplay.text = ((secondConvertToString(_cursorPosition) + " / ") + secondConvertToString(_totalLength));
ReDraw();
};
}
public function get totalLength():Number{
return (_totalLength);
}
public function set totalLength(value:Number):void{
_posdisplay.text = ((secondConvertToString(_cursorPosition) + " / ") + secondConvertToString(_totalLength));
_totalLength = value;
}
override public function get width():Number{
return (_width);
}
override public function set width(value:Number):void{
_width = value;
ReDraw();
}
public function get seekPosition():Number{
return (_seekPosition);
}
public function set seekPosition(value:Number):void{
_seekPosition = value;
}
public function get displayPicturePreview():Boolean{
return (_displayPicturePreview);
}
public function set displayPicturePreview(value:Boolean):void{
_displayPicturePreview = value;
}
}
}//package player
Section 79
//ToolBar (player.ToolBar)
package player {
import flash.display.*;
import flash.events.*;
import flash.external.*;
public class ToolBar extends MovieClip {
private var background:Sprite;// = null
private var playbt:SimpleButton;// = null
private var pausebt:SimpleButton;// = null
private var _soundbar:SoundVolume;// = null
private var _timeline:TimeLine;// = null
private var resize_bitmap:Bitmap;// = null
private var resize:SimpleButton;// = null
private var fullscreen:SimpleButton;// = null
private var toolbarmenu:ToolbarMenu;// = null
private var linkbt:ToolBarLinkBt;// = null
private var sponsorpoppup:SponsorPoppup;// = null
public static const VOLUME_CHANGE = "VOLUMECHANGE";
public static const PLAY_PRESSED = "PLAY_PRESSED";
public static const PAUSE_PRESSED = "PAUSE_PRESSED";
public static const TIME_LINE_CHANGED = "TIME_LINE_CHANGED";
public static const FULLSCREEN_PRESSED = "FULLSCREEN_PRESSED";
public function ToolBar(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, CreateToolBar);
}
private function CreateToolBar(e:Event):void{
linkbt = new ToolBarLinkBt();
linkbt.x = 5;
linkbt.y = -25;
this.addChild(linkbt);
sponsorpoppup = new SponsorPoppup();
this.addChild(sponsorpoppup);
sponsorpoppup.x = ((stage.stageWidth / 2) - ((sponsorpoppup.width - 6) / 2));
sponsorpoppup.y = 10;
background = new Sprite();
background.graphics.beginFill(0, 1);
background.graphics.drawRect(0, 0, stage.stageWidth, 25);
this.addChild(background);
playbt = new playbutton();
playbt.addEventListener(MouseEvent.CLICK, _PlayBtHandler);
playbt.x = 12;
playbt.y = 13;
playbt.width = 20;
playbt.height = 20;
this.addChild(playbt);
pausebt = new pausebutton();
pausebt.addEventListener(MouseEvent.CLICK, _PauseBtHandler);
pausebt.x = 12;
pausebt.y = 13;
pausebt.width = 20;
pausebt.height = 20;
pausebt.visible = false;
this.addChild(pausebt);
_soundbar = new SoundVolume();
_soundbar.x = 55;
_soundbar.y = 17;
this.addChild(_soundbar);
resize_bitmap = new Bitmap(new icon_resize(16, 16));
resize_bitmap.x = 0;
resize_bitmap.y = 0;
resize = new SimpleButton();
resize.upState = resize_bitmap;
resize.overState = resize_bitmap;
resize.downState = resize_bitmap;
resize.hitTestState = resize_bitmap;
resize.x = (stage.stageWidth - 44);
resize.y = 5;
resize.visible = true;
resize.addEventListener(MouseEvent.MOUSE_UP, _reSizeBtHandler);
this.addChild(resize);
fullscreen = new SimpleButton();
fullscreen.upState = new FullScreenBtNormal();
fullscreen.overState = new FullScreenBtHover();
fullscreen.downState = new FullScreenBtNormal();
fullscreen.hitTestState = new FullScreenBtHitTest();
fullscreen.x = (stage.stageWidth - 24);
fullscreen.y = 5;
fullscreen.addEventListener(MouseEvent.MOUSE_UP, _FullscreenBtHandler);
this.addChild(fullscreen);
_timeline = new TimeLine((stage.stageWidth - 350));
_timeline.x = 110;
_timeline.y = 8;
this.addChild(_timeline);
toolbarmenu = new ToolbarMenu();
toolbarmenu.x = (stage.stageWidth - 2);
toolbarmenu.y = 2;
this.addChild(toolbarmenu);
this.y = (stage.stageHeight - 25);
ReDraw();
}
private function _reSizeBtHandler(e:MouseEvent):void{
trace("_reSizeBtHandler : Call JS");
ExternalInterface.call("eval", "(function() {\n window.xvideos.player.toggleSize(); \r\n})();\r\n");
this.stage.displayState = StageDisplayState.NORMAL;
//unresolved jump
var _slot1 = e;
}
public function ReDraw():void{
var info:InfoLoader = InfoLoader.GetInstance();
if (this.stage.stageWidth < 350){
toolbarmenu.visible = false;
resize.visible = false;
fullscreen.x = (stage.stageWidth - 23);
if (this.stage.stageWidth < 220){
_timeline.visible = false;
} else {
_timeline.visible = true;
_timeline.width = (stage.stageWidth - 215);
};
} else {
toolbarmenu.visible = true;
toolbarmenu.x = (stage.stageWidth - 1);
fullscreen.x = ((stage.stageWidth - toolbarmenu.width) - 23);
_timeline.visible = true;
if (info.getIsEmbed()){
resize.visible = false;
_timeline.width = (stage.stageWidth - 275);
} else {
resize.visible = true;
resize.x = ((stage.stageWidth - toolbarmenu.width) - 45);
_timeline.width = (stage.stageWidth - 294);
};
};
sponsorpoppup.reDraw();
sponsorpoppup.x = ((stage.stageWidth / 2) - ((sponsorpoppup.width - 6) / 2));
this.y = (stage.stageHeight - 25);
background.width = stage.stageWidth;
toolbarmenu.ReDraw();
}
private function _FullscreenBtHandler(e:Event):void{
var event:Event = new Event(FULLSCREEN_PRESSED);
dispatchEvent(event);
}
private function _PlayBtHandler(e:MouseEvent):void{
var event:Event = new Event(PLAY_PRESSED);
dispatchEvent(event);
}
private function _PauseBtHandler(e:Event):void{
var event:Event = new Event(PAUSE_PRESSED);
dispatchEvent(event);
}
public function setHideAllBt():void{
pausebt.visible = false;
playbt.visible = false;
}
public function setPauseBt():void{
pausebt.visible = true;
playbt.visible = false;
}
public function setPlayBt():void{
pausebt.visible = false;
playbt.visible = true;
}
public function hideMenu():void{
toolbarmenu.HideMenu();
}
public function get timeline():TimeLine{
return (_timeline);
}
public function get soundbar():SoundVolume{
return (_soundbar);
}
public function Disable(){
_timeline.mouseEnabled = false;
}
public function Enable(){
playbt.mouseEnabled = true;
_timeline.mouseEnabled = true;
}
public function InfoLoaded(){
sponsorpoppup.updateInfos();
sponsorpoppup.startAppear();
}
public function closeSponsorPoppup(){
sponsorpoppup.startDisAppear(false);
}
public function loadPrefFromCookies():void{
toolbarmenu.loadPrefFromCookie();
}
}
}//package player
Section 80
//ToolBarLinkBt (player.ToolBarLinkBt)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import fl.transitions.*;
import fl.motion.easing.*;
import flash.filters.*;
public class ToolBarLinkBt extends Sprite {
private var _image:Bitmap;
private var _tween:Tween;// = null
private var filter:BlurFilter;
public function ToolBarLinkBt(){
super();
_image = new Bitmap(new logo_xvideos(99, 21));
_image.x = 5;
this.addChild(_image);
this.buttonMode = true;
this.mouseEnabled = true;
this.useHandCursor = true;
this.addEventListener(MouseEvent.CLICK, _mouseClickHandler);
this.addEventListener(MouseEvent.MOUSE_OVER, _mouseOverHandler);
this.addEventListener(MouseEvent.MOUSE_OUT, _mouseOutHandler);
filter = new BlurFilter();
}
private function _mouseOutHandler(e:Event):void{
}
private function _tweenListenerHandler(e:TweenEvent):void{
filter.blurY = filter.blurX;
this.filters = [filter];
}
private function _mouseOverHandler(e:Event):void{
_tween = new Tween(filter, "blurX", Linear.easeOut, 0, 8, 0.3, true);
_tween.addEventListener(TweenEvent.MOTION_CHANGE, _tweenListenerHandler);
_tween.addEventListener(TweenEvent.MOTION_FINISH, _tweenFinishedHandler);
}
private function _tweenFinishedHandler(e:TweenEvent):void{
_tween.stop();
_tween = new Tween(filter, "blurX", Linear.easeOut, 8, 0, 0.3, true);
_tween.addEventListener(TweenEvent.MOTION_CHANGE, _tweenListenerHandler);
}
private function _mouseClickHandler(e:Event):void{
var info:InfoLoader = InfoLoader.GetInstance();
if (info.getLinkUrl() == ""){
navigateToURL(new URLRequest("http://www.xvideos.com/"), "_blank");
} else {
navigateToURL(new URLRequest(info.getLinkUrl()), "_blank");
};
}
}
}//package player
Section 81
//ToolbarMenu (player.ToolbarMenu)
package player {
import flash.display.*;
import flash.events.*;
public class ToolbarMenu extends MovieClip {
private var _button:MenuButton;
private var _menuoption:MenuOptions;
private var _isdisplayed:Boolean;// = false
public function ToolbarMenu(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, CreateToolBarMenu);
}
private function CreateToolBarMenu(e:Event):void{
var info:InfoLoader = InfoLoader.GetInstance();
this.removeEventListener(Event.ADDED_TO_STAGE, CreateToolBarMenu);
_button = new MenuButton();
this.addChild(_button);
_button.addEventListener(MouseEvent.CLICK, _menuButtonClickHandler);
_menuoption = new MenuOptions(true, true);
_menuoption.SetXGoal(-150);
this.addChild(_menuoption);
}
private function _menuButtonClickHandler(e:MouseEvent):void{
_menuoption.y = -(_menuoption.height);
_menuoption.ReDraw();
_menuoption.InvertVisibility();
}
public function HideMenu():void{
_menuoption.HideMenu();
}
override public function get width():Number{
return (_button.width);
}
public function ReDraw():void{
_menuoption.ReDraw();
_menuoption.y = -(_menuoption.height);
}
public function loadPrefFromCookie():void{
_menuoption.loadPrefFromCookies();
}
}
}//package player
Section 82
//VideoDeleted (player.VideoDeleted)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
public class VideoDeleted extends Sprite {
var text:TextField;
public function VideoDeleted(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, _init);
}
private function _init(e:Event):void{
this.graphics.beginFill(0x333333, 0.7);
this.graphics.drawRect(0, 0, this.stage.stageWidth, this.stage.stageHeight);
text = new TextField();
text.text = "Video deleted";
text.setTextFormat(new TextFormat(null, 16, 0xFFFFFF, true));
text.x = ((this.stage.stageWidth / 2) - 150);
text.y = ((this.stage.stageHeight / 2) - 10);
addChild(text);
this.addEventListener(MouseEvent.CLICK, _mouseClickHandler);
}
private function _mouseClickHandler(e:Event):void{
navigateToURL(new URLRequest("http://www.xvideos.com/"), "_blank");
}
}
}//package player
Section 83
//VideoError (player.VideoError)
package player {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
public class VideoError extends Sprite {
private var _type:int;
private var background:Sprite;
private var text:TextField;
private var link:TextField;// = null
public static const DELETED = 1;
public static const DELAYED = 2;
public static const MODIFY = 3;
public static const ERROR = 4;
public function VideoError(type:int){
super();
_type = type;
this.addEventListener(Event.ADDED_TO_STAGE, _init);
}
private function _init(e:Event):void{
background = new Sprite();
background.graphics.beginFill(0, 0.7);
background.graphics.drawRect(0, 0, 200, 200);
background.graphics.endFill();
background.mouseEnabled = true;
this.addChild(background);
text = new TextField();
text.defaultTextFormat = new TextFormat("Verdana", 22, 0xFFFFFF, true);
text.selectable = false;
text.autoSize = TextFieldAutoSize.LEFT;
if (_type == DELETED){
text.text = "This video has been deleted";
} else {
if (_type == MODIFY){
text.text = "Embed video code change is not allowed.\nPlease copy/paste again from the site.";
} else {
if (_type == ERROR){
text.text = "Internal error. Please try again.";
} else {
text.text = "This video will be available soon";
link = new TextField();
link.defaultTextFormat = new TextFormat("Verdana", 16, 0xFFFFFF, true, false, true);
link.selectable = false;
link.autoSize = TextFieldAutoSize.CENTER;
link.text = "Want to help us ? Please launch our diagnostic tool.";
link.addEventListener(MouseEvent.CLICK, _mouseHelpClickHandler);
this.addChild(link);
};
};
};
this.addChild(text);
background.addEventListener(MouseEvent.CLICK, _mouseClickHandler);
ReDraw();
}
private function _mouseHelpClickHandler(e:MouseEvent):void{
navigateToURL(new URLRequest("http://static.xvideos.com/diagnostic.html"), "_blank");
}
private function _mouseClickHandler(e:Event):void{
var info:InfoLoader = InfoLoader.GetInstance();
if (_type == MODIFY){
navigateToURL(new URLRequest(info.getLinkUrl()), "_blank");
} else {
navigateToURL(new URLRequest("http://www.xvideos.com/"), "_blank");
};
}
public function ReDraw(){
background.width = this.stage.stageWidth;
background.height = this.stage.stageHeight;
text.y = ((this.stage.stageHeight / 2) - 10);
text.x = ((this.stage.stageWidth / 2) - (text.width / 2));
if (link != null){
link.y = (((this.stage.stageHeight / 2) - 10) + 40);
link.x = 0;
link.width = this.stage.stageWidth;
};
}
}
}//package player
Section 84
//VideoPlayerBox (player.VideoPlayerBox)
package player {
import fl.video.*;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.media.*;
import flash.system.*;
public class VideoPlayerBox extends Sprite {
private var videoplayer:Video;
private var picture:Bitmap;// = null
private var picture_loader:Loader;
private var netstream:NetStream;
private var netconnection:NetConnection;
private var soundClip:Sound;
private var ImageUrl:String;
private var VideoUrl:String;
private var _status:String;// = "waiting"
private var StartSeekPoint:Number;// = 0
private var TotalTimeLength:Number;// = 0
private var CurrentTimeLength:Number;// = 0
private var global_timer:Timer;
private var pictureTime:Timer;
private var preload:Boolean;// = false
private var TimeBeforeBuffering:Number;// = 0
private var fileTotalSize:Number;// = 1
private var seekpoints:Array;// = null
private var times:Array;// = null
private var positions:Array;// = null
private var stream_type:String;// = "nometa"
private var size_type:String;// = "keepratio"
private var auto_seek_done:Boolean;// = false
private var event_fifteenpercent_dispatched:Boolean;// = false
private var quality_sended:Boolean;// = false
private var quality_timestart:Number;// = 0
private var quality_timer:Timer;// = null
private var quality_callback:URLLoader;
public static const BUFFERING = "buffering";
public static const PLAYING = "playing";
public static const ERROR = "error";
public static const EVENT_UPDATE = "event_update";
public static const PAUSED = "paused";
public static const FINISHED = "finished";
public static const WAITING = "waiting";
public static const READY = "ready";
public static const FIFTEENPERCENTREACHED = "fifteenpercentreached";
public static const TYPE_FLV = "flv";
public static const TYPE_MP4 = "MP4";
public static const NO_META = "nometa";
public static const FULL_SIZE = "fullsize";
public static const KEEP_RATIO = "keepratio";
public static const ORI_SIZE = "orisize";
public static const HIGH_QUALITY = "highquality";
public function VideoPlayerBox(){
super();
this.addEventListener(Event.ADDED_TO_STAGE, InitVideoPlayer);
}
private function InitVideoPlayer(e:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, InitVideoPlayer);
trace("Loading ...");
netconnection = new NetConnection();
netconnection.connect(null);
netstream = new NetStream(netconnection);
netstream.client = this;
netstream.addEventListener(NetStatusEvent.NET_STATUS, _videoStateChangedHandler);
netstream.soundTransform = new SoundTransform();
videoplayer = new Video(320, 240);
videoplayer.smoothing = true;
netstream.bufferTime = 4;
this.addChild(videoplayer);
videoplayer.attachNetStream(netstream);
trace("Video ready");
trace("Flash player version : ", Capabilities.version);
global_timer = new Timer(500, 0);
global_timer.addEventListener(TimerEvent.TIMER, _videoStateChangedHandler);
global_timer.start();
ReDraw();
}
public function onLastSecond(info:Object):void{
trace("onLastSecond event");
}
public function onMetaData(info:Object):void{
_videoOnMetaDataHandler(info);
}
public function onCuePoint(info:Object):void{
trace(((((("cuepoint: time=" + info.time) + " name=") + info.name) + " type=") + info.type));
}
private function _videoOnMetaDataHandler(e:Object):void{
if (TotalTimeLength == 0){
TotalTimeLength = e.duration;
};
CurrentTimeLength = e.duration;
trace("TotalTimeLength : ", TotalTimeLength, " , CurrentTimeLength : ", CurrentTimeLength);
if (((e.keyframes) && ((this.times == null)))){
if (e.keyframes.times){
this.times = e.keyframes.times;
};
if (e.keyframes.filepositions){
this.positions = e.keyframes.filepositions;
};
};
if (((e.seekpoints) && ((this.seekpoints == null)))){
seekpoints = e.seekpoints;
};
if (((!((times == null))) && (!((positions == null))))){
stream_type = TYPE_FLV;
} else {
if (seekpoints != null){
stream_type = TYPE_MP4;
};
};
this.fileTotalSize = netstream.bytesTotal;
trace("Stream type detected : ", stream_type);
var info:InfoLoader = InfoLoader.GetInstance();
if (((!((info.getStartSeek() == 0))) && ((this.auto_seek_done == false)))){
this.auto_seek_done = true;
this.SeekTo(info.getStartSeek());
};
}
private function _videoStateChangedHandler(evt){
var curpos:Number;
var total:Number;
var event:Event = new Event(EVENT_UPDATE);
ReDraw();
if (preload){
netstream.pause();
return (false);
};
if ((evt is NetStatusEvent)){
trace("NetStatus Event : ", evt.info.code);
if (evt.info.code == "NetStream.Play.Start"){
if (picture != null){
picture.visible = false;
};
status = BUFFERING;
ReDraw();
};
if (evt.info.code == "NetStream.Play.StreamNotFound"){
status = ERROR;
ReDraw();
};
if (evt.info.code == "NetStream.Buffer.Full"){
trace("Buffer is full => Playing");
status = PLAYING;
ReDraw();
};
if (evt.info.code == "NetStream.Play.Stop"){
curpos = Math.round(GetCursorPosition());
total = (Math.round(GetTotalTime()) - 1);
if (GetTotalTime() == 0){
total = 9999;
};
trace("Empty : ", curpos, " Total : ", total);
if (curpos > total){
trace("Video at the End (2)");
status = FINISHED;
};
};
if ((((evt.info.code == "NetStream.Buffer.Empty")) && (!((status == FINISHED))))){
curpos = Math.round(GetCursorPosition());
total = (Math.round(GetTotalTime()) - 1);
if (GetTotalTime() == 0){
total = 9999;
};
trace("Empty : ", curpos, " Total : ", total);
if (curpos < total){
trace("Buffering empty");
if (status != BUFFERING){
if (netstream.time){
TimeBeforeBuffering = netstream.time;
};
status = BUFFERING;
};
} else {
trace("Video at the End");
status = FINISHED;
};
};
if (evt.info.code == "NetStream.Seek.Notify"){
trace("Buffer State ", getBufferState());
if (getBufferState() < 80){
if (GetCursorPosition() < (GetTotalTime() - 4)){
if (netstream.time){
TimeBeforeBuffering = netstream.time;
};
status = BUFFERING;
};
};
};
} else {
if (((!(event_fifteenpercent_dispatched)) && ((GetCursorPosition() > (GetTotalTime() * 0.15))))){
trace("Dispatch Fifteen Percent Event");
event_fifteenpercent_dispatched = true;
dispatchEvent(new Event(FIFTEENPERCENTREACHED));
};
if ((((netstream.bufferLength > 4)) && ((status == BUFFERING)))){
trace("Force playing => Buffer full");
status = PLAYING;
};
dispatchEvent(event);
};
}
public function getBufferState():int{
var buffPos:Number = GetBufferPosition();
var curPos:Number = GetCursorPosition();
var curDiff:* = (buffPos - curPos);
if (TotalTimeLength == 0){
curDiff = ((netstream.bytesLoaded / (netstream.bytesTotal * 0.07)) * netstream.bufferTime);
};
var ret:int = Math.round(((100 / netstream.bufferTime) * curDiff));
if (ret > 100){
ret = 100;
};
if (ret < 0){
ret = 0;
};
return (ret);
}
private function _videoReadyHandler(evt:VideoEvent){
picture.visible = false;
}
public function SetImageFile(file:String):void{
ImageUrl = file;
pictureTime = new Timer(3000, 3);
pictureTime.addEventListener(TimerEvent.TIMER, _pictureTimerHandler);
pictureTime.start();
loadPicture();
}
private function _pictureTimerHandler(e:Event):void{
if (picture == null){
loadPicture();
} else {
pictureTime.stop();
};
}
private function loadPicture():void{
var urlArr:Array = ImageUrl.split("/");
trace("Loading : ", urlArr[2]);
if (urlArr.length > 3){
Security.loadPolicyFile((((urlArr[0] + "//") + urlArr[2]) + "/crossdomain.xml"));
};
var urlrequest:URLRequest = new URLRequest(ImageUrl);
var myLoad:* = new Loader();
myLoad.load(new URLRequest(ImageUrl));
myLoad.contentLoaderInfo.addEventListener(Event.COMPLETE, handlerLoaderComplete);
}
private function handlerLoaderComplete(evt:Event){
var tmpMC:MovieClip;
var myBitmapData:BitmapData;
if ((((status == READY)) || ((status == WAITING)))){
if (picture == null){
tmpMC = new MovieClip();
tmpMC.addChild(evt.target.content);
myBitmapData = new BitmapData(tmpMC.width, tmpMC.height);
myBitmapData.draw(tmpMC);
picture = new Bitmap(myBitmapData);
picture.smoothing = true;
addChild(picture);
picture.width = this.stage.stageWidth;
picture.height = (this.stage.stageHeight - 25);
ReDraw();
status = READY;
};
};
}
private function _ThumbLoadedHandler(e:Event):void{
trace("Loaded");
addChild(picture_loader);
ReDraw();
}
public function SetVideoFile(file:String):void{
VideoUrl = file;
status = READY;
}
public function SeekTo(sec:Number):Boolean{
var index:*;
var urlArr:Array;
trace("Want Seek to : ", sec);
if ((((sec > GetBufferPosition())) || ((sec < StartSeekPoint)))){
if (stream_type == NO_META){
trace("Can't seek");
} else {
if (stream_type == TYPE_FLV){
index = getNearestKeyframeIndex(sec, times);
sec = times[index];
StartSeekPoint = sec;
trace("New start seek point : ", StartSeekPoint);
urlArr = VideoUrl.split("/");
if ((((urlArr.length > 3)) && ((urlArr[2] == "edgecast-video.xvideos.com")))){
trace("Opening : ", ((VideoUrl + "&ec_seek=") + positions[index]));
netstream.play(((VideoUrl + "&ec_seek=") + positions[index]));
} else {
trace("Opening : ", ((VideoUrl + "&fs=") + positions[index]));
netstream.play(((VideoUrl + "&fs=") + positions[index]));
};
TimeBeforeBuffering = StartSeekPoint;
status = BUFFERING;
} else {
if (stream_type == TYPE_MP4){
sec = getNearestSeekPoint(sec);
StartSeekPoint = sec;
trace("Opening : ", ((VideoUrl + "&ms=") + positions[index]));
netstream.play(((VideoUrl + "&ms=") + positions[index]));
TimeBeforeBuffering = 0;
status = BUFFERING;
};
};
};
} else {
if (stream_type == TYPE_FLV){
trace("Seek to : ", sec);
TimeBeforeBuffering = sec;
netstream.seek(sec);
} else {
trace("Seek to : ", (sec - StartSeekPoint));
TimeBeforeBuffering = 0;
netstream.seek((sec - StartSeekPoint));
};
};
return (false);
}
public function Play():Boolean{
trace("Entering Play()");
if (status == READY){
if (preload){
trace("Lauch video after prebuff");
preload = false;
status = BUFFERING;
if (picture != null){
picture.visible = false;
};
netstream.seek(0);
netstream.resume();
} else {
trace("Lauch Normale video playing");
status = BUFFERING;
netstream.play(VideoUrl);
};
};
if ((((status == PLAYING)) || ((status == PAUSED)))){
netstream.resume();
status = PLAYING;
};
return (true);
}
public function PreLoad(){
trace("Entering PreLoad");
if (status == READY){
if (!preload){
trace("Lauching preload");
preload = true;
netstream.play(VideoUrl);
};
};
}
public function Pause():Boolean{
if (status == PLAYING){
netstream.pause();
status = PAUSED;
return (true);
};
return (false);
}
public function ReStart():Boolean{
SeekTo(0);
return (Play());
}
public function Stop():Boolean{
return (false);
}
public function SetSoundVolume(volume:Number):void{
if (volume > 100){
volume = 100;
};
if (volume < 0){
volume = 0;
};
trace("Set sound volume : ", volume);
netstream.soundTransform = new SoundTransform((volume / 100));
}
public function SetLowQuality():void{
videoplayer.deblocking = 1;
videoplayer.smoothing = false;
}
public function SetHighQuality():void{
videoplayer.deblocking = 0;
videoplayer.smoothing = true;
}
public function GetBufferPosition():Number{
var curLength:Number;
var curExtimateSize:Number;
var BuffPosition:Number = StartSeekPoint;
if (CurrentTimeLength){
curLength = (CurrentTimeLength - StartSeekPoint);
curExtimateSize = ((this.fileTotalSize / TotalTimeLength) * curLength);
BuffPosition = (((curLength / curExtimateSize) * netstream.bytesLoaded) + StartSeekPoint);
} else {
BuffPosition = StartSeekPoint;
};
if (BuffPosition > TotalTimeLength){
BuffPosition = TotalTimeLength;
};
return (BuffPosition);
}
public function GetCursorPosition():Number{
var curpos:* = StartSeekPoint;
if (status != BUFFERING){
if (netstream.time){
if (stream_type == TYPE_FLV){
curpos = netstream.time;
} else {
curpos = (netstream.time + StartSeekPoint);
};
};
} else {
if (stream_type == TYPE_FLV){
curpos = TimeBeforeBuffering;
} else {
curpos = (TimeBeforeBuffering + StartSeekPoint);
};
};
return (curpos);
}
public function setResizeType(value:String){
if ((((((value == FULL_SIZE)) || ((value == KEEP_RATIO)))) || ((value == ORI_SIZE)))){
size_type = value;
ReDraw();
};
}
public function GetTotalTime():Number{
return (TotalTimeLength);
}
public function GetStartSeekTime():Number{
return (StartSeekPoint);
}
public function ReDraw():void{
var ratio:Number;
var cur_ratio:Number;
if (size_type == FULL_SIZE){
videoplayer.width = this.stage.stageWidth;
videoplayer.height = (this.stage.stageHeight - 25);
videoplayer.x = 0;
videoplayer.y = 0;
};
if (size_type == KEEP_RATIO){
videoplayer.x = 0;
videoplayer.y = 0;
ratio = (videoplayer.videoWidth / videoplayer.videoHeight);
cur_ratio = (this.stage.stageWidth / this.stage.stageHeight);
if (cur_ratio < ratio){
videoplayer.width = this.stage.stageWidth;
videoplayer.height = (videoplayer.width / ratio);
videoplayer.y = (Math.round(((this.stage.stageHeight / 2) - (videoplayer.height / 2))) - (25 / 2));
} else {
videoplayer.height = (this.stage.stageHeight - 25);
videoplayer.width = (videoplayer.height * ratio);
videoplayer.x = Math.round(((this.stage.stageWidth / 2) - (videoplayer.width / 2)));
};
};
if (size_type == ORI_SIZE){
videoplayer.width = videoplayer.videoWidth;
videoplayer.height = videoplayer.videoHeight;
videoplayer.x = Math.round(((this.stage.stageWidth / 2) - (videoplayer.width / 2)));
videoplayer.y = Math.round(((this.stage.stageHeight / 2) - (videoplayer.height / 2)));
};
if (picture != null){
picture.height = (this.stage.stageHeight - 25);
picture.width = (this.stage.stageHeight * 1.4);
if (picture.width > this.stage.stageWidth){
picture.width = this.stage.stageWidth;
picture.height = ((this.stage.stageWidth / 1.4) - 25);
};
picture.x = Math.round(((this.stage.stageWidth / 2) - (picture.width / 2)));
picture.y = Math.round((((this.stage.stageHeight / 2) - (picture.height / 2)) - 12));
};
}
public function get status():String{
return (_status);
}
public function set status(value:String):void{
var date:Date;
var rand:Number;
if (preload){
return;
};
if (value == _status){
return;
};
trace("New State : ", value);
if (value == BUFFERING){
date = new Date();
quality_timestart = date.getTime();
if (quality_timer == null){
trace("Setup quality timer");
quality_timer = new Timer(10000, 1);
quality_timer.addEventListener(TimerEvent.TIMER, _qualityTimerTimeout);
quality_timer.start();
};
};
if ((((((value == PLAYING)) || ((value == ERROR)))) && (!(quality_sended)))){
quality_sended = true;
rand = Math.random();
this.sendQualityCallBack((value == ERROR));
};
_status = value;
var event:Event = new Event(value);
dispatchEvent(event);
}
private function sendQualityCallBack(error:Boolean){
var date:Date = new Date();
var length:Number = (date.getTime() - quality_timestart);
if (error){
length = -1;
};
var info:InfoLoader = InfoLoader.GetInstance();
trace("Send : ", info.getVideoId(), " => ", length, " ms");
info.sendBufferStats(length);
}
private function _qualityTimerTimeout(e:Event){
quality_timer.stop();
if (quality_sended){
return;
};
trace("QualityTime : Send timeout");
var info:InfoLoader = InfoLoader.GetInstance();
info.sendBufferStats(-2);
}
private function _qualityCallBanckHandler(e:Event){
trace("_qualityCallBanckHandler Finished");
}
private function getNearestKeyframeIndex(second, keyFrameArray){
var index1:* = 0;
var index2:* = 0;
var i:* = 0;
while (i < times.length) {
if (times[i] < second){
index1 = i;
} else {
index2 = i;
break;
};
i++;
};
if ((second - keyFrameArray[index1]) < (keyFrameArray[index2] - second)){
return (index1);
};
return (index2);
}
function getNearestSeekPoint(second){
var index1:* = 0;
var index2:* = 0;
var i:* = 0;
while (i < seekpoints.length) {
if (seekpoints[i]["time"] < second){
index1 = i;
} else {
index2 = i;
break;
};
i++;
};
var diff1:* = Math.abs((seekpoints[index1]["time"] - second));
var diff2:* = Math.abs((seekpoints[index2]["time"] - second));
if (diff1 < diff2){
return (seekpoints[index1]["time"]);
};
return (seekpoints[index2]["time"]);
}
}
}//package player
Section 85
//Button_disabledSkin (Button_disabledSkin)
package {
import flash.display.*;
public dynamic class Button_disabledSkin extends MovieClip {
}
}//package
Section 86
//Button_downSkin (Button_downSkin)
package {
import flash.display.*;
public dynamic class Button_downSkin extends MovieClip {
}
}//package
Section 87
//Button_emphasizedSkin (Button_emphasizedSkin)
package {
import flash.display.*;
public dynamic class Button_emphasizedSkin extends MovieClip {
}
}//package
Section 88
//Button_overSkin (Button_overSkin)
package {
import flash.display.*;
public dynamic class Button_overSkin extends MovieClip {
}
}//package
Section 89
//Button_selectedDisabledSkin (Button_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDisabledSkin extends MovieClip {
}
}//package
Section 90
//Button_selectedDownSkin (Button_selectedDownSkin)
package {
import flash.display.*;
public dynamic class Button_selectedDownSkin extends MovieClip {
}
}//package
Section 91
//Button_selectedOverSkin (Button_selectedOverSkin)
package {
import flash.display.*;
public dynamic class Button_selectedOverSkin extends MovieClip {
}
}//package
Section 92
//Button_selectedUpSkin (Button_selectedUpSkin)
package {
import flash.display.*;
public dynamic class Button_selectedUpSkin extends MovieClip {
}
}//package
Section 93
//Button_upSkin (Button_upSkin)
package {
import flash.display.*;
public dynamic class Button_upSkin extends MovieClip {
}
}//package
Section 94
//CheckBox_disabledIcon (CheckBox_disabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_disabledIcon extends MovieClip {
}
}//package
Section 95
//CheckBox_downIcon (CheckBox_downIcon)
package {
import flash.display.*;
public dynamic class CheckBox_downIcon extends MovieClip {
}
}//package
Section 96
//CheckBox_overIcon (CheckBox_overIcon)
package {
import flash.display.*;
public dynamic class CheckBox_overIcon extends MovieClip {
}
}//package
Section 97
//CheckBox_selectedDisabledIcon (CheckBox_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDisabledIcon extends MovieClip {
}
}//package
Section 98
//CheckBox_selectedDownIcon (CheckBox_selectedDownIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDownIcon extends MovieClip {
}
}//package
Section 99
//CheckBox_selectedOverIcon (CheckBox_selectedOverIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedOverIcon extends MovieClip {
}
}//package
Section 100
//CheckBox_selectedUpIcon (CheckBox_selectedUpIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedUpIcon extends MovieClip {
}
}//package
Section 101
//CheckBox_upIcon (CheckBox_upIcon)
package {
import flash.display.*;
public dynamic class CheckBox_upIcon extends MovieClip {
}
}//package
Section 102
//close (close)
package {
import flash.display.*;
public dynamic class close extends SimpleButton {
}
}//package
Section 103
//close_button (close_button)
package {
import flash.display.*;
public dynamic class close_button extends SimpleButton {
}
}//package
Section 104
//FlashPlayerV1 (FlashPlayerV1)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import player.*;
import flash.system.*;
import flash.external.*;
public class FlashPlayerV1 extends Sprite {
private var toolbar:ToolBar;
private var loadingmess:Loading;
private var videoplayer:VideoPlayerBox;
private var buffering:Buffering;
private var bigplaybt:BigPlayBt;
private var relatedmenu:RelatedMenu;
private var embedmenu:EmbedMenu;
private var reportpoppup:ReportPoppup;
private var errorVideo:VideoError;// = null
private var videodelete:VideoDeleted;
private var quality_callback:URLLoader;
private var _popupCookie:SharedObject;
private var _poppupTimer:Timer;
private var _loadedInfoCalled:Boolean;// = false
private var javascript_txt:String;
public static const MENU_RELATED = "menu_related";
public static const MENU_REPORT = "menu_report";
public static const MENU_EMBED = "menu_embed";
public static const MENU_2257 = "menu_2257";
public static const REPLAY = "replay";
public static const SHOW_PREVIEW_PICTURES = "show_preview_pictures";
public function FlashPlayerV1(){
super();
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
this.stage.addEventListener(Event.RESIZE, _stageResizeHandler);
videoplayer = new VideoPlayerBox();
videoplayer.addEventListener(VideoPlayerBox.EVENT_UPDATE, _videoUpdateStatusHandler);
videoplayer.addEventListener(VideoPlayerBox.BUFFERING, _videoBufferingHandler);
videoplayer.addEventListener(VideoPlayerBox.PLAYING, _videoPlayingHandler);
videoplayer.addEventListener(VideoPlayerBox.PAUSED, _videoPauseHandler);
videoplayer.addEventListener(VideoPlayerBox.READY, _videoReadyHandler);
videoplayer.addEventListener(VideoPlayerBox.FINISHED, _videoFinishedHandler);
videoplayer.addEventListener(VideoPlayerBox.ERROR, _videoErrorHandler);
videoplayer.addEventListener(VideoPlayerBox.FIFTEENPERCENTREACHED, _videoFifteenPercentHandler);
videoplayer.addEventListener(MouseEvent.CLICK, _videoInvertHandler);
this.addChild(videoplayer);
bigplaybt = new BigPlayBt();
bigplaybt.addEventListener(ToolBar.PLAY_PRESSED, _playPressedHandler);
this.addChild(bigplaybt);
loadingmess = new Loading();
this.addChild(loadingmess);
buffering = new Buffering();
this.addChild(buffering);
embedmenu = new EmbedMenu();
this.addChild(embedmenu);
reportpoppup = new ReportPoppup();
this.addChild(reportpoppup);
relatedmenu = new RelatedMenu();
relatedmenu.addEventListener(FlashPlayerV1.MENU_EMBED, _embedMenuHandler);
relatedmenu.addEventListener(FlashPlayerV1.REPLAY, _replayHandler);
this.addChild(relatedmenu);
toolbar = new ToolBar();
toolbar.addEventListener(ToolBar.VOLUME_CHANGE, _volumeChangedHandler);
toolbar.addEventListener(ToolBar.PLAY_PRESSED, _playPressedHandler);
toolbar.addEventListener(ToolBar.PAUSE_PRESSED, _pausePressedHandler);
toolbar.addEventListener(ToolBar.FULLSCREEN_PRESSED, _fullscreenPressedHandler);
toolbar.addEventListener(ToolBar.TIME_LINE_CHANGED, _timelineChangedHandler);
toolbar.addEventListener(VideoPlayerBox.HIGH_QUALITY, _highQualityHandler);
toolbar.addEventListener(VideoPlayerBox.FULL_SIZE, _videoSizeHandler);
toolbar.addEventListener(VideoPlayerBox.KEEP_RATIO, _videoSizeHandler);
toolbar.addEventListener(VideoPlayerBox.ORI_SIZE, _videoSizeHandler);
toolbar.addEventListener(FlashPlayerV1.MENU_EMBED, _embedMenuHandler);
toolbar.addEventListener(FlashPlayerV1.MENU_RELATED, _relatedMenuHandler);
toolbar.addEventListener(FlashPlayerV1.MENU_REPORT, _reportMenuHandler);
toolbar.addEventListener(FlashPlayerV1.MENU_2257, _record2257MenuHandler);
toolbar.addEventListener(FlashPlayerV1.SHOW_PREVIEW_PICTURES, _showPreviewPicturesHandler);
this.addChild(toolbar);
toolbar.Disable();
var infoloader:InfoLoader = InfoLoader.GetInstance();
infoloader.addEventListener(InfoLoader.LOADED, _infoLoaderLoadedHandler);
infoloader.addEventListener(InfoLoader.ERROR, _infoLoaderErrorHandler);
infoloader.loadParameters(this.stage.loaderInfo.parameters);
Security.loadPolicyFile((infoloader.getHttpProtocol() + "www.xvideos.com/crossdomain.xml"));
_stageResizeHandler(new Event(Event.RESIZE));
toolbar.loadPrefFromCookies();
}
private function _record2257MenuHandler(e:Event):void{
var info:InfoLoader = InfoLoader.GetInstance();
navigateToURL(new URLRequest(info.getRecord2257()), "_blank");
}
private function _videoErrorHandler(e:Event):void{
var info:InfoLoader = InfoLoader.GetInstance();
if (!info.forceRPCLauch()){
bigplaybt.Hide();
toolbar.Disable();
buffering.Desappear();
errorVideo = new VideoError(VideoError.DELAYED);
this.addChild(errorVideo);
if (!info.getIsEmbed()){
quality_callback = new URLLoader(new URLRequest(((((info.getHttpProtocol() + "www.xvideos.com/video-get-failed/") + info.getVideoId()) + "/") + info.getCdnId())));
quality_callback.addEventListener(Event.COMPLETE, _qualityCallBackHandler);
};
};
}
private function _qualityCallBackHandler(e:Event){
trace("_qualityCallBackHandler Finished");
}
private function _videoInvertHandler(e:Event):void{
var info:InfoLoader = InfoLoader.GetInstance();
if (info.getIsEmbed()){
videoplayer.Pause();
if (info.getLinkUrl() == ""){
navigateToURL(new URLRequest((info.getHttpProtocol() + "/www.xvideos.com/")), "_blank");
} else {
navigateToURL(new URLRequest(((info.getLinkUrl() + "#") + videoplayer.GetCursorPosition().toFixed(1))), "_blank");
};
} else {
if (videoplayer.status == VideoPlayerBox.PAUSED){
videoplayer.Play();
bigplaybt.Hide();
} else {
if (videoplayer.status == VideoPlayerBox.PLAYING){
videoplayer.Pause();
bigplaybt.Display();
};
};
};
}
private function _replayHandler(e:Event):void{
videoplayer.ReStart();
toolbar.hideMenu();
relatedmenu.hideMenu();
reportpoppup.hideWindow();
bigplaybt.Hide();
embedmenu.hideMenu();
}
private function _videoFinishedHandler(e:Event):void{
toolbar.hideMenu();
relatedmenu.showMenu();
reportpoppup.hideWindow();
videoplayer.Pause();
}
private function _videoFifteenPercentHandler(e:Event):void{
toolbar.closeSponsorPoppup();
}
private function _pausePressedHandler(e:Event):void{
videoplayer.Pause();
}
private function _embedMenuHandler(e:Event):void{
toolbar.hideMenu();
relatedmenu.hideMenu();
embedmenu.showMenu();
reportpoppup.hideWindow();
videoplayer.Pause();
}
private function _relatedMenuHandler(e:Event):void{
toolbar.hideMenu();
relatedmenu.showMenu();
embedmenu.hideMenu();
reportpoppup.hideWindow();
videoplayer.Pause();
}
private function _reportMenuHandler(e:Event):void{
toolbar.hideMenu();
reportpoppup.showWindow();
embedmenu.hideMenu();
relatedmenu.hideMenu();
videoplayer.Pause();
}
private function _highQualityHandler(e:Event):void{
var elt:MenuElt = (e.target as MenuElt);
if (elt.checked){
videoplayer.SetHighQuality();
} else {
videoplayer.SetLowQuality();
};
}
private function _showPreviewPicturesHandler(e:Event):void{
var elt:MenuElt = (e.target as MenuElt);
if (elt.checked){
toolbar.timeline.displayPicturePreview = true;
} else {
toolbar.timeline.displayPicturePreview = false;
};
}
private function _videoSizeHandler(e:Event):void{
videoplayer.setResizeType(e.type);
}
private function _videoReadyHandler(e:Event):void{
var loaded_callback:*;
var info:InfoLoader = InfoLoader.GetInstance();
if (info.getIsDeleted()){
trace("Video deleted");
videodelete = new VideoDeleted();
addChild(videodelete);
} else {
trace("Video Ok, Loaded");
ExternalInterface.call("eval", "(function() {\n deferUntiljQuery(loadPopup); \r\n})();\r\n");
//unresolved jump
var _slot1 = e;
bigplaybt.Display();
buffering.Desappear();
toolbar.setPlayBt();
embedmenu.ReDraw();
toolbar.ReDraw();
_stageResizeHandler(new Event(Event.RESIZE));
if (((((!(this._loadedInfoCalled)) && (!(info.getIsEmbed())))) && (info.getVideoId()))){
this._loadedInfoCalled = true;
loaded_callback = new URLLoader(new URLRequest(((((info.getHttpProtocol() + "www.xvideos.com/flash_loaded/") + info.getVideoId()) + "/") + info.getCdnId())));
loaded_callback.addEventListener(Event.COMPLETE, _loadedCallBackHandler);
};
};
}
private function _loadedCallBackHandler(e:Event){
trace("_loadedCallBackHandler Finished");
}
private function _videoPauseHandler(e:Event):void{
toolbar.setPlayBt();
bigplaybt.Display();
}
private function _videoPlayingHandler(e:Event):void{
toolbar.setPauseBt();
relatedmenu.hideMenu();
embedmenu.hideMenu();
bigplaybt.Hide();
reportpoppup.hideWindow();
buffering.Desappear();
}
private function _videoBufferingHandler(e:Event):void{
toolbar.setHideAllBt();
bigplaybt.Hide();
relatedmenu.hideMenu();
buffering.GoAppear();
}
private function _videoUpdateStatusHandler(e:Event):void{
toolbar.timeline.totalLength = videoplayer.GetTotalTime();
toolbar.timeline.endPosition = videoplayer.GetBufferPosition();
toolbar.timeline.startPosition = videoplayer.GetStartSeekTime();
toolbar.timeline.cursorPosition = videoplayer.GetCursorPosition();
if (videoplayer.status == VideoPlayerBox.BUFFERING){
buffering.SetProgression(videoplayer.getBufferState());
};
}
private function _infoLoaderLoadedHandler(e:Event):void{
var infoloader:InfoLoader;
trace("Info loaded");
var info:InfoLoader = InfoLoader.GetInstance();
if (info.getIsDeleted()){
loadingmess.isDisplayed = false;
errorVideo = new VideoError(VideoError.DELETED);
this.addChild(errorVideo);
} else {
loadingmess.isDisplayed = false;
infoloader = InfoLoader.GetInstance();
videoplayer.SetVideoFile(infoloader.getVideoUrl());
videoplayer.SetImageFile(infoloader.getThumbUrl());
toolbar.timeline.infoLoaded();
relatedmenu.loadRelated();
_stageResizeHandler(new Event(Event.RESIZE));
toolbar.InfoLoaded();
if (info.getStartSeek() != 0){
_playPressedHandler(e);
};
};
}
private function _infoLoaderErrorHandler(e:Event):void{
loadingmess.isDisplayed = false;
errorVideo = new VideoError(VideoError.ERROR);
this.addChild(errorVideo);
}
private function _stageResizeHandler(e:Event):void{
trace("Resize box");
toolbar.ReDraw();
loadingmess.ReDraw();
videoplayer.ReDraw();
buffering.ReDraw();
bigplaybt.ReDraw();
relatedmenu.ReDraw();
embedmenu.ReDraw();
reportpoppup.ReDraw();
if (errorVideo != null){
errorVideo.ReDraw();
};
}
private function _timelineChangedHandler(e:Event):void{
videoplayer.SeekTo(toolbar.timeline.seekPosition);
trace("Timeline Changed");
}
private function _fullscreenPressedHandler(e:Event):void{
if (this.stage.displayState != StageDisplayState.FULL_SCREEN){
this.stage.displayState = StageDisplayState.FULL_SCREEN;
} else {
this.stage.displayState = StageDisplayState.NORMAL;
};
trace("Fullscreen Pressed");
}
private function _playPressedHandler(e:Event):void{
var info:InfoLoader;
var e = e;
var canpopup:Boolean;
var date:Date = new Date();
info = InfoLoader.GetInstance();
ExternalInterface.call("eval", "if (window.openpop) { window.openpop(); }");
//unresolved jump
var _slot1 = e;
if (info.getIsEmbed()){
errorVideo = new VideoError(VideoError.MODIFY);
this.addChild(errorVideo);
return;
};
if (!info.getIsEmbed()){
trace("Is not embed !");
} else {
trace("Is Embed !");
};
videoplayer.Play();
trace("Play Pressed");
toolbar.Enable();
}
private function _poppupFocusWindow(e:Event):void{
trace("Send focus order");
ExternalInterface.call("window.focus()");
}
private function _volumeChangedHandler(e:Event):void{
videoplayer.SetSoundVolume(toolbar.soundbar.volume);
trace("Volume changed : ", toolbar.soundbar.volume);
}
}
}//package
Section 105
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 106
//FullScreenBtHitTest (FullScreenBtHitTest)
package {
import flash.display.*;
public dynamic class FullScreenBtHitTest extends MovieClip {
}
}//package
Section 107
//FullScreenBtHover (FullScreenBtHover)
package {
import flash.display.*;
public dynamic class FullScreenBtHover extends MovieClip {
public function FullScreenBtHover(){
addFrameScript(13, frame14);
}
function frame14(){
stop();
}
}
}//package
Section 108
//FullScreenBtNormal (FullScreenBtNormal)
package {
import flash.display.*;
public dynamic class FullScreenBtNormal extends MovieClip {
}
}//package
Section 109
//icon_resize (icon_resize)
package {
import flash.display.*;
public dynamic class icon_resize extends BitmapData {
public function icon_resize(w:int=16, h:int=16){
super(w, h);
}
}
}//package
Section 110
//icon_sound (icon_sound)
package {
import flash.display.*;
public dynamic class icon_sound extends BitmapData {
public function icon_sound(w:int=19, h:int=19){
super(w, h);
}
}
}//package
Section 111
//icon_sound_mute (icon_sound_mute)
package {
import flash.display.*;
public dynamic class icon_sound_mute extends BitmapData {
public function icon_sound_mute(w:int=19, h:int=19){
super(w, h);
}
}
}//package
Section 112
//logo_xvideos (logo_xvideos)
package {
import flash.display.*;
public dynamic class logo_xvideos extends BitmapData {
public function logo_xvideos(w:int=105, h:int=20){
super(w, h);
}
}
}//package
Section 113
//MenuButton (MenuButton)
package {
import flash.display.*;
public dynamic class MenuButton extends MovieClip {
}
}//package
Section 114
//PauseBtClicked (PauseBtClicked)
package {
import flash.display.*;
public dynamic class PauseBtClicked extends MovieClip {
}
}//package
Section 115
//PauseBtHitTest (PauseBtHitTest)
package {
import flash.display.*;
public dynamic class PauseBtHitTest extends MovieClip {
}
}//package
Section 116
//PauseBtHover (PauseBtHover)
package {
import flash.display.*;
public dynamic class PauseBtHover extends MovieClip {
}
}//package
Section 117
//pausebutton (pausebutton)
package {
import flash.display.*;
public dynamic class pausebutton extends SimpleButton {
}
}//package
Section 118
//PlayBtClicked (PlayBtClicked)
package {
import flash.display.*;
public dynamic class PlayBtClicked extends MovieClip {
}
}//package
Section 119
//PlayBtHitTest (PlayBtHitTest)
package {
import flash.display.*;
public dynamic class PlayBtHitTest extends MovieClip {
}
}//package
Section 120
//PlayBtHover (PlayBtHover)
package {
import flash.display.*;
public dynamic class PlayBtHover extends MovieClip {
public function PlayBtHover(){
addFrameScript(5, frame6);
}
function frame6(){
stop();
}
}
}//package
Section 121
//PlayBtNormal (PlayBtNormal)
package {
import flash.display.*;
public dynamic class PlayBtNormal extends MovieClip {
}
}//package
Section 122
//playbutton (playbutton)
package {
import flash.display.*;
public dynamic class playbutton extends SimpleButton {
}
}//package
Section 123
//RadioButton_disabledIcon (RadioButton_disabledIcon)
package {
import flash.display.*;
public dynamic class RadioButton_disabledIcon extends MovieClip {
}
}//package
Section 124
//RadioButton_downIcon (RadioButton_downIcon)
package {
import flash.display.*;
public dynamic class RadioButton_downIcon extends MovieClip {
}
}//package
Section 125
//RadioButton_overIcon (RadioButton_overIcon)
package {
import flash.display.*;
public dynamic class RadioButton_overIcon extends MovieClip {
}
}//package
Section 126
//RadioButton_selectedDisabledIcon (RadioButton_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedDisabledIcon extends MovieClip {
}
}//package
Section 127
//RadioButton_selectedDownIcon (RadioButton_selectedDownIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedDownIcon extends MovieClip {
}
}//package
Section 128
//RadioButton_selectedOverIcon (RadioButton_selectedOverIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedOverIcon extends MovieClip {
}
}//package
Section 129
//RadioButton_selectedUpIcon (RadioButton_selectedUpIcon)
package {
import flash.display.*;
public dynamic class RadioButton_selectedUpIcon extends MovieClip {
}
}//package
Section 130
//RadioButton_upIcon (RadioButton_upIcon)
package {
import flash.display.*;
public dynamic class RadioButton_upIcon extends MovieClip {
}
}//package
Section 131
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 132
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 133
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 134
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 135
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 136
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 137
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 138
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 139
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 140
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 141
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 142
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 143
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 144
//show (show)
package {
import flash.display.*;
public dynamic class show extends SimpleButton {
}
}//package
Section 145
//TextArea_disabledSkin (TextArea_disabledSkin)
package {
import flash.display.*;
public dynamic class TextArea_disabledSkin extends MovieClip {
}
}//package
Section 146
//TextArea_upSkin (TextArea_upSkin)
package {
import flash.display.*;
public dynamic class TextArea_upSkin extends MovieClip {
}
}//package
Section 147
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 148
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package