Diskuze: ActionScript - Úprava kódu


Podle mne, v tomto kodu neni nic, co by resilo "nointernet". Ale ja action nerozumim. Jen tak jako jsem zkoukl kod. Jedine, kde by mohl byt problem je v tom, ze cely ten kod probiha jako XML onload. Nevim, jak je to v action, ale v javascriptu nefunguje stav sucess
function initLoadConfig()
{
var config_xml = new XML();
config_xml.ignoreWhite = true;
config_xml.onLoad = function(success) // ##########
{
if(success) // ####
{
parseConfig(config_xml);
}
};
config_xml.load(configData);
}
// js xml
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && !done) { // ####
done = true;
callback(
!!(
xhr.responseXML &&
xhr.responseXML.title &&
xhr.responseXML.title === "&&<"
),
);
// state nabyva techto hodnot
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState
// starsi verze js
xhr.onload = () => {
if (xhr.readyState === xhr.DONE && xhr.status === 200) { // tady pocita s tim, ze state musi byt done (asi 4 a soucastne status 200)
console.log(xhr.response, xhr.responseXML);
}
};
// jenze, problem je jedna z tech podminek nenastane, pokud to spustis jako "file:///C:/.../soubor"
// a zas, kdyz to tam nemas, tak to nefunguje z internetu :)
// konkretne tusim xhr.status === 200 = internet, status=0 z disku (cokoliv jineho nez 200 obvykle znamena chyba)
// ve tvem pripade je to vse zahrnute do slova success
Mas tedy moznost, spoustet to pres server (nainstalovat si treba wamp server
- php + apatche) a spoustet to jako http://localhost/
Nebo to dat na server.
Samozrejme, muzes asi tu podminku upravit i pro moznost
file:///C:/
, ale to ti neporadim, jake se dela v action.
V JS jsem to tusim resil nejakou slozitou klickou, kdy jsem parsoval url a
zjistoval, zda se pouziva protokol file nebo http a podle toho zakoazoval
detekci toho stavu. Jenze, kdyby nastala nejaka chyba, tak to pak muj kod
povazoval za success. Asi se to musi delat jinak No, kazdopadne jsem brzo presel na
spousteni pres localhost, server na disku.
google = action script run from disk file xml request
A, tak, musis to spoustet jako xml? Co to tam vypsat tim scriptem proste napevno, bez toho, aby loadoval xml z netu?
Ostatne, pres file by to nemel webovy prohlizec normalne dovolit, protoze je
tak mozne cist a krast soubory z disku a posilat je na internet. Proto se uz
flash nesmi pouzivat A nikdo
seriozni by si ho na web nedaval.
vis, jakoze, u win presne vis, jak se soubor jmenuje a kde se obvykle nachazi.
tak si jej zkusis nacist, kdyz znas cestu. A kdyz to vyjde, obsah hned odesilas
na internet
Ja som sa pri skúškach zameral najmä na túto časť kódu:
while(_loc1_ != null)
{
if(_loc1_.nodeName == "productname")
{
_loc2_ = _loc1_.firstChild.nodeValue;
}
else if(_loc1_.nodeName == "nointernethead")
{
_loc3_ = _loc1_.firstChild.nodeValue;
}
else if(_loc1_.nodeName == "nointernetmain")
{
_loc4_ = _loc1_.firstChild.nodeValue;
break;
}
_loc1_ = _loc1_.nextSibling;
}
- osobne si myslím, že v tejto časti je možnosť riešenia, kde sa vyhodnocuje cyklus s podmienkami
- skúšal som to znegovať opačne, že while(_loc1_ = null) namiesto pôvodnej podmienky, že sa nerovná while(_loc1_ != null)
- potom takisto v jednotlivých podmienkach If, aby som aspoň obrátil stav naopak, ale určite som tam spravil nejakú chybu a preto som sa skúsil na to opýtať tuto na fóre
Potom mi ešte napadlo, že celý ten kód upraviť tak, aby vykonávací
súbor *.swf len čítal zo súboru *.xml a vôbec nič by nevyhodnocoval
žiadnym cyklom a ani podmienkami a tým by sa tie 3 výrazy proste len
prečítali.
Táto úvodná časť kódu podľa mňa musí existovať:
function initLoadConfig()
{
var config_xml = new XML();
config_xml.ignoreWhite = true;
config_xml.onLoad = function(success)
{
if(success)
{
parseConfig(config_xml);
// tu by mohli byť len čítané výrazy z premenných súboru *.xml
}
};
config_xml.load(configData);
}
var configData = "resources/config.xml";
initLoadConfig();
Restorator:22.4.2024 19:13
Ale mňa tiež zaujal vyhodnocovací výraz function(success), či sa to týka len správneho načítania súboru *xml, alebo sa to vzťahuje aj k nejakej časti kódu v *.exe súbore samotného programu, ktorý vyhodnocuje stav pripojenia k internetu. Doteraz nerozumiem, prečo sa vôbec vyhodnocovalo pripojenie k internetu, keď sa pri ikone F v screene vždy objavia len texty a nie klikateľný odkaz, ale i v tomto prípade by to bolo ešte viac nelogické, aby sa tie preložené výrazy zobrazili ako odkaz len vtedy, keď je pripojenie k internetu neaktívne. Celé mi to nedáva zmysel.
inak ten wamp server som nepochopil, čo to má spoločné s nainštalovaným
programom Adobe Fireworks
config_xml.load(configData); // napada mne to napsat nejak takhle, ale tohle je js kod, proste tam dat to xml primo
// takze zbytek kodu v podstate nepotrebujes
---
// na radek, kde mas
//initLoadConfig(); // ten radek zakomentujes a misto nej das primo kod (jenze ten muj je pro javascript, viz https://scrapfly.io/blog/how-to-parse-xml/)
const xmlData = `
<root>
<products>
<product>
<name attribute="product_name">Dark Red Energy Potion</name>
<price attribute="product_price">$4.99</price>
<rate attribute="product_rate">4.7</rate>
<description attribute="product_description">Bring out the best in your gaming performance.</description>
</product>
</products>
</root>
`;
parseConfig(xmlData);
Ja si myslim, ze problem bude prave v tom, ze to nacita externi soubor a v xml-requestu. Moderni veci to proste blokuji, nacitani z disku a ne ze serveru.
while(_loc1_ != null) ...
Tahle cast dela jen to, ze ten soubor parsuje. Jestli vis, jak, zkus si
vypisovat nejaky text a uvidis, na kterem radku to skonci. Podle mne, na tu
funkci s parsovanim vubec nedojde
function initLoadConfig()
{
var config_xml = new XML();
config_xml.ignoreWhite = true;
vypis(1) // v js bych pouzil alert(1) nebo console.log(1) (action script neznam, nevim, jak se tam ladi program)
config_xml.onLoad = function(success)
{
vypis(2)
if(success)
{
vypis(3)
parseConfig(config_xml);
vypis(4)
// tu by mohli byť len čítané výrazy z premenných súboru *.xml
}
};
config_xml.load(configData);
}
--
function parseConfig(config_xml)
{
vypis(5)
var _loc1_ = config_xml.firstChild.firstChild;
while(_loc1_ != null)
{
var _loc0_ = null;
if((_loc0_ = _loc1_.nodeName) === "strings")
{
parseStringResources(_loc1_);
}
_loc1_ = _loc1_.nextSibling;
}
}
A, podle mne, se vypise 1, max 2, ale 3 uz ne.
Ale, pokud se pletu, tak by to melo vypsat 12354. Cili, nacteni souboru projde
pres success 123 a spusti se parsovani 5 a pokracuje dal v programu 4.
jakoze, kdyz nedojde na parsovani, tak se ten while vubec nespusti. Nebo by to slo takto (a vsechen dalsi kod je zbytecny, pokud to tam davas primo)
function concatenateProductString(headerText, productName)
{
var _loc2_ = headerText.indexOf("^p");
var _loc3_ = headerText.substring(0,_loc2_) + productName + headerText.substring(_loc2_ + 2,headerText.length);
return _loc3_;
}
var _loc2_ = undefined;
var _loc3_ = undefined;
var _loc4_ = undefined;
var _loc6_ = undefined;
_loc2_ = "text1";
_loc3_ = "text2";
_loc4_ = "text3";
_loc6_ = concatenateProductString(_loc3_,_loc2_);
tbDefault.strHead.text = _loc6_; // akorat nevim, co je tbDefault, asi nejaka globalni promena
tbDefault.strMain.text = _loc4_;
na predposlednom riadku je zápis:
var configData = "resources/config.xml";
ten znamená, že súbor *.xml je načítavaný interne, nie externe .. v koreňovom adresári programu je normálny priečinok "resources" a v ňom súbor config.xml, o ktorom sa bavíme
Čo sa týka všetkého, čo sme prebrali, tak je pravda to, že nebude závisieť len na jednej funkcii, pretože napr. funkcia concatenateProductString(headerText, productName) zabezpečuje správne zlúčenie tých troch textov s prekladom, čiže tam musí byť tiež.
Ja som mal skôr na mysli to, že tento celý kód by sa obišiel bez zápisov while a if, aby sa tam nerozhodovalo o premennných takýmto spôsobom, pretože pri zavádzaní súboru *.xml je k tomu na začiatku príslušná funkcia initLoadConfig() a potom v rámci deklarácie premenných var _loc (s jednotlivými číslami) by to chcelo už len čítať tie tri výrazy s prekladom zo súboru config.xml a za tým by nasledovala funkcia pre zlúčenie strings. Funkcia na odkliknutie tam absolútne nemusí byť a zápis var configData = "resources/config.xml"; initLoadConfig(); by tam samozrejme musel byť tiež.
takže niečo takéto:
function initLoadConfig()
{
var config_xml = new XML();
config_xml.ignoreWhite = true;
config_xml.onLoad = function(success)
{
if(success)
{
parseConfig(config_xml);
}
};
config_xml.load(configData);
}
function parseConfig(config_xml)
{
var _loc1_ = config_xml.firstChild.firstChild;
// odtiaľ nižšie sa podľa mňa musí o niečom rozhodovať, čo má vplyv na celé vyhodnotenie strings vrátane ich zobrazenia, ak užívateľ nie je pripojený k internetu, pričom to vyhodnocuje .exe súbor programu
while(_loc1_ != null)
{
var _loc0_ = null;
if((_loc0_ = _loc1_.nodeName) === "strings")
{
parseStringResources(_loc1_);
}
_loc1_ = _loc1_.nextSibling;
}
}
function parseStringResources(xN)
{
var _loc2_ = undefined;
var _loc3_ = undefined;
var _loc4_ = undefined;
var _loc6_ = undefined;
var _loc1_ = xN.firstChild;
//TÚTO ROZHODOVACIU ŠTRUKTÚRU VYNECHAŤ A NAHRADIŤ LEN NAČÍTANÍM PREMENNÝCH zo súboru config.xml
while(_loc1_ != null)
{
if(_loc1_.nodeName == "productname")
{
_loc2_ = _loc1_.firstChild.nodeValue;
}
else if(_loc1_.nodeName == "nointernethead")
{
_loc3_ = _loc1_.firstChild.nodeValue;
}
else if(_loc1_.nodeName == "nointernetmain")
{
_loc4_ = _loc1_.firstChild.nodeValue;
break;
}
_loc1_ = _loc1_.nextSibling;
}
// VYNECHAŤ POTIAĽ
_loc6_ = concatenateProductString(_loc3_,_loc2_);
tbDefault.strHead.text = _loc6_;
tbDefault.strMain.text = _loc4_;
}
function concatenateProductString(headerText, productName)
{
var _loc2_ = headerText.indexOf("^p");
var _loc3_ = headerText.substring(0,_loc2_) + productName + headerText.substring(_loc2_ + 2,headerText.length);
return _loc3_;
}
// TÚTO FUNKCIU ÚPLNE VYNECHAŤ, PRETOŽE JE NEPOTREBNÁ PRE KLIKNUTIE
function initClick()
{
tbDefault.onRelease = function()
{
getURL(strGo,"");
};
}
// VYNECHAŤ POTIAĽ
var configData = "resources/config.xml";
initLoadConfig();
Ten while je tam jako pojistka. On prohledava cely strom a snazi se najit shodu s konkternim xml tagem
while(_loc1_ != null)
{
// naplni vsechny "loc"
if("productname") {...}
else if("nointernethead") {...}
else if("nointernetmain") {...break;} // a cyklus ukonci, pokud najde i ten posledni nebo hleda dal
_loc1_ = _loc1_.nextSibling; // prejdi k dalsimu nodu xml souboru
}
Proste zkusi v tom xml najit vsechny 3 hodnoty. Najde bud 0 nebo 1, 2 nebo 3
ty tagy.
Clovek, ktery to asi psal, tak to tak potreboval. Ano, nemusi to tam byt.
kdyby to xml bylo takoveto
<xml>
<productname>Adobe</productname>
<nointernethead> ® Fireworks® CS6</nointernethead>
<nointernetmain>Získajte viac informácií o extrahovaní CSS, vytváraní CSS spritov a o zmene vzhľadu tém jQuery v aplikácii CS6.</nointernetmain>
</xml>
// pak bys klidne ten kod mohl zkratit takto
_loc2_ = _loc1_.firstChild.nodeValue;
_loc1_ = _loc1_.nextSibling;
_loc3_ = _loc1_.firstChild.nodeValue;
_loc1_ = _loc1_.nextSibling;
_loc4_ = _loc1_.firstChild.nodeValue;
jenze tam nemas jen ty tve tagy, takze ten while je postupne zkousi vsechny najit. A muzou byt i obracene, pokud je ten posledni vzdy na konci
<xml>
<layout>
<column>..</column>
<column>...</column>
</layout>
<strings>
<productname>Adobe</productname>
<nointernethead> ® Fireworks® CS6</nointernethead>
<nointernetmain>Získajte viac informácií o extrahovaní CSS, vytváraní CSS spritov a o zmene vzhľadu tém jQuery v aplikácii CS6.</nointernetmain>
</xml>
Sak, kdyz si myslis, ze tam while neni treba ,tak ho zakomentuj
Takhle, jako prvni si muzes zkusit udelat v te online verzi takovy test. prehod ten posledni tag nad ty ostatni
<nointernetmain>Získajte viac informácií o extrahovaní CSS, vytváraní CSS spritov a o zmene vzhľadu tém jQuery v aplikácii CS6.</nointernetmain>
<productname>Adobe</productname>
<nointernethead> ® Fireworks® CS6</nointernethead>
A uvidis, ze product a head tam nebudes mit. Vse ostatni nechas, jak je.
While bude ukoncen na tagu nointernetmain.
Jinymi slovy, ten kon neni moc dobry. Ale je lepsi nez spolehat na konkretni
strukturu.
Aby si lepšie rozumel celej štruktúre, tak sem dám Screen2:
Štruktúra uvítacej obrazovky programu
- V hornej časti screenu je okno uvítacej obrazovky programu.
- V dolnej časti som spravil screeny z obsahu priečinkov programu.
V ľavej časti dole je súbor startpage.swf, ktorý do seba načítava súbory "imdShimLocal.swf", "shimLocal.swf" a "defaultdynswf.swf"
Súbor "defaultdynswf.swf" sa nachádza v priečinku resources spolu so súborom "config.xml".
Okno uvítacej obrazovky programu je rozdelené na 4 sekcie, pričom 2 sekcie hore a 1 sekcia vľavo načítava príkazy so súborov "imdShimLocal.swf" a "shimLocal.swf".
Posledná 4 sekcia vpravo dole načítava príkazy zo súboru
"defaultdynswf.swf", ktorý je závislý na súbore "config.xml" a o tomto sa
bavíme. Táto 4 sekcia pri neaktívnom pripojení k internetu zobrazí 3 texty
zo súboru "config.xml":
<productname>Adobe</productname>
<nointernethead> ® Fireworks® CS6</nointernethead>
<nointernetmain>Získajte viac informácií o extrahovaní CSS,
vytváraní CSS spritov a o zmene vzhľadu tém jQuery v aplikácii
CS6.</nointernetmain>.
Ak je pripojenie k internetu aktívne, tak sa zobrazí len tá veľká grafika písmena "F" bez textov.
a jako druhe, muzes mezi tagy pridat jine tagy. A opet by se to melo spravne najit, ten puvodni kod.
<productname>Adobe</productname>
<aaa>aaa</aaa>
<nointernethead> ® Fireworks® CS6</nointernethead>
<bbb>bbb</bbb>
<nointernetmain>Získajte viac informácií o extrahovaní CSS, vytváraní CSS spritov a o zmene vzhľadu tém jQuery v aplikácii CS6.</nointernetmain>
<ccc>ccc</ccc>
Vyskúšal som zmeniť to poradie v *.xml, ale neovplyvňuje to kód. Texty sa chovajú ako predtým, pretože ich poradie určuje funkcia pre ich zloženie:
function concatenateProductString(headerText, productName)
{
var _loc2_ = headerText.indexOf("^p");
var _loc3_ = headerText.substring(0,_loc2_) + productName + headerText.substring(_loc2_ + 2,headerText.length);
return _loc3_;
}
Vyskúšam ešte obísť tie podmienky v kóde, ako si písal:
_loc2_ = _loc1_.firstChild.nodeValue;
_loc1_ = _loc1_.nextSibling;
_loc3_ = _loc1_.firstChild.nodeValue;
_loc1_ = _loc1_.nextSibling;
_loc4_ = _loc1_.firstChild.nodeValue;
Peter, mám to vyriešené, znovu som si pozrel všetky kódy v každom *.swf súbore, najmä v hlavnom startpage.swf, kde som si podrobne prešiel tento kód:
function jsGetMRU()
{
var _loc5_ = new Array();
var _loc2_ = new Array();
var _loc3_ = new Array();
var _loc1_ = new Array();
var _loc4_ = jsGetListMRU();
i = 0;
while(i < _loc4_)
{
_loc2_.push(jsGetItemMRU(i)[0]);
_loc3_.push(jsGetItemMRU(i)[1]);
if(getStringResource("appobject") == "dw")
{
_loc1_.push(jsGetItemMRU(i)[2]);
}
i++;
}
_loc5_.push(_loc2_);
_loc5_.push(_loc3_);
if(getStringResource("appobject") == "dw")
{
_loc5_.push(_loc1_);
}
return _loc5_;
}
function jsGetListMRU()
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("mruTypeArray = fl.mruRecentFileListType");
MMExecute("mruArray = fl.mruRecentFileList");
return Number(MMExecute("mruArray.length"));
case "dw":
MMExecute("mruArray = dw.startPage.recentFileList");
return Number(MMExecute("mruArray.length"));
case "fw":
FWJavascript("mruArray = fw.mruRecentFileList");
FWJavascript("mruTypeArray = fw.mruRecentFileNames");
return Number(FWJavascript("mruArray.length"));
case "ps":
case "ae":
}
}
function jsGetItemMRU(num)
{
var _loc1_ = new Array();
switch(getStringResource("appobject"))
{
case "fl":
_loc1_.push(MMExecute("mruArray[" + num + "]"));
_loc1_.push(MMExecute("mruTypeArray[" + num + "]"));
break;
case "dw":
_loc1_.push(MMExecute("mruArray[" + num + "].label"));
_loc1_.push(getExtension(_loc1_[0]));
_loc1_.push(MMExecute("mruArray[" + num + "].url"));
break;
case "fw":
_loc1_.push(FWJavascript("mruTypeArray[" + num + "]"));
_loc1_.push(FWJavascript("mruArray[" + num + "]"));
break;
case "ps":
case "ae":
}
return _loc1_;
}
function jsOpenItemMRU(path, type)
{
switch(getStringResource("appobject"))
{
case "fl":
jsAction = "openDocument";
if(type == "as" || type == "asc" || type == "jsfl")
{
jsAction = "openScript";
}
if(type == "flp")
{
jsAction = "openProject";
}
MMExecute("fl." + jsAction + "(\"" + makeURLFileName(path) + "\")");
break;
case "dw":
MMExecute("dw.startPage.doAction(\"" + path + "\")");
break;
case "fw":
FWJavascript("fw.uiOK = true; fw.openDocument(\'" + path + "\')");
break;
case "ps":
ExternalInterface.call("RunJavaScript","activeDocument=open(\"" + path + "\")");
break;
case "ae":
}
}
function jsOpenItemOther()
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("fl.openFileDialog()");
break;
case "dw":
MMExecute("dw.startPage.doAction(\"mminternal:opendocument=\")");
break;
case "fw":
FWJavascript("fw.uiOK = true; fw.openMultiDocument();");
break;
case "ps":
ExternalInterface.call("RunJavaScript","var theFile=new File(openDialog()); if (theFile.exists) activeDocument=open(theFile);");
break;
case "ae":
}
}
function jsGetNew()
{
var _loc4_ = new Array();
var _loc2_ = new Array();
var _loc1_ = new Array();
var _loc3_ = jsGetListNew();
i = 0;
while(i < _loc3_)
{
_loc2_.push(jsGetItemNew(i)[0]);
_loc1_.push(jsGetItemNew(i)[1]);
i++;
}
_loc4_.push(_loc2_);
_loc4_.push(_loc1_);
return _loc4_;
}
function jsGetListNew()
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("newTypeArray = fl.createNewDocListType");
MMExecute("newNameArray = fl.createNewDocList");
return Number(MMExecute("newNameArray.length"));
case "dw":
MMExecute("newNameArray = dw.startPage.newFileList");
return Number(MMExecute("newNameArray.length"));
case "fw":
return 2;
case "ps":
return 1;
case "ae":
}
}
function jsGetItemNew(num)
{
var _loc1_ = new Array();
switch(getStringResource("appobject"))
{
case "fl":
_loc1_.push(MMExecute("newNameArray[" + num + "]"));
_loc1_.push(MMExecute("newTypeArray[" + num + "]"));
break;
case "dw":
_loc1_.push(MMExecute("newNameArray[" + num + "].label"));
_loc1_.push(getExtensionFromInternalURL(MMExecute("newNameArray[" + num + "].url")));
break;
case "fw":
if(num == 0)
{
_loc1_.push(getStringResource("fireworksdocument"));
_loc1_.push("png");
}
else
{
_loc1_.push(getStringResource("createfromtemplates"));
_loc1_.push("png");
}
break;
case "ps":
_loc1_.push(getStringResource("photoshopdocument"));
_loc1_.push("psd");
break;
case "ae":
}
return _loc1_;
}
function jsCreateItemNew(num)
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("fl.createNewDialog(" + num + ")");
break;
case "dw":
MMExecute("dw.startPage.doAction(newNameArray[" + num + "].url)");
break;
case "fw":
if(num == 0)
{
FWJavascript("fw.createDocumentWithDialog();");
}
else
{
FWJavascript("fw.newDocumentFromTemplate();");
}
break;
case "ps":
ExternalInterface.call("RunJavaScript","var theFile=app.documents.add();");
break;
case "ae":
}
}
function jsCreateItemNewMore()
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("fl.createNewDialog()");
break;
case "dw":
MMExecute("dw.startPage.doAction(\"mminternal:newdocument=\")");
break;
case "fw":
case "ps":
case "ae":
}
}
function jsGetTemplates()
{
var _loc1_ = new Array();
var _loc2_ = jsGetListTemplates();
i = 0;
while(i < _loc2_)
{
_loc1_.push(jsGetTemplate(i));
i++;
}
return _loc1_;
}
function jsGetListTemplates()
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("templateNameArray = fl.createNewTemplateList");
return Number(MMExecute("templateNameArray.length"));
case "dw":
MMExecute("templateNameArray = dw.startPage.templateList");
return Number(MMExecute("templateNameArray.length"));
case "fw":
return 0;
case "ps":
return 0;
case "ae":
return 0;
default:
}
}
function jsGetTemplate(num)
{
var _loc1_ = undefined;
switch(getStringResource("appobject"))
{
case "fl":
_loc1_ = MMExecute("templateNameArray[" + num + "]");
break;
case "dw":
_loc1_ = MMExecute("templateNameArray[" + num + "].label");
break;
case "fw":
_loc1_ = "";
break;
case "ps":
_loc1_ = "";
break;
case "ae":
_loc1_ = "";
}
return _loc1_;
}
function jsCreateItemFromTemplate(num)
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("fl.createNewTemplateDialog(" + num + ")");
break;
case "dw":
MMExecute("dw.startPage.doAction(templateNameArray[" + num + "].url)");
break;
case "fw":
MMExecute("fw.newDocumentFromTemplate()");
break;
case "ps":
case "ae":
}
}
function jsCreateItemFromTemplateMore()
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("fl.createNewTemplateDialog(0)");
break;
case "dw":
MMExecute("dw.startPage.doAction(templateNameArray[0].url)");
break;
case "fw":
case "ps":
case "ae":
}
}
function jsGetPrefShowDlg()
{
var _loc1_ = undefined;
switch(getStringResource("appobject"))
{
case "fl":
_loc1_ = MMExecute("fl.inStartPageMode");
break;
case "dw":
if(Number(MMExecute("dw.startPage.shouldShow")) == 0)
{
_loc1_ = false;
}
else
{
_loc1_ = true;
}
break;
case "fw":
if(FWJavascript("fw.getPref(\"ShowStartPage\")") == "false")
{
_loc1_ = false;
}
else
{
_loc1_ = true;
}
break;
case "ps":
_loc1_ = true;
break;
case "ae":
_loc1_ = true;
}
return _loc1_;
}
function jsSetPrefShowFalse()
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("alert(\"" + getStringResource("checkboxalert") + "\")");
MMExecute("fl.showStartPage(false)");
break;
case "dw":
if(MMExecute("alert(\"" + getStringResource("checkboxalert") + "\")"))
{
MMExecute("dw.startPage.doAction(\"mminternal:dontshow=true\")");
}
break;
case "fw":
var _loc1_ = FWJavascript("alert(\"" + getStringResource("checkboxalert") + "\")");
FWJavascript("fw.setPref(\"ShowStartPage\",false);");
break;
case "ps":
case "ae":
}
}
function jsSetPrefShowTrue()
{
switch(getStringResource("appobject"))
{
case "fl":
MMExecute("fl.showStartPage(true)");
break;
case "dw":
MMExecute("dw.startPage.doAction(\"mminternal:dontshow=false\")");
break;
case "fw":
FWJavascript("fw.setPref(\"ShowStartPage\",true);");
break;
case "ps":
case "ae":
}
}
function jsLaunchBrowser(urlStr)
{
var _loc1_ = "fw.launchBrowserTo(\"" + urlStr + "\");";
FWJavascript(_loc1_);
debug("you are loading " + urlStr);
}
function jsIsConnected()
{
switch(getStringResource("appobject"))
{
case "fl":
return MMExecute("fl.isConnectedToInternet");
case "dw":
return MMExecute("dw.startPage.isConnectedToInternet");
case "fw":
return FWJavascript("fw.isConnectedToInternet");
case "ps":
return false;
case "ae":
return false;
default:
}
}
function jsGetQueryString()
{
var _loc1_ = undefined;
switch(getStringResource("appobject"))
{
case "fl":
_loc1_ = MMExecute("fl.getDynamicSWFURL");
break;
case "dw":
_loc1_ = MMExecute("dw.startPage.dynamicSWFParams");
break;
case "fw":
_loc1_ = FWJavascript("fw.getDynamicSWFURL");
break;
case "ps":
case "ae":
}
return _loc1_;
}
function jsParseQueryString(qs)
{
var _loc4_ = qs.split("&");
var _loc3_ = 0;
while(_loc3_ < _loc4_.length)
{
var _loc2_ = _loc4_[_loc3_].split("=");
switch(_loc2_[0])
{
case "api":
_global.api = _loc2_[1];
break;
case "lvl":
_global.lvl = _loc2_[1];
break;
case "stat":
_global.stat = _loc2_[1];
break;
case "lang":
_global.lang = _loc2_[1];
break;
case "spfx":
_global.spfx = _loc2_[1];
break;
case "prod":
_global.prod = _loc2_[1];
break;
case "ver":
_global.ver = _loc2_[1];
break;
case "plat":
_global.plat = _loc2_[1];
break;
case "tday":
_global.tday = _loc2_[1];
}
_loc3_ = _loc3_ + 1;
}
}
function getRemoteURL()
{
var _loc2_ = undefined;
switch(getStringResource("appobject"))
{
case "fl":
case "dw":
case "fw":
case "ps":
case "ae":
_loc2_ = getStringResource("urlshim") + "?";
if(_global.prod != undefined)
{
_loc2_ += "&prod=" + _global.prod;
}
if(_global.lvl != undefined)
{
_loc2_ += "&lvl=" + _global.lvl;
}
if(_global.ver != undefined)
{
_loc2_ += "&ver=" + _global.ver;
}
if(_global.plat != undefined)
{
_loc2_ += "&plat=" + _global.plat;
}
if(_global.lang != undefined)
{
var _loc3_ = _global.lang;
var _loc4_ = undefined;
if(_loc3_ == "ar_AE" || _loc3_ == "he_IL" || _loc3_ == "el_GR" || _loc3_ == "hu_HU" || _loc3_ == "uk_UA" || _loc3_ == "en_US")
{
_loc4_ = "en_US";
}
else
{
_loc4_ = _global.lang;
}
_loc2_ += "&lang=" + _loc4_;
}
if(_global.stat != undefined)
{
_loc2_ += "&stat=" + _global.stat;
}
if(_global.spfx != undefined)
{
_loc2_ += "&spfx=" + _global.spfx;
}
if(_global.tday != undefined)
{
_loc2_ += "&tday=" + _global.tday;
}
if(_global.api != undefined)
{
_loc2_ += "&api=" + _global.api;
}
return _loc2_;
default:
}
}
function getLocalURL()
{
return getStringResource("localshim");
}
function loadShim(mc_local, mc_remote, xPos, yPos)
{
if(jsIsConnected() == true)
{
mc_remote._lockroot = true;
mc_remote.loadMovie(getRemoteURL(),"GET");
donePositioningShim = false;
checkConnectionInterval = setInterval(this,"setContentLoc",100,mc_local,mc_remote,xPos,yPos);
debug("connected and loading");
}
else if(getStringResource("appobject") == "fw")
{
mc_local.loadMovie(getLocalURL());
positionShim(mc_local,mc_remote,xPos,yPos);
donePositioningShim = true;
}
else
{
mc_local.loadMovie(getLocalURL());
positionShim(mc_local,mc_remote,xPos,yPos);
donePositioningShim = true;
}
}
function setContentLoc(mc_local, mc_remote, xPos, yPos)
{
if(isLoaded(mc_remote))
{
clearInterval(checkConnectionInterval);
positionShim(mc_local,mc_remote,xPos,yPos);
donePositioningShim = true;
}
}
function positionShim(mc_local, mc_remote, xPos, yPos)
{
mc_remote._x = mc_local._x = xPos;
mc_remote._y = mc_local._y = yPos;
}
function isLoaded(mc)
{
return mc.getBytesLoaded() >= mc.getBytesTotal() && mc.getBytesLoaded() > 0;
}
function setDefaults()
{
cBackground = 15658734;
cFooter = 15658734;
cLinksArea = 16777215;
wDialog = 650;
hDialog = 500;
tfItemLine.font = "Arial";
tfItemLine.size = 11;
tfItemLine.color = 0;
tfItemLine.bold = false;
tfItemLine.italic = false;
tfItemLineEmph.font = "Arial";
tfItemLineEmph.size = 11;
tfItemLineEmph.color = 0;
tfItemLineEmph.bold = true;
tfItemLineEmph.italic = false;
tfHeadLine.font = "Arial";
tfHeadLine.size = 13;
tfHeadLine.color = 3355443;
tfHeadLine.bold = true;
tfHeadLine.italic = false;
}
function doLayout()
{
placeVisual("mc_listbg","bglist",this,0,hHeader);
var _loc3_ = getWCol();
var _loc2_ = 0;
while(_loc2_ < cols.length - 1)
{
placeVisual("mc_coldivider_" + _loc2_,"vsepline",this,(_loc2_ + 1.5) * xPadding + (_loc2_ + 1) * _loc3_,hHeader + hItemLine / 2);
this["mc_coldivider_" + _loc2_]._yscale = (hListArea - hItemLine) / 2 * 100;
_loc2_ = _loc2_ + 1;
}
placeVisual("mc_header","banner",this,0,0);
placeColor("mc_LinksArea",this,0,hHeader + hListArea,wDialog,hLinksArea,cLinksArea);
placeColor("mc_ShimArea",this,wDialog / 2,hHeader + hListArea,wShimArea,hShimArea,cLinksArea);
placeVisual("mc_biglogo","iconappxl",this.mc_ShimArea,wDialog / 2 + xPadding,hHeader + hListArea + yPadding);
this.mc_ShimArea.createEmptyMovieClip("_local",100);
this.mc_ShimArea.createEmptyMovieClip("_remote",200);
placeVisual("mc_topline_linksarea","hsepline",this,0,hHeader + hListArea);
this.mc_topline_linksarea._xscale = wDialog / 2 * 100;
placeVisual("mc_linksdivider_" + _loc2_,"vsepline",this,wDialog / 2,hHeader + hListArea + hItemLine / 2);
this["mc_linksdivider_" + _loc2_]._yscale = (hLinksArea - hItemLine) / 2 * 100;
this["mc_linksdivider_" + _loc2_]._alpha = 50;
var _loc4_ = wDialog / 2 - xPadding * 3;
var _loc5_ = function()
{
if(getStringResource("appobject") == "fw")
{
jsLaunchBrowser(getStringResource("urlquicktour"));
}
else
{
getURL(getStringResource("urlquicktour"),"");
}
};
placeIconBtn("mc_helpLink1",this,"icondochelp",getStringResource("quicktour"),_loc5_,true,xPadding + xIndentItemLine,hHeader + hListArea + yPadding,_loc4_,true);
_loc5_ = function()
{
if(getStringResource("appobject") == "fw")
{
jsLaunchBrowser(getStringResource("urltutorial"));
}
else
{
getURL(getStringResource("urltutorial"),"");
}
};
placeIconBtn("mc_helpLink2",this,"icondochelp",getStringResource("tutorial"),_loc5_,false,xPadding + xIndentItemLine,hHeader + hListArea + yPadding + hItemLine,_loc4_,true);
_loc5_ = function()
{
if(getStringResource("appobject") == "fw")
{
jsLaunchBrowser(getStringResource("urltraining"));
}
else
{
getURL(getStringResource("urltraining"),"");
}
};
placeIconBtn("mc_helpLink3",this,"icondochelp",getStringResource("training"),_loc5_,false,xPadding + xIndentItemLine,hHeader + hListArea + yPadding + 2 * hItemLine,_loc4_,true);
this.attachMovie("hover","mc_hover",this.getNextHighestDepth(),{_x:0,_y:0,_visible:false});
placeColor("mc_footerArea",this,0,hHeader + hListArea + hLinksArea,wDialog,hFooter,cFooter);
placeVisual("mc_topline_footer","hsepline",this,0,hHeader + hListArea + hLinksArea);
this.mc_topline_footer._xscale = wDialog / 2 * 100;
this.attachMovie("btn_Check","mc_btnDontshow",this.getNextHighestDepth(),{_x:xPadding + xIndentItemLine,_y:hHeader + hListArea + hLinksArea + 4});
this.mc_btnDontshow.tabIndex = tabNum + 60;
this.mc_btnDontshow.mc_text.text = getStringResource("dontshowagain");
this.mc_btnDontshow.mc_text.setTextFormat(tfItemLine);
this.mc_btnDontshow.mc_text.autoSize = "left";
setCheckBoxValue(!jsGetPrefShowDlg());
this.mc_btnDontshow.onRelease = function()
{
if(this._currentframe == 2)
{
setCheckBoxValue(false);
jsSetPrefShowTrue();
}
else
{
setCheckBoxValue(true);
jsSetPrefShowFalse();
}
};
if(debugIsOn)
{
placeLabel("txt_debug","debug text",this,tfItemLine,260 + xPadding + xIndentItemLine,hHeader + hListArea + hLinksArea + 4,wDialog - 260 - xPadding * 2 - xIndentItemLine);
}
createLists();
jsParseQueryString(jsGetQueryString());
loadShim(this.mc_ShimArea._local,this.mc_ShimArea._remote,wDialog / 2 + 2,hHeader + hListArea);
}
function setCheckBoxValue(checked)
{
if(checked)
{
this.mc_btnDontshow.gotoAndStop("on");
}
else
{
this.mc_btnDontshow.gotoAndStop("off");
}
}
function debug(s)
{
if(debugIsOn)
{
this.txt_debug.text = s;
}
}
function getWCol()
{
return (wDialog - xPadding * (2 + (cols.length - 1))) / cols.length;
}
function placeColor(mcName, mcParent, xPos, yPos, wRect, hRect, col)
{
mcParent.createEmptyMovieClip(mcName,getNextHighestDepth());
mcParent[mcName].beginFill(col);
mcParent[mcName].moveTo(xPos,yPos);
mcParent[mcName].lineTo(xPos + wRect,yPos);
mcParent[mcName].lineTo(xPos + wRect,yPos + hRect);
mcParent[mcName].lineTo(xPos,yPos + hRect);
mcParent[mcName].lineTo(xPos,yPos);
mcParent[mcName].endFill();
}
function placeVisual(mcName, imgRsrc, mcParent, xPos, yPos)
{
mcParent.createEmptyMovieClip(mcName,getNextHighestDepth());
mcParent[mcName].loadMovie(getImgResource(imgRsrc));
mcParent[mcName]._x = xPos;
mcParent[mcName]._y = yPos;
}
function placeLabel(mcName, s, mcParent, tf, xPos, yPos, wMax)
{
mcParent.createTextField(mcName,mcParent.getNextHighestDepth(),xPos,yPos,wMax,23);
mcParent[mcName].selectable = false;
mcParent[mcName].text = truncateStringMiddle(tf,s,wMax);
mcParent[mcName].antiAliasType = "normal";
mcParent[mcName].setTextFormat(tf);
}
function placeIconBtn(mcName, mcParent, iconResource, str, cmd, isBold, xPos, yPos, wMax, lateTab)
{
var _loc4_ = 6;
mcParent.createEmptyMovieClip(mcName,getNextHighestDepth());
mcParent[mcName]._x = xPos;
mcParent[mcName]._y = yPos;
placeVisual("icon",iconResource,mcParent[mcName],0,1);
var _loc3_ = wIcon + _loc4_;
if(isBold == true)
{
placeLabel("cap",str,mcParent[mcName],tfItemLineEmph,_loc3_,0,wMax - _loc3_);
}
else
{
placeLabel("cap",str,mcParent[mcName],tfItemLine,_loc3_,0,wMax - _loc3_);
}
mcParent[mcName].onRelease = cmd;
if(lateTab)
{
mcParent[mcName].tabIndex = 50 + tabNum++;
}
else
{
mcParent[mcName].tabIndex = tabNum++;
}
clickableAreas.push(mcParent[mcName]);
clickWidths.push(wMax);
}
function placeList(mcName, mcParent, cap, itemIcons, itemCaps, xPos, yPos, wMax)
{
var _loc4_ = xPos;
var _loc2_ = yPos;
placeLabel(mcName + "_cap",cap,mcParent,tfHeadLine,_loc4_,_loc2_,wMax);
_loc4_ += xIndentItemLine;
_loc2_ += hHeadLine;
var _loc1_ = 0;
while(_loc1_ < itemCaps.length)
{
placeIconBtn(mcName + "_item_" + _loc1_,mcParent,itemIcons[_loc1_],itemCaps[_loc1_],null,false,_loc4_,_loc2_,wMax - xIndentItemLine);
_loc2_ += hItemLine;
_loc1_ = _loc1_ + 1;
}
return _loc2_;
}
function createLists()
{
var _loc4_ = getWCol();
var _loc5_ = undefined;
var _loc1_ = undefined;
var _loc2_ = 0;
var _loc6_ = 0;
while(_loc6_ < cols.length)
{
_loc5_ = xPadding + _loc6_ * (xPadding + _loc4_);
_loc1_ = hHeader + yPadding;
var _loc3_ = 0;
while(_loc3_ < cols[_loc6_].length)
{
var _loc7_ = cols[_loc6_][_loc3_];
switch(_loc7_)
{
case "recentitems":
_loc1_ = createMruList(_loc5_,_loc1_,_loc4_,maxItems[_loc2_]);
break;
case "newitems":
_loc1_ = createNewList(_loc5_,_loc1_,_loc4_,maxItems[_loc2_]);
break;
case "sampleitems":
_loc1_ = createSamplesList(_loc5_,_loc1_,_loc4_,maxItems[_loc2_]);
break;
case "extenditems":
_loc1_ = createExtList(_loc5_,_loc1_,_loc4_,maxItems[_loc2_]);
}
_loc1_ += hItemLine;
_loc2_ = _loc2_ + 1;
_loc3_ = _loc3_ + 1;
}
_loc6_ = _loc6_ + 1;
}
}
function createMruList(xPos, yPos, wMax, maxNumItems)
{
var _loc6_ = getStringResource("openrecentitem");
var ary = new Array();
ary = jsGetMRU();
var _loc4_ = new Array();
var _loc5_ = new Array();
var _loc9_ = new Array();
var _loc3_ = ary[0].length <= maxNumItems - 1 ? ary[0].length : maxNumItems - 1;
var _loc8_ = ary[0][0];
if(_loc8_.length == 0)
{
_loc3_ = 0;
}
var _loc2_ = 0;
while(_loc2_ < _loc3_)
{
_loc4_.push(fileType2ImgResource(ary[1][_loc2_]));
_loc5_.push(path2fname(ary[0][_loc2_]));
_loc2_ = _loc2_ + 1;
}
_loc4_.push("iconfolder");
_loc5_.push(getStringResource("open"));
var _loc7_ = placeList("mc_mruList",this,_loc6_,_loc4_,_loc5_,xPos,yPos,wMax);
var arrayLocation = 0;
if(getStringResource("appobject") == "dw")
{
arrayLocation = 2;
}
else if(getStringResource("appobject") == "fw")
{
arrayLocation = 1;
}
if(_loc3_ > 0)
{
mc_mruList_item_0.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][0],ary[1][0]);
};
}
if(_loc3_ > 1)
{
mc_mruList_item_1.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][1],ary[1][1]);
};
}
if(_loc3_ > 2)
{
mc_mruList_item_2.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][2],ary[1][2]);
};
}
if(_loc3_ > 3)
{
mc_mruList_item_3.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][3],ary[1][3]);
};
}
if(_loc3_ > 4)
{
mc_mruList_item_4.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][4],ary[1][4]);
};
}
if(_loc3_ > 5)
{
mc_mruList_item_5.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][5],ary[1][5]);
};
}
if(_loc3_ > 6)
{
mc_mruList_item_6.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][6],ary[1][6]);
};
}
if(_loc3_ > 7)
{
mc_mruList_item_7.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][7],ary[1][7]);
};
}
if(_loc3_ > 8)
{
mc_mruList_item_8.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][8],ary[1][8]);
};
}
if(_loc3_ > 9)
{
mc_mruList_item_9.onRelease = function()
{
jsOpenItemMRU(ary[arrayLocation][9],ary[1][9]);
};
}
this["mc_mruList_item_" + _loc3_].onRelease = function()
{
jsOpenItemOther();
};
return _loc7_;
}
function createNewList(xPos, yPos, wMax, maxNumItems)
{
var _loc9_ = getStringResource("createnew");
var _loc4_ = new Array();
_loc4_ = jsGetNew();
var _loc5_ = new Array();
var _loc6_ = new Array();
var _loc12_ = new Array();
var _loc7_ = undefined;
var _loc8_ = getStringResource("appobject") != "dw" ? 1 : 2;
if(getStringResource("appobject") == "dw" && _loc4_[0].length > maxNumItems - _loc8_)
{
var _loc3_ = maxNumItems - _loc8_;
_loc7_ = true;
}
else
{
_loc3_ = _loc4_[0].length;
_loc7_ = false;
}
var _loc2_ = 0;
while(_loc2_ < _loc3_)
{
_loc5_.push(fileType2ImgResource(_loc4_[1][_loc2_]));
_loc6_.push(_loc4_[0][_loc2_]);
_loc2_ = _loc2_ + 1;
}
if(getStringResource("appobject") == "dw")
{
_loc5_.push(fileType2ImgResource("Site"));
_loc6_.push(getStringResource("newsite"));
}
if(_loc7_ == true)
{
_loc7_ = true;
_loc5_.push("iconfolder");
_loc6_.push(getStringResource("more"));
}
var _loc10_ = placeList("mc_newList",this,_loc9_,_loc5_,_loc6_,xPos,yPos,wMax);
if(_loc3_ > 0)
{
mc_newList_item_0.onRelease = function()
{
jsCreateItemNew(0);
};
}
if(_loc3_ > 1)
{
mc_newList_item_1.onRelease = function()
{
jsCreateItemNew(1);
};
}
if(_loc3_ > 2)
{
mc_newList_item_2.onRelease = function()
{
jsCreateItemNew(2);
};
}
if(_loc3_ > 3)
{
mc_newList_item_3.onRelease = function()
{
jsCreateItemNew(3);
};
}
if(_loc3_ > 4)
{
mc_newList_item_4.onRelease = function()
{
jsCreateItemNew(4);
};
}
if(_loc3_ > 5)
{
mc_newList_item_5.onRelease = function()
{
jsCreateItemNew(5);
};
}
if(_loc3_ > 6)
{
mc_newList_item_6.onRelease = function()
{
jsCreateItemNew(6);
};
}
if(_loc3_ > 7)
{
mc_newList_item_7.onRelease = function()
{
jsCreateItemNew(7);
};
}
if(_loc3_ > 8)
{
mc_newList_item_8.onRelease = function()
{
jsCreateItemNew(8);
};
}
if(_loc3_ > 9)
{
mc_newList_item_9.onRelease = function()
{
jsCreateItemNew(9);
};
}
if(getStringResource("appobject") == "dw")
{
this["mc_newList_item_" + _loc3_].onRelease = function()
{
MMExecute("dw.startPage.doAction(\"mminternal:newsite\")");
};
}
if(_loc7_ == true)
{
var _loc11_ = getStringResource("appobject") != "dw" ? _loc3_ : _loc3_ + 1;
this["mc_newList_item_" + _loc11_].onRelease = function()
{
jsCreateItemNewMore();
};
}
return _loc10_;
}
function createSamplesList(xPos, yPos, wMax, maxNumItems)
{
var _loc8_ = getStringResource("createfromtemplates");
var _loc4_ = new Array();
_loc4_ = jsGetTemplates();
var _loc5_ = new Array();
var _loc6_ = new Array();
var _loc11_ = new Array();
var _loc3_ = _loc4_[0].length <= maxNumItems - 1 ? _loc4_[0].length : maxNumItems - 1;
var _loc2_ = 0;
while(_loc2_ < _loc3_)
{
_loc5_.push("icondoc");
_loc6_.push(_loc4_[_loc2_]);
_loc2_ = _loc2_ + 1;
}
var _loc7_ = undefined;
if(_loc4_[0].length > maxNumItems - 1)
{
_loc7_ = true;
_loc5_.push("iconfolder");
_loc6_.push(getStringResource("more"));
}
else
{
_loc7_ = false;
}
var _loc9_ = placeList("mc_templatesList",this,_loc8_,_loc5_,_loc6_,xPos,yPos,wMax);
if(_loc3_ > 0)
{
mc_templatesList_item_0.onRelease = function()
{
jsCreateItemFromTemplate(0);
};
}
if(_loc3_ > 1)
{
mc_templatesList_item_1.onRelease = function()
{
jsCreateItemFromTemplate(1);
};
}
if(_loc3_ > 2)
{
mc_templatesList_item_2.onRelease = function()
{
jsCreateItemFromTemplate(2);
};
}
if(_loc3_ > 3)
{
mc_templatesList_item_3.onRelease = function()
{
jsCreateItemFromTemplate(3);
};
}
if(_loc3_ > 4)
{
mc_templatesList_item_4.onRelease = function()
{
jsCreateItemFromTemplate(4);
};
}
if(_loc3_ > 5)
{
mc_templatesList_item_5.onRelease = function()
{
jsCreateItemFromTemplate(5);
};
}
if(_loc3_ > 6)
{
mc_templatesList_item_6.onRelease = function()
{
jsCreateItemFromTemplate(6);
};
}
if(_loc3_ > 7)
{
mc_templatesList_item_7.onRelease = function()
{
jsCreateItemFromTemplate(7);
};
}
if(_loc3_ > 8)
{
mc_templatesList_item_8.onRelease = function()
{
jsCreateItemFromTemplate(8);
};
}
if(_loc3_ > 9)
{
mc_templatesList_item_9.onRelease = function()
{
jsCreateItemFromTemplate(9);
};
}
if(_loc7_ == true)
{
this["mc_templatesList_item_" + _loc3_].onRelease = function()
{
jsCreateItemFromTemplateMore();
};
}
return _loc9_;
}
function createExtList(xPos, yPos, wMax, maxNumItems)
{
var _loc4_ = getStringResource("extend");
var _loc2_ = new Array();
var _loc3_ = new Array();
_loc2_.push("exchangeicon");
_loc3_.push(getStringResource("exchange"));
var _loc5_ = placeList("mc_extList",this,_loc4_,_loc2_,_loc3_,xPos,yPos,wMax);
this.mc_extList_item_0.onRelease = function()
{
if(getStringResource("appobject") == "fw")
{
jsLaunchBrowser(getStringResource("urlexchange"));
}
else
{
getURL(getStringResource("urlexchange"),"");
}
};
return _loc5_;
}
function initLoadConfig()
{
var config_xml = new XML();
config_xml.ignoreWhite = true;
config_xml.onLoad = function(success)
{
if(success)
{
parseConfig(config_xml);
doLayout();
}
};
config_xml.load(configData);
}
function parseConfig(config_xml)
{
var _loc1_ = config_xml.firstChild.firstChild;
while(_loc1_ != null)
{
switch(_loc1_.nodeName)
{
case "layout":
parseLayout(_loc1_);
break;
case "strings":
parseStringResources(_loc1_);
break;
case "resources":
parseImgResources(_loc1_);
break;
case "filetypes":
parseFileTypes(_loc1_);
break;
case "dimensions":
parseDims(_loc1_);
break;
case "colors":
parseColors(_loc1_);
break;
case "fonts":
parseFonts(_loc1_);
}
_loc1_ = _loc1_.nextSibling;
}
}
function parseLayout(xN)
{
cols = new Array();
var _loc2_ = xN.firstChild;
while(_loc2_ != null)
{
if(_loc2_.nodeName == "column")
{
var _loc3_ = new Array();
var _loc1_ = _loc2_.firstChild;
while(_loc1_ != null)
{
_loc3_.push(_loc1_.nodeName);
maxItems.push(strToNum(_loc1_.attributes.max));
_loc1_ = _loc1_.nextSibling;
}
cols.push(_loc3_);
}
_loc2_ = _loc2_.nextSibling;
}
}
function parseFileTypes(xN)
{
ftypes = new Array();
fticons = new Array();
var _loc2_ = xN.firstChild;
while(_loc2_ != null)
{
if(_loc2_.nodeName == "type")
{
var _loc1_ = _loc2_.firstChild;
while(_loc1_ != null)
{
switch(_loc1_.nodeName)
{
case "ftextension":
var _loc4_ = _loc1_.firstChild.nodeValue;
break;
case "fticon":
var _loc3_ = _loc1_.firstChild.nodeValue;
}
_loc1_ = _loc1_.nextSibling;
}
}
ftypes.push(_loc4_);
fticons.push(_loc3_);
_loc2_ = _loc2_.nextSibling;
}
}
function parseFonts(xN)
{
var _loc1_ = xN.firstChild;
while(_loc1_ != null)
{
switch(_loc1_.nodeName)
{
case "headline":
tfHeadLine = parseAFont(_loc1_);
break;
case "itemline":
tfItemLine = parseAFont(_loc1_);
break;
case "itemlineEmph":
tfItemLineEmph = parseAFont(_loc1_);
}
_loc1_ = _loc1_.nextSibling;
}
}
function parseAFont(xN)
{
var _loc2_ = new TextFormat();
var _loc1_ = xN.firstChild;
while(_loc1_ != null)
{
switch(_loc1_.nodeName)
{
case "name":
_loc2_.font = _loc1_.firstChild.nodeValue;
if(osType == "M")
{
_loc2_.font = "Lucida Grande";
}
break;
case "size":
_loc2_.size = strToNum(_loc1_.firstChild.nodeValue);
break;
case "bold":
_loc2_.bold = _loc1_.firstChild.nodeValue != "true" ? false : true;
break;
case "italic":
_loc2_.italic = _loc1_.firstChild.nodeValue != "true" ? false : true;
break;
case "color":
_loc2_.color = strHexToNum(_loc1_.firstChild.nodeValue);
}
_loc1_ = _loc1_.nextSibling;
}
return _loc2_;
}
function parseColors(xN)
{
var _loc1_ = xN.firstChild;
while(_loc1_ != null)
{
switch(_loc1_.nodeName)
{
case "cbackground":
cBackground = strHexToNum("0x" + _loc1_.firstChild.nodeValue);
break;
case "clinksarea":
cLinksArea = strHexToNum("0x" + _loc1_.firstChild.nodeValue);
break;
case "cfooter":
cFooter = strHexToNum("0x" + _loc1_.firstChild.nodeValue);
}
_loc1_ = _loc1_.nextSibling;
}
}
function parseImgResources(xN)
{
rsrcs = new Array();
rsrcurls = new Array();
var _loc1_ = xN.firstChild;
while(_loc1_ != null)
{
rsrcs.push(_loc1_.nodeName);
rsrcurls.push(_loc1_.firstChild.nodeValue);
_loc1_ = _loc1_.nextSibling;
}
}
function getImgResource(aname)
{
var _loc1_ = 0;
while(_loc1_ < rsrcs.length)
{
if(rsrcs[_loc1_] == aname)
{
return rsrcurls[_loc1_];
}
_loc1_ = _loc1_ + 1;
}
return "";
}
function fileType2ImgResource(ftype)
{
var _loc1_ = 0;
while(_loc1_ < ftypes.length)
{
if(ftypes[_loc1_].toLowerCase() == ftype.toLowerCase())
{
return fticons[_loc1_];
}
_loc1_ = _loc1_ + 1;
}
return "icondocsecondary";
}
function parseStringResources(xN)
{
rsrcs = new Array();
rsrcurls = new Array();
var _loc1_ = xN.firstChild;
while(_loc1_ != null)
{
strnames.push(_loc1_.nodeName);
strings.push(_loc1_.firstChild.nodeValue);
_loc1_ = _loc1_.nextSibling;
}
}
function getStringResource(aname)
{
var _loc1_ = 0;
while(_loc1_ < strnames.length)
{
if(strnames[_loc1_] == aname)
{
return strings[_loc1_];
}
_loc1_ = _loc1_ + 1;
}
return "";
}
function parseDims(xN)
{
var _loc1_ = xN.firstChild;
while(_loc1_ != null)
{
switch(_loc1_.nodeName)
{
case "dialog":
var _loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
switch(_loc2_.nodeName)
{
case "w":
wDialog = strToNum(_loc2_.firstChild.nodeValue);
break;
case "h":
hDialog = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "icon":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
switch(_loc2_.nodeName)
{
case "w":
wIcon = strToNum(_loc2_.firstChild.nodeValue);
break;
case "h":
hIcon = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "prodicon":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
switch(_loc2_.nodeName)
{
case "w":
wProductIcon = strToNum(_loc2_.firstChild.nodeValue);
break;
case "h":
hProductIcon = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "header":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
if((_loc0_ = _loc2_.nodeName) === "h")
{
hHeader = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "footer":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
if((_loc0_ = _loc2_.nodeName) === "h")
{
hFooter = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "listarea":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
if((_loc0_ = _loc2_.nodeName) === "h")
{
hListArea = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "linksarea":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
if((_loc0_ = _loc2_.nodeName) === "h")
{
hLinksArea = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
wShimArea = wDialog / 2;
hShimArea = hLinksArea;
break;
case "itemline":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
if((_loc0_ = _loc2_.nodeName) === "h")
{
hItemLine = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "headline":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
if((_loc0_ = _loc2_.nodeName) === "h")
{
hHeadLine = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "paddingoverall":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
switch(_loc2_.nodeName)
{
case "w":
xPadding = strToNum(_loc2_.firstChild.nodeValue);
break;
case "h":
yPadding = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
break;
case "indentitemline":
_loc2_ = _loc1_.firstChild;
while(_loc2_ != null)
{
if((_loc0_ = _loc2_.nodeName) === "w")
{
xIndentItemLine = strToNum(_loc2_.firstChild.nodeValue);
}
_loc2_ = _loc2_.nextSibling;
}
}
_loc1_ = _loc1_.nextSibling;
}
}
function testXML()
{
var _loc1_ = "\n";
_loc1_ += "XML test\n\n";
_loc1_ += "Layout (" + cols.length + " columns)\n";
_loc1_ += colCaptions + "\n";
_loc1_ += cols + "\n";
_loc1_ += "max. # of items per each list\n" + maxItems + "\n";
_loc1_ += "column width is " + getWCol();
_loc1_ += "\n";
_loc1_ += "string resources:\n";
_loc1_ += strnames + "\n";
_loc1_ += strings + "\n";
_loc1_ += "\n";
_loc1_ += "file types:\n";
_loc1_ += ftypes + "\n";
_loc1_ += ftnames + "\n";
_loc1_ += fticons + "\n";
_loc1_ += "\n";
_loc1_ += "img resources:\n";
_loc1_ += rsrcs + "\n";
_loc1_ += rsrcurls + "\n";
_loc1_ += "\n";
_loc1_ += "general style information:\n";
_loc1_ += "color background: " + cBackground + "\n";
_loc1_ += "color footer: " + cFooter + "\n";
_loc1_ += "color links arear: " + cLinksArea + "\n";
_loc1_ += "\n";
_loc1_ += "Text format item line: " + tfItemLine.font + ", " + tfItemLine.size + "\n";
_loc1_ += "Text format item line emphasis: " + tfItemLineEmph.font + ", " + tfItemLineEmph.size + "\n";
_loc1_ += "Text format head line: " + tfHeadLine.font + ", " + tfHeadLine.size + "\n";
_loc1_ += "\n";
_loc1_ += "Icon size: " + wIcon + ", " + hIcon + "\n";
_loc1_ += "Product icon size: " + wProductIcon + ", " + hProductIcon + "\n";
_loc1_ += "Header height: " + hHeader + "\n";
_loc1_ += "Footer height: " + hFooter + "\n";
_loc1_ += "List area size: " + hListArea + "\n";
_loc1_ += "Links (shim) area size: " + hLinksArea + "\n";
_loc1_ += "\n";
_loc1_ += "Item lineheight: " + hItemLine + "\n";
_loc1_ += "Item indentation: " + xIndentItemLine + "\n";
_loc1_ += "Edge Padding: x:" + xPadding + ", y:" + yPadding + "\n";
_loc1_ += "\n";
return _loc1_;
}
function path2fname_test(p)
{
if(osType == "W")
{
return p.slice(p.lastIndexOf("\\") + 1);
}
return p.slice(p.lastIndexOf("/") + 1);
}
function strToNum(s)
{
return parseInt(s);
}
function strHexToNum(s)
{
return parseInt(s,16);
}
function truncateStringMiddle(whichTF, s, w)
{
var _loc8_ = undefined;
var _loc3_ = undefined;
var _loc2_ = undefined;
var _loc5_ = "...";
if(whichTF.getTextExtent(s).width < w - 2)
{
return s;
}
_loc2_ = s.length;
var _loc1_ = 2;
while(_loc1_ <= _loc2_)
{
_loc3_ = s.substr(0,(_loc2_ - _loc1_) / 2) + _loc5_ + s.substr(_loc2_ - (_loc2_ - _loc1_) / 2,_loc2_);
if(whichTF.getTextExtent(_loc3_).width < w - 2)
{
return _loc3_;
}
_loc1_ = _loc1_ + 1;
}
return _loc5_;
}
function getExtension(s)
{
if(s.indexOf(".") == -1)
{
return "";
}
var _loc1_ = s.split(".");
return _loc1_[_loc1_.length - 1];
}
function getExtensionFromInternalURL(s)
{
if(s.indexOf("=") == -1)
{
return "";
}
var _loc1_ = s.split("=");
return _loc1_[_loc1_.length - 1];
}
function path2fname(strTemp)
{
var _loc1_ = 0;
var _loc5_ = false;
var _loc3_ = "";
var _loc2_ = "";
var _loc6_ = "/";
if(osType == "W")
{
_loc6_ = "\\";
}
if(getStringResource("appobject") == "fw")
{
_loc6_ = "/";
}
_loc1_ = strTemp.length - 1;
while(_loc1_ >= 0 && _loc5_ != true)
{
_loc2_ = strTemp.charAt(_loc1_);
if(_loc2_ != _loc6_)
{
_loc3_ = _loc2_ + _loc3_;
_loc1_ = _loc1_ - 1;
}
else
{
_loc5_ = true;
}
}
strTemp = _loc3_;
_loc3_ = "";
_loc1_ = 0;
iLen = strTemp.length - 1;
while(_loc1_ <= iLen)
{
_loc2_ = strTemp.charAt(_loc1_);
if(_loc2_ == "%")
{
if(_loc1_ + 2 <= iLen)
{
if(_loc2_ + strTemp.charAt(_loc1_ + 1) + strTemp.charAt(_loc1_ + 2) == "%20")
{
_loc1_ += 2;
_loc2_ = " ";
}
}
}
_loc3_ += _loc2_;
_loc1_ = _loc1_ + 1;
}
return _loc3_;
}
function makeFileURL(strTemp)
{
if(osType == "W")
{
return makeURLFileName(strTemp);
}
if(osType == "M")
{
return makeOSXFileName(strTemp);
}
}
function makeURLFileName(strTemp)
{
var _loc3_ = 0;
var _loc1_ = "";
var _loc4_ = undefined;
var _loc2_ = "";
_loc4_ = strTemp.length;
while(_loc3_ < _loc4_)
{
_loc2_ = strTemp.charAt(_loc3_);
if(_loc2_ == "\\")
{
_loc1_ += "/";
}
else if(_loc2_ == ":")
{
_loc1_ += "|";
}
else
{
_loc1_ += _loc2_;
}
_loc3_ = _loc3_ + 1;
}
_loc1_ = "file:///" + _loc1_;
return _loc1_;
}
function makeOSXFileName(strTemp)
{
return "file://" + strTemp;
}
function isOver(px, py, aMc)
{
if(aMc.length == 0)
{
return -1;
}
if(aMc.length == 1)
{
var _loc3_ = aMc[0].getBounds(this);
if(px >= _loc3_.xMin && px <= _loc3_.xMax && py >= _loc3_.yMin && py <= _loc3_.yMin + hItemLine)
{
return 0;
}
return -1;
}
var _loc7_ = -100000;
var _loc8_ = -1;
var _loc2_ = 0;
while(_loc2_ < aMc.length)
{
_loc3_ = aMc[_loc2_].getBounds(this);
if(px >= _loc3_.xMin && px <= _loc3_.xMax && py >= _loc3_.yMin && py <= _loc3_.yMin + hItemLine && aMc[_loc2_].getDepth() > _loc7_)
{
_loc8_ = _loc2_;
_loc7_ = aMc[_loc2_].getDepth();
}
_loc2_ = _loc2_ + 1;
}
return _loc8_;
}
var configData = "resources/config.xml";
var cols = new Array();
var colCaptions = new Array();
var maxItems = new Array();
var mrus = new Array();
var ftypes = new Array();
var fticons = new Array();
var rsrcs = new Array();
var rsrcurls = new Array();
var strnames = new Array();
var strings = new Array();
var dims = new Array();
var cBackground;
var cFooter;
var cLinksArea;
var tfItemLine = new TextFormat();
var tfItemLineEmph = new TextFormat();
var tfHeadLine = new TextFormat();
var wDialog;
var hDialog;
var wShimArea;
var hShimArea;
var wIcon;
var hIcon;
var wProductIcon;
var hProductIcon;
var hHeader;
var hFooter;
var hListArea;
var hLinksArea;
var hItemLine;
var xIndentItemLine;
var hHeadLine;
var xPadding;
var yPadding;
var clickableAreas = new Array();
var clickWidths = new Array();
var donePositioningShim = true;
var checkConnectionInterval;
var nothing = 0;
var debugIsOn = false;
var tabNum = 0;
Stage.showMenu = false;
Stage.scaleMode = "noScale";
var osType = System.capabilities.os.substr(0,1);
this.onEnterFrame = function()
{
var _loc4_ = this._xmouse;
var _loc3_ = this._ymouse;
var _loc2_ = isOver(_loc4_,_loc3_,clickableAreas);
if(_loc2_ != -1)
{
this.mc_hover._x = clickableAreas[_loc2_]._x - 4;
this.mc_hover._y = clickableAreas[_loc2_]._y - 2;
this.mc_hover._width = clickWidths[_loc2_] + 8;
this.mc_hover._height = hItemLine;
this.mc_hover._visible = true;
}
else
{
this.mc_hover._visible = false;
}
if(donePositioningShim == false)
{
positionShim(this.mc_ShimArea._local,this.mc_ShimArea._remote,wDialog / 2 + 2,hHeader + hListArea);
}
};
setDefaults();
initLoadConfig();
stop();
Následne ma zaujali tieto dve funkcie, v ktorých sú zmienky o pripojení k internetu:
function jsIsConnected()
{
switch(getStringResource("appobject"))
{
case "fl":
return MMExecute("fl.isConnectedToInternet");
case "dw":
return MMExecute("dw.startPage.isConnectedToInternet");
case "fw":
return FWJavascript("fw.isConnectedToInternet");
case "ps":
return false;
case "ae":
return false;
default:
}
}
a
function loadShim(mc_local, mc_remote, xPos, yPos)
{
if(jsIsConnected() == true)
{
mc_remote._lockroot = true;
mc_remote.loadMovie(getRemoteURL(),"GET");
donePositioningShim = false;
checkConnectionInterval = setInterval(this,"setContentLoc",100,mc_local,mc_remote,xPos,yPos);
debug("connected and loading");
}
else if(getStringResource("appobject") == "fw")
{
mc_local.loadMovie(getLocalURL());
positionShim(mc_local,mc_remote,xPos,yPos);
donePositioningShim = true;
}
else
{
mc_local.loadMovie(getLocalURL());
positionShim(mc_local,mc_remote,xPos,yPos);
donePositioningShim = true;
}
}
Keďže poznám dobre distribučný balík od Adobe, tak viem, že okrem programu Fireworks, sú tam ešte 2 programy, ktoré využívajú uvítaciu obrazovku (Adobe Flash, Adobe Dreamviewer) a potom ostatné, ktoré už nie, teda After Effects a Photoshop.
Hneď mi prišli na rozum ich skratky, ktoré sa nachádzajú v prvej z tých dvoch funkcií, t.j. v jsIsConnected() a všimol som si, že formou príkazu MMExecute je priradené pripojenie k internetu práve u tých troch programov s uvítacou obrazovkou a u ďalších dvoch tento príkaz vôbec nie je braný do úvahy a vracia hodnotu false.
Preto som zmenil túto funkciu na:
function jsIsConnected()
{
switch(getStringResource("appobject"))
{
case "fl":
return false;
case "dw":
return false;
case "fw":
return false;
case "ps":
return false;
case "ae":
return false;
default:
}
}
a výsledok bol veľmi uspokojivý, pretože teraz už skript nemá ako
nevyhodnocuje aktívne a neaktívnom pripojenie k internetu a všetky
preložené texty pri ikone "F" zobrazuje stále
Týmto som si pravdepodobne uľahčil prácu vopred, ak by som sa rozhodol prekladať aj program Flash a Dreamviewer, čo zatial nemám v pláne kvôli ukončeniu podpory flash.
Ďakujem za tvoje odpovede, to aspoň človeka naštartuje sa znovu lepšie pozrieť na veci z iného pohľadu.
+5 Zkušeností

Zobrazeno 18 zpráv z 18.