Archives

Viewing by month: April 2004

Apr
23

More on the HTML editor HTMLArea

0 comments Posted by: Laura

I got a comment in my previous post asking about the HTMLArea editor CSS plugin. I am no expert here, but this is how I use it.

First of all, if you have your elements styled (h2,h3,p,a, li, etc.) you may not need the css plugin. By simply adding the style in the textarea (it has to be html escaped), the styles are applied anytime the user adds a paragraph, link, etc. The same can also be achieved by adding editor.config.pageStyle = "@import url(your css file);"; to the javascript init function but it only works in IE. I edited the regular dropdown menu so it shows the elements defined in my style sheet that can actually be used.

read more Category: ColdFusion |
Apr
18

Open source cross-browser HTML editor

2 comments Posted by: Laura

I found this great HTML editor for both IE and Mozilla! Their version 3 (current release candidate) works in IE 5.5+ in Windows and Mozilla 1.3 in all OS. It has lots of customisation features and you can even add your own buttons and plugins. It comes with a CSS plugin, that I use to let users set styles, eliminating the font types and sizes (none of us like the <font> tag, right?). And the best is that it makes XHTML valid code.

read more Category: ColdFusion |
Apr
08

Flash casting weirdness

4 comments Posted by: Nahuel Foronda

Now that we have strict typing in ActionScript 2.0, the compiler complains whenever we try to assign a value to a variable that doesn't match its expected type. That is easy to see in the following example:

I made a class ( Container ) that holds any kind of data. Since it is very generic, it only knows that it holds an Object.
This class also has a method ( getItem() ) that returns that data. So if we try to assign the return value of getItem() to a reference of a type other than Object, the compiler will complain:

var c:Container = new Container(new Array());<br />
var i:Array = c.getItem();

the compiler will throw an error like this:
Type mismatch in assignment statement: found Object where Array is required. var i:Array = c.getItem();

So the solution for this is to cast the returning data to the class that we need. We have two options:

Option 1 var i:Array = Array(c.getItem());<br />
Option 2 var i:Array = (Array)(c.getItem());

Both works very well except when you try to cast to your own classes, not the built-in ones. To show that, I made another class ( Item ) and a test class ( TestCasting ) that shows this behavior:

Option 1 var i:Item = Item(c.getItem());<br />
Option 2 var i:Item = (Item)(c.getItem());

The first option runs without a problem, but the second doesn't. It simply assigns "undefined" to the variable without the compiler complaining. So it's obviously better to avoid the second option. I used to do it that way because it always works in Java, but not in Flash. You never know when these little things will jump on you.

For a better understanding, I put this example in a zip to download.

Category: Flash |