Apr
28
2010
With Flex 4 the StyleManager is no longer a Singleton class. Its implementation has changed so that every loaded module has its own instance of StyleManager.
This post by Gaurav Jain explains how you can use it so that the loaded modules have their own separate style manager.
But it doesn’t say how you can access the toplevel or default StyleManager.
The old, Flex 3, way of accessing it would be,
var tempStyle:CSSStyleDeclaration = StyleManager.getStyleDeclaration(“.tempStyle”);
the above method is deprecated and will give you a warning.
The correct way now of using the StyleManager would be the following,
var tempStyle:CSSStyleDeclaration = StyleManager.getStyleManager(null).getStyleDeclaration(“.tempStyle”);
StyleManager.getStyleManager(null);, returns the top level instance of StyleManager.
Apr
12
2010
Its been about two weeks since i installed Flash Builder 4 (Flex 4) and when i fired up the help i was throughly disappointed. Adobe has come up with an air app which launches and fetches the help over the net. It is a really annoying system and i hate it, absolutely hate it.
I have always relied on the class reference which uses the eclipse help system and it opens up in my browser on OS X which i really like. I can be offline and still have a neat way of accessing help. I figured it won’t take much for me to hack up the current help so that i could access it within Flash Builder 4 and i was successful at it.
If you select Flash Builder > Help > Eclipse Help you won’t see the Adobe Flex 4 Language reference, i hacked it so that i could have the reference in a neat way without having to go through the hassle of looking for classes etc.
Before the hack: this is how the eclipse help section looked.
and then after my hack and generating the right xml by using the air app.
Before you proceed, here are few disclaimers/requests:
- I have developed/tested it out on OS X so if you are using windows i am not sure how it affects you.
- I do not intend to test it out on windows, if it doesn’t work for you on that platform i am sorry i can’t help it. Right now there is no incentive for me to play with it on windows.
- I am sharing the code for this one, if you want to modify it then feel free to but i would appreciate that you give me some credit.
- I have tried to make it as efficient as i could think of, though i haven’t played a lot more in trying to make it run faster. If you end up running it faster then i would like to know about it, thank you.
- If you run the app by itself there are not many messages and stuff so even if it crashes or stops processing, you won’t be able to tell. So therefore i am just including the source for the app and not the app itself.
The requirements for this app to run properly,
- Adobe Flex 4 language reference, it can be downloaded here. Download the Full Documentation.
- Local server which would point to the AS3_Reference as docroot, so http://localhost would give you the Flex 4 documentation.
- myindex.html file which i have created just copy the source when you open it, is it pretty basic and uses jquery.
Before you start wondering why i had to go all this trouble of using custom index,local server etc, please read the source code. I have commented the reason for me taking this approach. I wanted to do a fast, efficient way of doing this without much of hassle and this i felt was the best way.
Here is the link to the uploaded Flex project file. I would recommend that you run this in debug mode so that you see some of the traces or can add your own.
NOTE: Please remove the filesĀ arguments.html, int.html and uint.html from your AS3_Reference directory so that they don’t mess up parsing, i didn’t bother to look deeper into the files to see what was causing problems. Since it was only these 3 files as compared to 2483 other html reference files i don’t think its a big deal.
Final Step:
Once you have your tocAPI.xml file generated on your desktop, you will have to copy that into the toc xml file. This toc xml file should look some thing like this,
<toc label=”Adobe Flex 4 Help”>
<topic label=”About Web Help and Community Help” href=”html/index.html”/>
</toc>
the path for this file on my computer is, /Applications/Adobe Flash Builder 4/plugins/com.adobe.flexbuilder.help_4.0.0.272416
I modified this file to look as follows,
<toc label=”Adobe Flex 4 Help”>
<topic label=”About Web Help and Community Help” href=”html/index.html”/>
<topic label=”Adobe Flex 4 Language Reference” href=”AS3_Reference/index.html”>
<!– the contents of tocAPI.xml should be pasted in here –>
</topic>
</toc>
I tried using the < link toc=”tocAPI.xml” /> but it doesn’t work so had to copy the contents of tocAPI.xml into this file.
Also make sure you copy the AS3_Reference folder into this directory so that the next time you fire up Flash Builder 4 you will have an indexed class reference.
If i feel like it, i might make more modifications so that the package list is also displayed etc but i barely use it so for now i am happy with this.
I hope there are other developers who felt the same way as i did after checking out the FB help and will use this. Finally if you don’t want to worry about this AIR App and just want to copy the tocAPI.xml file then i have uploaded one for you to download. Enjoy.
Update 05/04/11: I have uploaded a new File for Flex 4.5 it can be downloaded here and the documentation for this is in this zip available here. Name this folder as Flex in your help plugin directory.