I’ve been doing a lot of work using localization lately and as part of this I’ve had to consider the fact that words in one language are not usually the same lengths as their translations in another. Because of this I’ve increasingly been relying on the size to fit content ability of labels, buttons etc. in side of Flex. Now that is all well and good except for when you want a set of buttons to all be the same width or some labels and controls to all line up and be the same width. You need some way of telling all of the components in the set to re-size to the largest size of any of the components. I’ve written a very little function to do just that. Keep reading →
2010.06.28
Flash Builder 4 ASDoc Configuration
There is not a lot of information out on the net on how to configure ASDoc to work with Flash Builder 4. Well I should clarify… there actually is some but it is kind of confusing.
Here is the official Adobe Documentation for (FB3) ASDoc
This is based on a this post by jason madsen and this post by Seb Lee-Delisle
You might think that this is a little redundant with this information out there but I am posting this as it is a slightly different way to reach a workable configuration. I did not find it necessary to include the SWC files that Seb talks about and that while including every class you want to document in the command line would be problematic, including the base classes in the flex-config.xml file is actually very workable. I am sure there are issues with this method as well but I wanted to make the information available.
Here are my short little instructions for how I was able to get it to work in Flash Builder 4 specifially how to set it up for a different version of the SDK (in this case 3.4) It should be possible to set up for each version of the SDK however you must make sure that you use the correct ASDoc.exe file depending on which version of the SDK your project is compiling against….
2010.05.06
Passing Javascript Object with same name parameter
I came across this strange behavior in ExtJS 3.2 on Firefox (haven’t tested in other browsers) If you name the element of an object the same as the object you are inserting it absorbs this object instead of nesting it. For example….
//In ExtJS.... The getAt method on a dataStore returns an object such that record.data exists var record = myDataStore.getAt(1); //If I then pass that to a constructor of another object such as a custom window var win = new myWindow({ record:record, width:500 }); // Where myWindow's constructor is defined to take an argument object of config like so... Window = Ext.extend(BCC.trace.TraceWindow,{ constructor: function(config){ .... } ..... })
I would expect that you would have an object like inside the constructor.
config.record.data
but instead you get
config.data
Oddly enough… .if you call it like this instead
var rec= myDataStore.getAt(1); var win = new myWindow({ record:rec, width:500 });
You get the correct
config.record.data
Why does it do this??? I have no idea. Seems sort of strange to me but perhaps it is supposed to work this way.
2010.05.04
ExtJS class/component constructor not running
There are a couple of syntaxs for extending a ‘class’ with the Ext library. I prefer the following syntax.
MyNewForm = Ext.extend(Ext.form.FormPanel,{
constructor:function(config){
…..
MyNewForm.superclass.constructor.call(this,config);
….
},
newMethod:function(){
}
})
I had a strange problem today. I had two almost identical classes. In one I could get a console log statement in the constructor to output. In the other I could not get it to work. The problem was I also didn’t get an error. The problem component would initialize and I could see it in the firebug dom tree.
Took me about 20 minutes to figure out the problem. Turns out I typed ‘construtor’ on the second class. Since Ext automatically calls the parent class constructor (if you do not override) I wasn’t getting an error.
Crazy how little typos can waste a lot of time…. so if you have this same problem, make sure you actually typed what you though you typed.
2010.04.14
ExtJS datefield different display format
By default the ExtJS datefield uses the same format string for both the parsing (data reading) and formatting (data displaying) functions.
I wanted to display a different format than the data format of the data. My data comes from the server in the format “Y-m-d H:i:s.u” but I wanted to display as ‘Y-m-d’ or in some cases just ‘M Y’. In my mind this should be a fairly easy thing…. Keep reading →
2010.02.01
Top 3 roadblocks to purchasing an iPad
Disappointment is the best way to describe how I feel about the iPad. Such a promising and innovative device that has developmental problems before it is even born.
No I am not going to criticize Jobs for these choices. I can see the business logic behind every one of them so that is not fair. He is after all running a business. I will however include what I think those reasons are in this little rant (and why they are bogus). So here goes … the top 3 roadblocks to purchasing an iPad
2010.01.10
Flex Builder java.lang.StackOverflowError uncaught exception in compiler
Just posting this here for someone who might be having the same problem in Flex Builder 3 (eclipse). The problem shows up as an the following error in the eclipse log file “java.lang.StackOverflowError uncaught exception in compiler”. You get to this after you have an error in the problems panel that says…. “An internal build error has occurred. Right-click for more information.” It also might show up as the following pop-up.
What I found was the problem was that I had a class that was extending another class explicitly as in Keep reading →
2009.12.01
More fun with regular expressions
I ( like many programmers I know) get just a little befuddled when trying to use regular expressions. Over the years I’ve used numerous online RE parsers to test code. Recently I found a small RE parser that I absolutely love called “The Regex Coach”.
This little gem of a program is great. (As a bonus it is free for both commercial and non-commercial uses.) Unlike other RE testers that I’ve used over the years, this one lets you actually step thru the parsing sequence and also see the execution tree of the RE. These are very handy. I find I am able to get to a functional RE statement in about a 1/4 the time as before. You can get “The Regex Coach” from here. http://weitz.de/regex-coach/
As a little bonus… here is a little gem of an RE statement (for field validation) for a field that must contain no value or one or more three digit numbers separated by commas.
(^(\d{3})(\,\d{3})*$)|(^$)
so in JavaScript the RE literal would be
/(^(\d{3})(\,\d{3})*$)|(^$)/
2009.11.27
Ext.iterate Array vs. Object Gotcha!
When calling Ext.iterate with an object the parameters passed back to the iterated function are:
(String key, Object value)
However when calling Ext.iterate with an array the parameters are:
(Object item, Number index, Array allItems)
The gotcha here is that in the Ext 3.0 docs only the object call back is shown. Because of this you might think that the array call returns the index then the actual item bu as you can see that is not the case.
There is a thread on the Ext forum here about maybe making this consistent in the next major release.
2009.11.18
Beginings with Ext 3.0 JS library (combobox)
I started working on a project a few months ago that leveraged the Ext JavaScript library for just a handful of features. After some requests for some improvements in one section I decided to try to leverage a little more of the Ext library to improve it. I decided to start just by redoing a form to use remoting. Now I’ve done this kind of thing before in all of the the Adobe Action-script platforms ( Flex, Flash and Air) so I am rather comfortable with the basic concepts. I am also very comfortable with JavaScript having worked with it for over 10 years and using DHTML and other tricks (img src updates, etc.) to do Ajax type magic before Ajax was even in the lexicon. I will say that some of the conventions used by JS developers drive me nuts… but that’s all formatting. One really completely new area for me was JSON. I’ve always wanted to try it so I figured this was the perfect opportunity. So I started with a simple task on this one form. Populate a single Combo Box remotely from a JSON datasource. Now when I learn to program a new language (or library in this case) I need two things. The docs and working examples. On the documentation side of things Ext has a very good API documentation at http://www.extjs.com/deploy/dev/docs/ The one area I found lacking was in the way of simple examples. One thing I always liked from Adobe documentation was the examples that were included the docs. Always very simple and always just focused around the one object you were looking at. Ext has provided some really nice sample applications at http://www.extjs.com/deploy/dev/examples/samples.html however it can be a bit hit and miss to locate the combination of examples that have the features you are looking for. In particular I could not locate a single example that was just as simple as …. here is how you load JSON data into a combo-box. I finally found a good one at http://technopaper.blogspot.com/2009/11/dynamic-loading-of-combobox-using-extjs.html#comments I hope to leave some additional posts as I find bits and pieces here and there.
