Archive for March, 2006

Easiest way to embed Flash inside Wordpress

Wednesday, March 29th, 2006

I was embedding my Flash inside the Wordpress posts with the html <object> tag. It was not only messy but also made it incompatible with the FireFox browser. My blog was completely unreadable in FireFox.

Luckily I stumbled across this Wordpress plugin called "Kimili Flash Embed for Wordpress" which make flash embedding as simple as writing this line:

CODE:
  1. [kml_flashembed movie="movie.swf" width="550" height="400" /]

Thats all that is needed to embed the flash movie.swf with width of 550 and height of 400.

The plugin is based on flashObject and as such it takes advantage of many of it's features, listed here.

I found that if you embed the same flash twice in the same post, or the same flash in two different posts that show together in the same page you'll only be able to see one of it, the first from above.

Can you make me first in google ???

Thursday, March 16th, 2006

Every now and then a person come to me and nonchalantly ask "How can I make my website first in google?". And she awaits a simple answer too, something like: change your website title to "best site in the world" and the background color to bluish grey. Well, not really, as you might know google optimization is a complete science.

I won't go into details about page ranking in general, at least not in this post, but more about the Flash related 'Search Engine Optimization' buzzly known as SEO. There are few different methods to improve your flash indexing by se (search engines) and I'll try to cover them all. First you need to understand that your flash .swf will be looked at, by the se, as an independent page. Which means that, if your flash rank high for some phrase then your flash .swf file will be linked directly. This is a problem because most swf files are'nt designed to be used as full individual page but as part of an html. It is possible to design your flash to look the same as a standalone page and as part of an html page with some limitations but this is also beyond the scop of this post. If you want se to link directly to your html holding the flash then use also the "alternative content" method described below.

 

Flash 8 supports Meta Tags - The simple way

It was a different century when html meta tags were considered important for seo. Search engines these days don't really care about your MetaData (the info inside the meta tags). In the old days you could write some description about your site for ex: "best site in the world" and some power words or short descriptions about it too, for ex: "best", "bluish", "Flash", "actionscript", "best site", etc'. And that was the main reason your site would have been categorized and rank. Clearly a faulty technic. But, it is possible to assume that the flash MetaData will be more influential since it's hard to index flash anyway. Anyhow it's still unclear how search engines look at these flash meta tags if at all they care about it. IMHO they do care now and they will care more in the futue. Since it's so easy to insert MetaData into your flash there is no excuse for not doing it. Click on Modify -> Document enter your title and description. That it!, now when you publish your flash it'll have MetaData.

metadata_01

 

Using Alternative Content

Alternative content means that, your html page, the one with the flash contetnt in it will also have some html content. S.e. love html it's there mother tongue so the site get indexed and linked directly to the html and not to the swf. But when the user will come to the site as opposed to the se, they will see the flash and not the html. There are few ways you can use Alternative contetnt, here I'll specify two, one I'll recommend and the other I'll recommend against.

The easiest but not the best way is to put some hidden html inside your page (for ex: in a non visible div). The user wont see the html but it's there for the se to index it. The reason I recommend against it is because se don't like this way, they feel cheated. This method is widely used by spammers and cheater and you'll be in a risk of counted as one, as so your site might get penalized.

The best way to do this is to use javascript. As for now se don't run javascript they found in a page. This enables us to alternate the html content to the flash one whenever a user enters the page. This also will enable us to check for flash availability on the user browser. In this way we create basicaly two differnt pages on the same page:

  1. Html page - for Search engines and users without the right flash player.
  2. Flash page - for users that have flash.

This guy has writen an in depth explanation about this subject and I suggest you read it.

He is also the author of this fine tool called flashObject that will help you to achieve this easily.

Alternative content - Reversed

Imagine the se spider as he crawls the web and he suddenly bump into your .SWF file. He then extract out his feelers and try to probe your flash file. If it was a few mothes ago (maybe years) the flash file would have look like nothing to him, a big chunk of nothing. These days the spider will probebly be able to extract some inforamtion from your Flash .SWF file (check the next topic for further info).

Since se love html so much why not give him html inside the flash. Put a TextField outside the visible stage with some html text, for ex:

<html><head><title>Best Site</title></head><body>some html...</body></html>

The search engine will be able to see the html text allthough it isn't on the visible stage as long as it has initial value assigned at author time.

 

Macromedia's Search Engine SDK - See what you look like

Some time ago Macromedia released their 'Search Engine SDK'. This tool provide search engines the ability to parse and index content (links and text) from inside a swf (flash) file. Google for their part said they're already developed their own swf parser and they got better results then the macromedia SDK. I greatly hope so, coz the macromedia's one has some issues. The main problem with it is that it'll only extract text from a TextFiled with initial value assigned. Which means that search engines won't know about your dynamiclly loaded content. But still it is good to know that your flash can be indexed in some way. You can downlod the 'Search Engine SDK' from macromedia and check your own swf so you'll have a clue how it is seen by the search engines. This is an excerpt from the FAQ: "The SDK includes an application named ‘swf2html’. Swf2html extracts text and links from a Macromedia Flash .SWF file, and returns the data to an HTML document."

To download and use this tool go here and enter your email address (you need to be registered, registretion is simple and free for everyone). After you sign with your email macromedia will send you the URL for downloading the tool. Extract the zip and look for the swf2html.exe in \flash_search_sdk\windows. Now put any .swf you wanna check in the same directory with the swf2html.exe and run this line from a CMD prompt:

swf2html myMovie.swf -o myMovie.html

This will generate an HTML file named 'myMovie.html' with the extracted links and text from the flash movie 'myMovie.swf'.

If the last step looks obscured to you, here a more explanatory step-by-step process:

  1. Download the 'flash_search_sdk.zip' from macromedia and extract it.
  2. Create a new directory on your hard drive for eample: "C:\flash_check"
  3. Copy the file 'swf2html.exe' from the 'extracted-location\flash_search_sdk\windows' to the new directory (in this example: "C:\flash_check".
  4. Copy any .SWF file you want to check to the same directory (for ex: myMovie.swf).
  5. Click on "START" -> "Run" in the Run prompt type "CMD" without the quotes.
  6. When the CMD opens, it's default value is probebly something like (on winXP): "C:\Documents And Setting\user>"
  7. Just type this line without the quotes: "CD C:\flash_check" and press ENTER.
  8. And this line also: swf2html myMovie.swf -o myMovie.html and ENTER again (duh)
  9. Look for myMovie.html in the same directory.

Download swf2html_exaples

Easier way to see what you look like...

This site is probebly implementing the macromedia SDK or something similar. It gives an easy way to check how your flash .swf online files are perceived by se. Paste in the path to your flash and get a look at yourself.

 

Summary

Search engines work hard to get an objective real view of the websites they crawl. As similar as they can to the way the user will see and use it. Since Flash is a big part of the intenet se can't allow themself to ignore it. Se (mainly google for now) are already indexing flash content and their efficiency will improve in the future. Prepare your flash and html with the methodes described as there is no excuse anymore.

 

200,000 Flash games in one link

Thursday, March 16th, 2006

Google can now search and parse what's inside flash swf files. Which means that now you can search flash content directly. For Example, Search this pharse in google to get approximately 200,000 links to games:

"game" filetype:swf

or follow this link.

 

Check your Interval

Tuesday, March 14th, 2006

I was amazed by the inaccuracy of intervals in flash. At least on my system a 1000 millisecond is about 1056 milliseconds. I'm using flash player 8.5 alpha 3 and the swf was compiled with flash 7. On some other systems I've checked this the 1000 ms was acurate but other values were not. On my system some starnge values I've tried, like 546, 682, etc' came out accurate. What gives !?!

Check your interval:

intervalinaccuracy.zip

How close ?!

Sunday, March 12th, 2006

 As a biker I feel obligated to show this video (right click and "Save Target As...").

biker.jpg

 

 

 

 

 

 

 

It is a very welcome initiative from the "Uk Department for Transport". Check out theire site.

setTimeout in flash 7

Thursday, March 9th, 2006

As you might know Flash 8 was reinforced with the setTimeout functionality. You can now tell flash 8 player to run a function once after a given milliseconds/interval:

setTimeout(trace, 1000, "string to trace");

will trace the string "string to trace" after 1 second.

But what if you're like me, and still need to use flash 7 or even 6, and you also want to enjoy the simplicity of setTimeout. Well I was using my own implementation of setTimeout since flash 6, first with a function and when AS2 came out, I've rewriten it into a simple class you can download here.
To use it unzip the 'net' folder into your flash classpath if you don't sure about the classpath just search for it in the flash help or put it in the same directory as your fla. Now you can use it in your flash 7 or above as follows:

import net.guya.Timeout;

Timeout.set(trace, 1000, "string to trace");

this will do the same as the above function and willl trace the string "string to trace" after 1 second. As with the flash 8 'setTimeout' in the flash 7 'Timeout.set' you can send as many variables as you like after the interval. The trace function only expects one string variable so thats what she gets.

Here is another example:

You can also pass an object reference to Timeout.set

Timeout.set(this, someFunction, 1000, variabl1, varible2, ...variableN);

for example:

import net.guya.Timeout;

var nX:Number = 100;
var nY:Number = 50;
Timeout.set(this, drawLine, 500, nX, nY);

function drawLine(x:Number, y:Number){
   this.lineStyle (2, 0x000000, 100);
   this.moveTo (0, 0);
   this.lineTo (x, y)
}

This program, after 0.5 second will draw a line from the top left to point(100, 50). Here you must send a reference to the object you want the 'this' inside the drawLine function to refer to. In this case it's the MovieClip where the line will be drawn. If no object reference is sent in this case the 'this' inside the drawLine will refer to the Timeout object and so no line will be drawn.

A Timeout can be deleted before its function was called with the 'clear' method:

var nTimeout1:Number = Timeout.set(trace, 2000, "I will never show");

Timeout.clear(nTimeout1);

Nothing will be tarced because the Timeout is deleted before it has a chance to run the trace function.

Download the Timeout Class.

< update >

setTimeout in flash 6

After some feedback I realized I should have written this function also, you only need to copy and paste it in your flash 6 files:

_global.setTimeout = function (o, func, ms){
   var a = new Array();
   for(var i = 3; i < arguments.length; i++) a.push(arguments[i]);
   var n = setInterval(function(){func.apply(o, a); clearInterval(n);}, ms)
   return n;
}

and use it like this:

setTimeout(this, trace, 1000 , "string to trace");

Download the setTimeout for Flash 6 function.

< /update >

Just Do It

Thursday, March 9th, 2006

I want a blog, but why?
What will I write about?
Macromedia Flash is one of my main interests these days, so should I make another flash blog?! there are already like a billion out there and some of it are unbelievably interesting. These questions and more, I wont tire you with, are flooding my mind as I come to write my first blog post. I thought that the Wordpress installation will take some significant time and so I'll have time to think about what to post, but after a minute I was staring at my fully functional blog. It's still in its default design and that's also an excuse, first I'll finish my original design and then I'll start posting...
Then I came to my sensses and I indulged myself with one of the greatest marketing phrases of all time. Whenever someone come to me and say she whants to do something but she first need to: lose some weight, get an haircut, finish school, finish college, get married, find a job, lose the job, get a cat, just sleep for a while, wait for the kids to leave the house, wait for the born baby, etc. whenever it's obvious there is not a rational reason to not do it beside our hesitant human nature. I tell her to cut the cr*p and "just do it". As you know advices are much easier to give then to take. But this time I managed to take my own advice and I "just did it". So here it is, my first blog post. hopefuly more will come.

I always give credit to Nike for the phrase, like someone don't know it's theirs. These days, thanks to the mighty google I can give credit to the individual who claimed it, his name is Dan Wieden.

I also came across this amazing "Just Do It" commercial it's from last year but I never saw it before.