SharedObject reader plugin for FD3

In the past week I was working on the SharedObject plugin for FlashDevelop 3.
First I just made a port of my previous sepy sharedobject reader python code into C#, but then for the new AMF3 sharedobject encoding I found this java class very useful.
By the way, after coding and coding.. I finally managed to create a good solution (ok, I have to test it a lot again…).
You can find the plugin here: http://code.google.com/p/fdplugins

But the interesting thing I found was another!
Flash does not read the sharedojects correctly (at least the amf0 ones)!

To reproduce this bug follow these steps:

Create a new document (flash8 / as2)
– Add this code in the timeline:
var so:SharedObject = SharedObject.getLocal("flash8", "/");
so.clear();
so.data.obj1 = new XML("");
so.data.obj2 = new Date();
so.data.obj3 = so.data.obj2;
so.data.obj4 = {a:1, b:so.data.obj1, c:[1,2,3], d:so.data.obj2};
so.data.obj5 = so.data.obj4.c;
so.flush();

you will see this in the debug view variables:
Variabile _level0.so = [oggetto #1, classe 'SharedObject'] {
data:[oggetto #2, classe 'Object'] {
obj1:[oggetto #3] {
;
},
obj2:[oggetto #4, classe 'Date'] {Sat Sep 22 19:31:31 GMT+0200 2007},
obj3:[oggetto #4, classe 'Date'],
obj4:[oggetto #5, classe 'Object'] {
d:[oggetto #4, classe 'Date'],
c:[oggetto #6, classe 'Array'] [
0:1,
1:2,
2:3
],
b:[oggetto #3],
a:1
},
obj5:[oggetto #6, classe 'Array']
}
}

ok, now remove all the code you just written and leave just this line:
var so:SharedObject = SharedObject.getLocal("flash8", "/");
and see the variables list again, you will see this:
Variabile _level0.so = [oggetto #1, classe 'SharedObject'] {
data:[oggetto #2, classe 'Object'] {
obj1:[oggetto #3] {
;
},
obj2:[oggetto #4, classe 'Date'] {Sat Sep 22 19:31:31 GMT+0200 2007},
obj3:[oggetto #5, classe 'Date'] {Sat Sep 22 19:31:31 GMT+0200 2007},
obj4:[oggetto #6, classe 'Object'] {
d:[oggetto #7, classe 'Date'] {Sat Sep 22 19:31:31 GMT+0200 2007},
c:[oggetto #8, classe 'Array'] [
0:1,
1:2,
2:3
],
b:[oggetto #6, classe 'Object'],
a:1
},
obj5:non definito
}
}

they are different! (both data.obj5 and data.obj4.b changed)

For what I understand during my experiments it seems that flash does not write into its internal references table the XML objects while reading back the file and so next time it open the sharedobject all the references after the xml are broken or just they point to a different object.

FlashDevelop 3, unsorted plugins

Last week I started a new Flash project, and unluckily it was an ActionScript 2 project!…
Oh, It was so long time since I last wrote as2 code… I didn’t remember it’s so boring and poor . Actionscript 3 it’s a complete different world compared to as2, now I can understand this better. BTW, I decided to use for this project FlashDevelop 3. I still remember the days when they first announced the birth of this project (those days when I still was writing sepy…), but I never really try it in depth.
After 2 days using it I was fully satisfied of my choice, this is really an awesome project!

But.. because I’m too curious, I wanted to take a look also at the source code.. just to a look. Also because I never coded in C#.
Anyway, after a couple of days I found that making plugins wasn’t so hard, even if for a c# newbie like me (and also thanks to some tip from Philippe), and so I wrote down some testing plugins. they’re not killer plugins at all, just simple program addons.

1. SourceOptions: this is the very first I did and in fact it doesn’t do anything special. In AS2 and AS3 files it adds to the scintilla contextual menu three more options: “organize imports” (similar to the  one in flex), “add getter/setter method” and “add accessor method” (when you click on a class variable)

2.  Bookmarks panel: This create a docking panel displaying all the current opened files and keep updated their bookmarks.

3. Flash API panel: Similar to the one included in the Flash IDE. Just give (in the plugin settings) the path (one or more) of the xml included in the ActionsPanel flash directory and it will display the full list of all the language available actions/methods/classes. Double click on an item will insert the command in the document text giving also the description of the selected command in a tooltip.

Tip: those xml file can be found in a directory like this:

C:\Users\sephiroth\AppData\Local\Adobe\Flash CS3\en\Configuration\ActionsPanel\ActionScript_3\ActionsPanel_3.xml

4.  ASClassWizard: It overrides the “New Class” project menu command and displays a wizard dialog for creating a new ActionScript 2/3 class. Give the package, the classname, super class, implementing interfaces and it will create your class.

Note: Remember that those plugins work only with the last 1769 FlashDevelop 3 build, available here:

http://www.flashdevelop.org/community/viewtopic.php?t=1734

Project Home at http://code.google.com/p/fdplugins with all the latest versions of these plugins and more plugins