Flash Lite ExtendedKey y SharedObject en Eclipse con FDT
Por: Marcos Gonzalez Sancho (Redactor y Manager) 5 07 2009Pues para variar cada instalación de Eclipse me tengo que comer con patatas el escaso soporte que hay para flash lite en cuanto a las clases especiales con las que cuenta, y más concretamente con ExtendedKey y SharedObject, que tiene algunas diferencias interesantes con respecto al trabajo habitual con sharedObjects en Flash convencional.
No es la primera vez que os hablamos de esto, pero algunos links ya no funcionan, asi que para no perderlo de vista, lo posteo aqui y que quede para la posteridad. Con esto ya no deberíamos tener excusas para usar Eclipse con FDT cuando hacemos proyectos en Flash Lite (doy por hecho que en proyectos de envergadura media / grande se DEBE programar con clases, y rompo nuevamente una lanza en contra de la leyenda urbana que corre por ahi de que las clases consumen más memoria… esto es un post pendiente del Sr. Elecash y mio, que seguro que algún día ve la luz).
Aquí os dejo las definiciones necesarias para ExtendedKey y para SharedObject y dónde se han añadir los correspondientes ficheros en el entorno de Eclipse + FDT, para que no nos den la lata con clases no encontradas.
ExtendedKey.as
(fichero que ha de ir ubicado en: ruta_instalacion_eclipse\configuration\com.powerflasher.fdt.core\.config\core\as2)
intrinsic class ExtendedKey
{
static var SOFT1:String = "soft1";
static var SOFT2:String = "soft2";
static var SOFT3:String = "soft3";
static var SOFT4:String = "soft4";
static var SOFT5:String = "soft5";
static var SOFT6:String = "soft6";
static var SOFT7:String = "soft7";
static var SOFT8:String = "soft8";
static var SOFT9:String = "soft9";
static var SOFT10:String = "soft10";
static var SOFT11:String = "soft11";
static var SOFT12:String = "soft12";
}
SharedObject.as
(este fichero ya existe en la ruta anteriormente mencionada para ExtendedKey, pero hay que hacerle algunas modificaciones, quedando finalmente como se muestra a continuación)
dynamic intrinsic class SharedObject
{
static function deleteAll(url : String):Void;
static function getDiskUsage(url : String):Void;
static function getLocal(name : String, localPath : String) : SharedObject;
static function getRemote(name : String, remotePath : String, persistence : Object):SharedObject;
// Flash Lite 2.x or higher
static function GetMaxSize() : Number;
static function addListener(objectName:String, notifyFunction:Function) : Void;
static function removeListener(objectName:String) : Void;
// end Flash Lite special functions
function flush(minDiskSpace : Number) : Object;
function clear() : Void;
function close() : Void;
function connect(myConnection : NetConnection) : Boolean;
function getSize() : Number;
function onStatus(infoObject : Object) : Void;
function onSync(objArray : Array) : Void;
function send(handlerName : String) : Void;
function setFps(updatesPerSecond : Number) : Boolean;
var data : Object;
}
Van en negrita las mofidicaciones, que han sido seleccionadas de la documentación oficial de Adobe Flash Lite 2.x. Ojo con el atributo dynamic, que no se ve mucho, pero es una realidad.
Ale, ahora se que tengo a mano esto cada vez que reinstale Eclipse, o alguien me lo consulte. Por otro lado, por si alguien tiene alguna versión más antigua de Eclipse, en algunas no viene fscommand2 o viene como FSCommand2. Esto lo puedes encontrar en: ruta_instalacion_eclipse\configuration\com.powerflasher.fdt.core\.config\topLevel, en el fichero TopLevel.as
Asegúrate de que en él está la línea:
function fscommand2(command:String, parameters:Object):Void;
Espero que a alguno le sea de utilidad, pero yo no soporto warnings chorras o errors falsos en la lista de problemas de Eclipse… soy un neurótico, lo reconozco…
Sobre el uso y buen uso de SharedObjects
Y ya que estamos que lo tiramos, unos cuantos enlaces e información interesante sobre el uso de SharedObjects en Flash Lite:
- [ES] Clase para el manejo de SharedObjects del Sr. Elecash y que tiene su reflejo en el Feather Framework.
- [ES] Documentación Adobe
- [ES] Tip sobre el NO soporte de SharedObjects remotos en FL 2.0
- [EN] Tutorial de uso de SharedObjects en Devnet
- [EN] Validating SharedObjects with Flash Lite 2.0, Forum Nokia
- [EN] Tip sobre cómo optimizar el uso de SharedObjects en Flash Lite, RECOMENDADO!
Si te ha gustado esta entrada quizá también te puede interesar:











Hostias tio, esto es buenísimo, muchas gracias!
Estaba hasta las bolas de los warnings, errores etc. cada vez que usaba las clases, asi que con un poco de documentación y de busqueda (la pena fue que en el Foro de FDT esto estaba, pero ya no se encuentra accesible…) pues lo enchufé y al postearlo aqui, ya sabemos donde encontrarlo
Ya podía ser todo tan fácil como esto.
Just came across this article by pure chance. I am glad to read FDT used for FlashLite projects, as a former Engineering Manager for Adobe Device Central now working for the FDT team, I am thrilled !
Let us know is we can be of any further help.
Hi Bruno,
Yeap, Raul and me work always with AS2 and OOP approach in Flash Lite projects, so FDT is a great enviroment to improve our action script programming. We met you at Device Central team, and it’s nice to see that you continue your work at FDT team
There are some topics that are not difficult to improve in FDT related to Flash Lite development. This post is an example, supporting fscommand2 in TopLevel.as and incluiding ExtendedKey and SharedObject in the as2 folder are important to avoid errors when typing actionscript for Flash Lite.
At this time, fscommand2 is supported as “FSCommand2″, but it isn’t the right format as you can see here: http://livedocs.adobe.com/flashlite/2/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000328.html
The right format is “fscommand2″, not capitalized.
ExtendedKey is not included in the as2 folder, and SharedObject is included but it doesn’t include all the available methods in Flash Lite. In this post you have the right code for these classes.
And finally to comment that in Mac I can find the TopLevel.as and the as2 folder at these paths: applications/eclipse/plugins/com.powerflasher.fdt.core_3.2.0.1029/resource (base path)/topLevel/TopLevel.as and core/as2/ but if I change this files and restart Eclipse, I don’t solve the syntax problem.
Bruno, thanks for your support and for pointing your help here
Hi Bruno, I have found the right path in Mac, at applications/eclipse/configuration/com.powerflasher.fdt.core/.config the problem was that .config is a hidden folder
Anyway mi previous comment is valid to include those changes to solve some flash lite problems with FDT + Eclipse
[...] esto a todos los fans de mac os la traiga al pairo, pero para mi ha sido un logro importante. A raíz de este post, os comentábamos que FDT tiene algunas “deficiencias” en las clases que incorpora como [...]
Hi Marco, Thanks for sharing your feedback. Are you going to be at MWC this year? It would be great to catch up !
Hi Bruno, Yeap, I’m going to attend MWC this year! What days are you going to attend?
[...] FDT uses the standard ActionScript 2 classes to allow you to compile your Flash Lite project. Anyway, these lack some Flash Lite-specific classes and functions, as ExtendedKey and SharedObject.addListener() method, that have to be manually added, as also explained here. [...]