Pages: [1]
  Print  
Author Topic: XFL Support : We added it  (Read 398 times)
Thommas
Gaia Novice
*
Posts: 1


« on: January 05, 2011, 09:40:20 AM »

Hello,

Just to let you know we added XFL support in Gaia Panel.

Easy patch : just add this code in GaiaProject.jsfl

Code:
function openAndPublish(projectPath, filePath)
{
var tmpArray = filePath.split('.');
var firstArray = filePath.split('/');
var secondArray = firstArray[firstArray.length - 1].split('.');
filePath = tmpArray[0] + '/' + secondArray[0] + '.xfl';

if (fl.fileExists(filePath))
{
fl.openDocument(filePath);
var success = true;
fl.getDocumentDOM().publish();
fl.compilerErrors.save(projectPath + "/errors.log");
var errors = FLfile.read(projectPath + "/errors.log");
if (errors.length > 0)
{
var errorIndex = errors.indexOf("Error(s)");
if (errorIndex > -1) success = errors.indexOf("0 Error(s)") > - 1;
else success = false;
}
FLfile.remove(projectPath + "/errors.log");
return success;
}
}
function publishSilently(projectPath, filePath)
{
var tmpArray = filePath.split('.');
var firstArray = filePath.split('/');
var secondArray = firstArray[firstArray.length - 1].split('.');
filePath = tmpArray[0] + '/' + secondArray[0] + '.xfl';

if (fl.fileExists(filePath))
{
var success = true;
fl.publishDocument(filePath);
fl.compilerErrors.save(projectPath + "/errors.log");
var errors = FLfile.read(projectPath + "/errors.log");
if (errors.length > 0)
{
var errorIndex = errors.indexOf("Error(s)");
if (errorIndex > -1) success = errors.indexOf("0 Error(s)") > - 1;
else success = false;
}
FLfile.remove(projectPath + "/errors.log");
return success;
}
}

We could easily handle both FLA and XFL but we are using SVN, so XFL all the way :-)

FLA is deprecated :-D at last !

Best regards.

PS: both fla/xfl code here :
Code:

function openAndPublish(projectPath, filePath)
{
if (fl.fileExists(filePath))
{
fl.openDocument(filePath);
var success = true;
fl.getDocumentDOM().publish();
fl.compilerErrors.save(projectPath + "/errors.log");
var errors = FLfile.read(projectPath + "/errors.log");
if (errors.length > 0)
{
var errorIndex = errors.indexOf("Error(s)");
if (errorIndex > -1) success = errors.indexOf("0 Error(s)") > - 1;
else success = false;
}
FLfile.remove(projectPath + "/errors.log");
return success;
}
else
{
var tmpArray = filePath.split('.');
var firstArray = filePath.split('/');
var secondArray = firstArray[firstArray.length - 1].split('.');
filePath = tmpArray[0] + '/' + secondArray[0] + '.xfl';

if (fl.fileExists(filePath))
{
fl.openDocument(filePath);
var success = true;
fl.getDocumentDOM().publish();
fl.compilerErrors.save(projectPath + "/errors.log");
var errors = FLfile.read(projectPath + "/errors.log");
if (errors.length > 0)
{
var errorIndex = errors.indexOf("Error(s)");
if (errorIndex > -1) success = errors.indexOf("0 Error(s)") > - 1;
else success = false;
}
FLfile.remove(projectPath + "/errors.log");
return success;
}
}
}
function publishSilently(projectPath, filePath)
{
if (fl.fileExists(filePath))
{
var success = true;
fl.publishDocument(filePath);
fl.compilerErrors.save(projectPath + "/errors.log");
var errors = FLfile.read(projectPath + "/errors.log");
if (errors.length > 0)
{
var errorIndex = errors.indexOf("Error(s)");
if (errorIndex > -1) success = errors.indexOf("0 Error(s)") > - 1;
else success = false;
}
FLfile.remove(projectPath + "/errors.log");
return success;
}
else
{
var tmpArray = filePath.split('.');
var firstArray = filePath.split('/');
var secondArray = firstArray[firstArray.length - 1].split('.');
filePath = tmpArray[0] + '/' + secondArray[0] + '.xfl';

if (fl.fileExists(filePath))
{
var success = true;
fl.publishDocument(filePath);
fl.compilerErrors.save(projectPath + "/errors.log");
var errors = FLfile.read(projectPath + "/errors.log");
if (errors.length > 0)
{
var errorIndex = errors.indexOf("Error(s)");
if (errorIndex > -1) success = errors.indexOf("0 Error(s)") > - 1;
else success = false;
}
FLfile.remove(projectPath + "/errors.log");
return success;
}
}
}

Could be better with another function for both but not sure it would work so here you go.
This code was not tested BTW !
« Last Edit: January 05, 2011, 09:45:42 AM by Thommas » Logged
Ramiro
Moderator
Gaia Addict
*****
Posts: 861


interactive pragmatism


« Reply #1 on: January 06, 2011, 08:13:23 AM »

Nice!
One doubt, with this mod, the Gaia panel scaffolds only in XFL format, right?
Logged
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v1.0 beta 4 © Bloc