Monthly Archives: May 2008

I am even a bigger A**

Good news for me, I just passed the Adobe Certified Expert in Dreamweaver CS3 exam and achieve a not so good score of 80% in 30 minutes. After my certification in Flash CS3 two weeks ago, it is now the time for the next one πŸ™‚

I wanted to thanks the folks at Adobe who offer me the certifications (as an Adobe User Group Manager), it really a great idea and preparing those exam offer a good training.

Ahmet

 
0 Kudos
Don't
move!

A Chat with FMS 3 coded in ActionScript 3.0

Some days ago I started using FMS (Flash Media Server). Obviously I wanted to write my project in AS3 and realized that they weren’t a lot of documentation on the topic, that why I’ll post here every part of code I made working.

My last project was about creating a chat. I downloaded the demo from FMS2 and tried to update it to AS3, not a big deal, but I’m happy that it works now.

FMS Chat Demo

I didn’t design it in OOP (object oriented programming) as it is only a simple demo, but I think it can be a good start for anybody starting using FMS with AS3.

I wrote 2 files, one .fla for the client and one .asc for the server.

The .asc file

//Fired when the application is loaded on FMS
application.onAppStart = function()
{
	trace(" *** FMS Application Started *** ");
	/**/
	// Get the server shared object 'users_so'
	application.users_so = SharedObject.get("users_so", false);

	// Initialize the history of the text share
	application.history = "Welcome to this chat!n";

	// Initialize the unique user ID
	application.nextId = 0;

}

//Fired when a client connect to the server
application.onConnect = function(newClient, name)
{
	// Make this new client's name the user's name
	newClient.name = name;

	// Create a unique ID for this user while incrementing the
	// application.nextID.
	newClient.id = "u" + application.nextId++;

	// Update the 'users_so' shared object with the user's name
	application.users_so.setProperty(newClient.name, name);

	// Accept the client's connection
 	application.acceptConnection(newClient);

	// Call the client function 'setHistory,' and pass 
	// the initial history
 	newClient.call("setHistory", null, application.history);

	// The client will call this function to get the server
	// to accept the message, add the user's name to it, and
	// send it back out to all connected clients.
	newClient.msgFromClient = function(msg) {
		msg = this.name + ": " + msg + "n";
		for(var i=0; i < application.nextId; i++)
		{
			application.clients[i].call("msgFromSrvr",null, msg);
		}
		application.history += msg;
	}
}

//Fired when a clien disconnect from the server
application.onDisconnect = function(client)
{
	trace("disconnect: " + client.name);
	application.users_so.setProperty(client.name, null);
	application.nextId--;
}

Here we got 3 steps,

  1. application.onAppStart: is called when the application is loaded in FMS, it basically inform us that the application is ready to use.
  2. application.onConnect: is called when a client connect to this application in FMS, here is all the server logic to interact with the client(s).
  3. application.onDisconnect: is called when a client disconnect from the application or when the application is unloaded from FMS

The .fla is only the for UI (user Interface) and for the interaction with the server. If you have trouble understanding what is happening look at this code where I explain how to call functions from server side to client and from client to server.

I know it is not the state of the art in terms of chat but again, this is just a small demo on which complex interaction could be built.

you need to download FMS 3 free developer edition to start having fun with FMS.

Download the source of the FMS Chat

Ahmet

 
0 Kudos
Don't
move!

What I love in DW CS4

I had the hand on Dreamweaver CS4 for more than one month now, I’ll share with you what really helped me in my everyday life. To shorten, for people afraid of my English: if you didn’t make the move to DW CS3 du to the lack of improvement you will be happy with DW CS4!

It has been totally redesigned in terms of User Interface (UI), it is now aligned with the whole CS3 UI (and even better has it get ride of the top title bar):

Dreamweaver CS4 - Topbar

There are a lot of new features, that I’ll let you discover in details directly on Adobe Labs my favorites are below.

Related Files: Displays all the documents associated with your current page.
This feature is really useful, imagine your are working on a php file, that include a lot of other files (php, CSS, JS). Dreamweaver will offer you a shortcut to these pages, so you are now only one click away from the files you need to edit.

Related Files in DW CS4

Code hinting for Ajax and JavaScript frameworks: Improved support for JavaScript core objects and primitive data types.
This one is also a time saver, lately I was opening Aptanta when I had to edit JavaScript files, but now I can stay within DW.

Code Hinting for JavaScript and Ajax

[…]Work with popular JavaScript frameworks including jQuery, Prototype, and Spry[…]

Subversion integration: You can update your site to get the latest versions of its pages directly from within Dreamweaver.

Definitely a must have for every web projects!

That was the features that saved me the more time, after the deception of Dreamweaver CS3 I am really happy with the new version!

If you are interested go download it and get a serial number (you need to enter your serial number from your copy of Dreamweaver CS3, GoLive 9 or GoLive CS2).

Ahmet

 
0 Kudos
Don't
move!

I’m officially an A**

I just passed my exam of Adobe Flash CS3 Certified Expert (ACE) and achieve a not so bad score of 92%… in 15 minutes (from the 90 minutes available).

Exam wasn’t hard but there still was some tricky questions.
Well, now it is time for the next one πŸ™‚

Congratulations to CΓ©dric who did as well pass his exam!
Ahmet

 
0 Kudos
Don't
move!

Flash Media Server 3: calling a function from ASC to AS3 (Server – Client interaction)

I had quite a hard time figuring out how to call a function hosted on FMS (an .asc file) and how to call a function on the client from the server. I’m new to FMS (Flash Media Server) and there is not a ton of documentation, updated, for ActionScript 3.0.

So here is a simple example of interaction between server and client function. Obviously you first have to install FMS on your computer (I used the free developer version of FMS 3).

Installed? Let’s start: we will need two files, a document class for your .fla and an .asc (server side ActionScript) file.

.as file (document class): Interaction.as

package
{
import flash.display.MovieClip;
import flash.net.NetConnection;
import flash.net.Responder;
import flash.events.NetStatusEvent;

public class Interaction extends MovieClip
{
// Responder for call to server's
private var myResponder:Responder = new Responder(onReply);
private var nc:NetConnection;

public function Interaction():void
{
//Constructor
nc = new NetConnection();
nc.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler );

// Connect to the server.
nc.connect("rtmp://localhost/Interaction");

//Allow method within th class to be called by the server side script
nc.client = this;

}

//Handle NetStatus
private function netStatusHandler( event:NetStatusEvent ):void
{
switch( event.info.code )
{
// Successfully connected to FMS, execute function
case "NetConnection.Connect.Success":
trace("connected");
callServerSideF();
break;
}
}

public function callServerSideF():void
{
//Call a server side function written on an .ASC file
nc.call("callFromClient", myResponder, "Server");
}

public function calledByServerSide(msg:String):void
{
//Function called by an .ASC file
trace("ASC have to say :"+msg);
}

// Responder function for nc.call()
private function onReply(result:Object):void
{
trace("Client have to say " + result);
}
}
}

Now the .asc file: main.asc

//Application is launched
application.onAppStart = function()
{
/* Allow debugging */
this.allowDebug = true;
}

//Client is connected
application.onConnect = function( client )
{

//Accept the connection
application.acceptConnection( client );

//Call the function calledByServerSide from AS3
application.clients[0].call( "calledByServerSide", null, "Hello Client :-)");

// Define new client function for a nc.call().
client.callFromClient = function( helloStr ) {
return "Hello Mr " + helloStr + ":-D~";
}
}

//Client disconnected
application.onDisconnect = function( client )
{
//Trace on the FMS Application console
trace( client+" is disconnected" );
}

Copy main.asc on your FMS application folder (I called it /Interaction/).

I was helped by a tutorial made by ‘Newtriks’ and published in WebDesigner magazine (files are available to download, issue 137).

Download the example.

Ahmet

 
0 Kudos
Don't
move!

What Google Knows About Spam

Matt Cutts, the head of Google’s Webspam team has published on his blog his session at Web 2.0 Expo:

You can access all the video from the expo on Blip.tv

It is interesting to note that Google have no problem with SEO and that the politic again (web) spammer is to make them lose time, effort and frustrated them πŸ™‚

You can also view the slide from his presentation directly on his post.

Ahmet

 
0 Kudos
Don't
move!

Is using Flash Wrong for SEO and Usability?

Shari Thurow, the Founder and SEO Director of Omni Marketing Interactive wrote a very interesting answer in led-digest.com about the solution I blogged a while ago: ‘Holy Grail: SEO Model for Flash and Flex Content‘.

Here are a few quotes of her, with my answer below:

[…]as long as you are giving search engines one version of a Web page and users another version, then there is a problem[…]

I totally agree but are we talking about the presentation layer or the data layer?
Most websites content are saved on databases, then called whenever needed. Now if the server side technology used produce an XHTML or an XML, we agree that there is no differences?
The XSLT just load a SWF (a Flash or Flex application) on top of an XML. The SWF then use the data from the XML. Whether it is possible to add content on the XML that will never be used on the SWF is an ethical problem, not a problem of Flash. You can also use ‘badly’ the HTML attributes in normal way.

[…]There is the assumption that users want content delivered to them in Flash. I’ve seen Flash used well. I’ve seen Flash used poorly. Only once in my entire Web design career was it necessary for us to do an entire section of a site in Flash […]

So in your opinion, if the Flash player penetration is above 90% it is because of this assumption? As you said, SWF can be used greatly or poorly and everything in the middle. I’m not a partisan of using SWF just for using it. The best technological solution must be used for the need of the users (not for the developers nor the marketers need). I don’t want to go through to much point but just think about data visualization, broadcasting (TV / sound) or experimental marketing.
I must accord you that SWF changed a lot recently (the last two years) and I understand that you didn’t had to use it before, but keep yourself ready πŸ™‚

[…]Do they really usability test to determine task completion, efficiency, etc. in order to verify whether users really prefer Flash-delivered content or not? I’m sure there is a
rare few out there who do.[…]

Most of the usability testing that I made or that I read showed that people tend to be more comfortable in front of a UI (user interface) they already know. So obviously ‘traditional HTML’ is often plebiscite, but in terms of task completion, efficiency, UI learning curve, the SWF have an immense advantage: they can follow every move of a user, learn from his mistakes, make elements bigger, dynamically improve the UI to his needs. Doing this with ‘traditional’ web technologies is much harder (IMHO).

[…]I have the kahones to tell a Web site owner that their users do not want Flash and they should change the design. And I can prove it with usability testing.[…]

Again, you talk about usability testing as if it comes from the sky. As far as I know, before doing usability test, there is a reflexion about the UI (I cannot teach you what you know better than me). Usability is everywhere: in the bus, in your kitchen and in front of a screen. But I do really not see the point of aiming at the SWF.

Ahmet

 
0 Kudos
Don't
move!

Applying ‘Semantic Web’ standard for SWF

Recently Digg made an official adoption of RDFa (a set of extensions to XHTML being proposed by the W3C). While watching a tutorial about RDFa (below video) I asked myself how it could be possible to do it for Flash/ Flex document.

In fact bringing RDFa to a SWF itself is not possible, as I far as I know, but if you use XSLT and XML to provide the data to your SWF then you can also add the RDFa extension into your content, very easily!

Some more explanation on how to embeded RDF attribute on a XHTML web page:

Ahmet

 
0 Kudos
Don't
move!