IE double click to activate flash

Microsoft released an update for Internet Explorer that changed the way the browser
displays and runs ActiveX components, flash movies and Java applets.
Because of security issues the browser asks you to activate these controls by clicking on them. Meaning that to actually “browse” through the flash site, you need to double click it the first time.
Read more about it here: Flash Player Technote: Internet Explorer displays a box around flash content

A way to prevent this is by including your swf file with an external javascript file. More information on how to do this you find here: Active content update article

And for the lazy ones among us, this should be a free program that solves it for you (didn’t try it myself): Flash Release.

A nice video on it, you can find here: YouTube Video

Flash embed font bold

I use a lot of font types that people don’t normally have installed, so I embed the fonts in Flash. Only, now I tried with actionscript and CSS to make part of a dynamic text field bold. Only, the bold part of the text field wouldn’t show, the text would just not be there.

So, then I found out that when you embed a font in Flash, flash doesn’t include the whole font family automatically. Meaning, that by embedding a regular font, the bold and italic aren’t included.

A workaround for this, is to just add another text field to your stage, somewhere out of sight (or not), and embed the same font type but with bold activated. Run your flash file again and you’ll see that the bold in your other text field is now visible too.

See also: Flash Technote: HTML text fields do not display formatted text

Sockets vs AMFPHP

Today I did some research on whether the flash project I’m working on would be better of using sockets or AMFPHP.

Turns out the biggest difference between the two of them is that sockets can push and pull and AMFPHP can only pull.
Push meaning that the server can send data back to my flash client when a change occurs.
Pull meaning that the client can ask the server for data on a certain event.

Of course the biggest advantage of AMFPHP is that it’s free. There are also free socket server scripts available, but then you have to be willing to host the server yourself.

This link was a very big help to me:
Flashfocus link (Dutch site)

In my case, sockets are the way to go … the main idea was to limit the bandwith that the client is using, so AMFPHP wouldn’t be a solution to my problem.

Apply textformat to input text

Today I encountered a weird little problem.

I created an input textfield with actionscript and wanted to apply a textformat to it.

The following code created the desired textfield:
this.createTextField(“name_txt”, this.getNextHighestDepth(), 10, 20, this._width – 20, 15);
this.name_txt.border = true;
this.name_txt.borderColor = color1;
this.name_txt.text = “Name”;
this.name_txt.type = “input”;
this.name_txt.maxChars = 20;

Textformat:

//——————————
// SET TEXTFORMAT
// – color -> color of the text
// – align -> “left”, “center” or “right” (“justify” in flash 8 )
// – bold -> true or false
//——————————
public function setTextFormatOptions(color:Number, align:String, bold:Boolean):Void {
my_fmt = new TextFormat();
my_fmt.font = “Verdana”;
my_fmt.color = color;
my_fmt.align = align;
my_fmt.size = 10;
my_fmt.bold = bold;
}
To set and apply this textformat:

setTextFormatOptions(0×999999, “left”, true);
this.name_txt.setTextFormat(my_fmt);

Now, this worked perfectly for the text that I put into the textfield initially, so by code … but as soon as I started inputting my own text, the textformat was gone …

Now, what’s the solution, just put this line under it:

this.name_txt.setNewTextFormat(my_fmt);

And all the text you input in the field will look like the textformat too.

To sum it up, the setTextFormat seems to be only for text that is hard coded into the textfield and the setNewTextFormat property seems to be only for the new user inputted text. So if you want to put both an initial text in the textfield and being able to have user input in that textfield, you have to put both lines in your code …

Flash and Ajax together

Many people talk about Flash and Ajax like they’re competitors, both being rich internet applications (RIAs). After doing some research on them, I beg the difference though. Of course, you shouldn’t use them just to use them, but either have their own strengths.

First, though, let’s start with the beginning …

Continue reading “Flash and Ajax together” »

Flash & Ajax

Many ppl compare Flash with Ajax, they would never even dream about actually letting them work together. My latest project for school is to investigate the two of them and see to what degree they can work together and whether it’s actually a wise thing to do so …

On Thursday I have to present this project in front of a “jury”. So until then … my findings are safely stored away on my laptop ;)