October 12, 2007

Actionscript 3 - making the simple things harder

You will find other articles relevant to this document in these sections:
Richard Lee @ 12:41 pm

Gees, I’ve been away from flash for nearly 12 months now. And today I’ve spent over and hour trying to create what I consider ra relatively simple clickable interface. A few buttons on a map which when clicked popup a php page which lists information from a database…Now im confronted with unnecessary complicated event handlers.. Why oh why couldn’t they keep Flash Actionscript simple, like Javascript. I miss Actionscript 1 :( …All i wanna do is pass a string parameter from the button to my php script ARGH!

March 2, 2007

Dangers of crossdomain (crossdomain.xml) for flash

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:04 am

Chris Shiflett recently posted an article on crossdomain.xml and the dangers of allowing cross-domain Ajax requests. Something to keep in the back of your mind when using public services or crossdomain.xml services. Flickr, Youtube, Yahoo and Amazon are all fixing/fixed this issue. In short separating out the public service for API that operates to its own domain is enough to stop this potential security vector.

March 1, 2007

Google indexing flash

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:37 am

I was suprised to find today that google was indexing some of my flash files which has lead to some discussion about how google is extracting the text, how it is navigating etc. We assume that now they must be using OCR, as the original issue was extracting the text from the flash file without ensuring that it is displayed to the user. A call to google or a hunt on the net is in order! If anyone knows anything about how this is working and ways for flash developers to code up google’able friendly flash swf files please post!

February 22, 2007

Flash based alternative to mailto:

You will find other articles relevant to this document in these sections:
Richard Lee @ 5:11 pm

When publishing a number of email addresses to a web page you run the chance of a spam bot scraping your site. There are a number of alternatives; such as using a mail form, obfuscating the mailto link with JavaScript or even converting the address to an image. While mail forms will conceal your email address from spam bots, they also conceal your address from the users who may simply want your address for other correspondence. Obfusticating your mailto link with JavaScript is also pretty useless since, being client site any spam bot can “resolve” the link much like your browser. And last but not least using images to display your address takes away the linking functionality. So I suggest a different alternative - Why not use Flash to display the address?

Using Flash, we can load the address client side in parts; “username” “domain” and form the address in a Flash textfield. Then we can simply use the getURL() function OR better use the textfield htmlText with an anchor to simulate our mailto link.
Here’s a hardcoded example of how I do it:
1. Create a 200px x 18 px document (FPS doesnt matter)

2. On Layer 1 add a textfield to the first frame, setting it to type dynamic, and give it an instance name of address_txt
3. Create a new layer above the previous layer for your Actionscript and add the following:

address_txt.htmlText = (username != undefined && domain != undefined) ? '<a href="mailto:'+username + '@' + domain + '">'+username + '@' + domain+'': "no email";</a>

4. Now using Publish your document (making sure you publish a html page in addition to your swf file)

5. Open your published html file in Dreamweaver or your favourite editor and append the querystring “username=joebloggs&domain=gmail.com” to the

<param movie="..." ></param> and <embed src="..."> </embed> tags:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="200" height="18" id="mailto" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="mailto.swf?username=joebloggs&domain=gmail" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed xsrc="mailto.swf?username=joebloggs&domain=gmail.com" quality="high" bgcolor="#ffffff" width="200" height="18" name="mailto" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

6. Finally run your movie in the browser and you should see your email address in the Flash textfield!

December 20, 2006

FXT - Flex Templating

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 11:02 am

If you get a chance checkout the FXT project:

Flex Templating provides rich client side website templating using MVC (Model-View-Controller). FXT solves a host of problems for using Flex and Flash Player for website development.

This is an implementation of client side templating using Flex. It is a very compatible and productive way to make data driven websites very quickly. The custom Yahoo Web Search mashup took less than an hour to create and the entire UI can be reskinned by changing a single SWF file.

The key point is that the Model within the HTML page drives the View of a Flex application. It allows Flex to compete in a page centric world and expands the reach of the Flex marketplace. In a typical HTML based application, data (Model) and tags (View) are merged and intertwined. With FXT, the data (Model) is separate from the templated Flex code (View) until both arrive on the end users machine. Both pieces need not arrive or update at the same time, creating a more real-time feel than most HTML applications have. This is because the data (Model) remains structured all the way to the client side where it is templated at runtime rather than being merged at the server. Using E4X, you can utilize components, data binding, and async loading to create truly immersive rich web applications. Reskinning in this paradigm is simple. If the developer changes the SWF template on the server, the entire UI will change instantly. This simplifies development and deployment of larger scale sites and allows for small teams to edit sites in an extensible and productive manner.

The solution is also 100% SEO compatible as the Model of a page is within the HTML of the application. Better still, the data can be easily parsed with any xml parser by web crawlers or other Mashup applications.

I am not quite sure if I agree with the last quote about 100% SEO compatible, the Model is defined in a script element, which I doubt google will index correctly. Google looks for information that is “presented” to the user, there is no way to ensure that the model “IS” viewed in the Flash Movie (?). This being said it seems to index our XML information fairly well - so maybe it is!

November 8, 2006

Adobe FDS2 - US$20K

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 10:13 am

Looking through the Adobe website I came across the pricing structure for the Flex Data Services 2 framework, the enterprise edition costing $20K per CPU. A budget that would be un-achievable to most, and even in a high-load website, you will most likely have to setup a clustered environment, meaning that you will most likely be up for more than one licence. Ouch!
So where does that leave us? We can consider the other technologies that are available, including XML and WebServices. Both work in plain text XML which works like a dream for small data transfer, but you quickly consider the amount of formatting and XML document places around the data and often the formatting takes up a lot of the file size, bloating it out. (This may be remedied slightly through GZip compression over HTTP, but I need to investigate…).

So if we still want Flash Remoting without the price tag where do we turn? - Open Source

Quoting a recent article I read I have often heard people claim “Companies do not invest into open source technologies” which I think is pretty wrong. A quote obtained from a recent article with Rasmum Lerdorf (a developer of open source technologies - PHP) when asked about ‘The Open Source movement is still portrayed by many as “anarchistic” and some kind of “threat to society”‘ :

As far as being mainstream, the product of this “movement” is most definitely mainstream. The “movement” built the Internet as we know it today. It built the TCP/IP stacks used in most of the operating systems people use (yes, even Windows). It built the most popular Web server in the world, along with the DNS and MTA systems that make the Internet tick. Heck, if you go back a bit, it built the entire industry. The first operating systems were all open source, because that was the only sane way to do things. You could not sell someone a big mainframe without providing the source to the brains of the thing. It was only later on that the concept of not providing the source code was introduced.

But I guess your real question is what I think of Microsoft’s attempt to convince the world that large groups of people collaborating to solve problems somehow threatens the very fabric of the society we live in. And I don’t think there are “many” people making this claim, as it is complete crap — I would like to think that the world is a good place and not full of people who would propagate such a ridiculous idea. Let’s put an end to all meetings of large groups of people while we are at it. They might be evil anarchists out to destroy the world.

In the end, mainstream acceptance is not the goal. The goal for most people who work on free software and open source projects is the technology itself. It is building a tool that solves the problem. It is not about ideology for most of us, and as such, mainstream acceptance only involves mainstream use of the technology. This has been achieved on many fronts already, with many more still to come.

Getting past the whole Corporate versus Community conversation and moving on;

PHP as a thin layer provides great database layering, with a nice framework AMF-PHP which could handle basic output to flex. This framework works great, but still has around 40-50ms class instantiation cost per request (which may be considered pretty low, and can be tuned with APC). Making the move to a JEE environment means that we can handle database queries through a JDBC environment, bringing JDBC equivalent database into PHP means more overhead, and unless you go that path it makes it more difficult to make your whole project scalable. But discussing PHP and JEE performance is not the point of this article, we are talking about alternatives.
OpenAMF is a JEE alternate to the Flash Data Services offered by Adobe. I found a nice little introduction to openAMF with this article. Although a slightly bloated introduction regarding JEE, PHP and ActionScript it is still relevant to conversations we have been starting on this blog, such as “Where does PHP really sit?

One of the cumbersome of using Java is the relatively complex setup of Java applications, with different steps based on the container. J2EE helps on this, exposing a more standard framework to follow for web developers. Also Java is not a common shared hosting offer, and this make sense because the power of java and his multithread run shines in big applications or when a lot of traffic is expected, due also to the live of servlets in memory. Usually little-medium applications fits fine in more straightforward languages like PHP. So freelancers developers not involved in big corporations are not usually faced to Java, and it’s a shame, because it’s a great language. But the grow of ActionScript from AS1 to AS2 force coders to write in a more Java-like (or should say OOP-like) way, so Java seems more familiar to them. And AS3 will reinforce this being a really truly class based language (in fact, not compatible with previous versions of the Flash Player) All of this make the jump to Java less heavy for actionscript coders, at least with Java in relationship with Flash.

Being Java a wide field, probably Flash developers will be faced first in data exchange with Java. This could be done in many faces, in example name/value pairs could be solved with some jsp file, but the really power of data exchange is exposed trough Flash Remoting. Even java can map ActionScript classes to Java classes whit out problem, something that arises as a problem in the first implementations of other Remoting libraries like amfphp (last versions solve this) Also since the gateway runs as a servlet, is really fast in doing his work (except the first time of course).

You  can read more about AMF-PHP here for using PHP or take a look at JEE alternative OpenAMF.

November 6, 2006

ActionScript event handling using a Proxy

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 6:58 pm

I came across a nice little overview of the Proxy pattern applied in event handling for ActionScript today, if you are looking at the way you handle your event/triggering in your AS classes have a look. http://www.person13.com/articles/proxy/Proxy.htm

October 31, 2006

Debug flash communication

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 10:19 am

For a few recent projects we have been implementing a RIA (Rich Internet Application) interface to browse the website. Namely Adobe Flash. When running the flash movies in the browser player it is often difficult to diagnose communication problems that occur, such as HTTP errors (like 404, 501) as well as XML, SSL and Flash Remoting.

After having a bit of a play around I found that Macromedia/Adobe installs a few debug flash movies to aid your diagnosis when you install the Flash Remoting extensions. These are located in your application data, usually something like:

“C:\Documents and Settings\cman\Local Settings\Application Data\Macromedia\Flash 8\en\Configuration\WindowSWF\NetConnection Debugger.swf”

Note: You may need to change your folder view settings in windows so you can see hidden folders.

While this is a great start and can often be just what you need, another good tool that I found for helping you diagnose communication between the server and your browser generically for all sorts of comms (eg, showing your HTTP generated by your HTML) is ServiceCapture.

I had used this to view the returned Flash Remoting packages, which ServiceCapture kindly deflates and presents returned results for you, as well as timing the requests, size of request packets etc. The program comes with a trial period, by required you to pay US$34.95. But the amount of time it saves you and how much you come to rely on its diagnosis it is well worth the investment.
As most testing goes, it is about your toolkit. Giving you a good set of tools that you can configure to give you answers about why things are going wrong saves you a lot of additional trace statements.

ServiceCapture link

October 30, 2006

T2Tea - Online tea, gifts and homewares shopping/ecommerce with Flash

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 11:31 am

If any of you have been wondering where I have been or been upto leading up to October, it has been working on the new T2 Tea website.

T2 offers Australia’s largest range of beautiful, fragrant teas from around the world. The website offers ways to further create the experience offered in their award-winning stores; browse for teawares and learn the delicate art of brewing tea developed over many centruries.

The T2Tea website (powered by Radiant Logic PTY LTD we have won a IMA award) has been a completely revamped version of the 2005 XMas site we did last year, and has been redone completely in Flash. It allows visitors to interact with T2 through the web in completely new ways, through interactive tea selectors, learning how to brew and interactive shop creating a whole new experience for the visitor.

Working with the talented new media team at Carbon+ (now Rich Creative), Radiant Logic PTY LTD had the task of designing and developing the Ecommerce and Content/Product Management for the project, as well as creating a fast system for the Flash Designers and Developers to access and search the information, and, process orders, with zero impact on their design. Using Flash Remoting and my own developed Ecommerce and CMS products this developed the foundation to power the rich interface (RIA) architecture with zero impact on the design/presentation of the interface. Staff can quickly update all content, including products, news and pages, staff area, employment etc. The ecommerce system accepts online credit card transaction, calculated australia post shipping and optinal gift wrapping services as well. There was never a break across to HTML like many other Flash ecommerce sites, this site kept the user in the site the whole time while still providing a Safe Secure system for visitors to process their purchase orders online. The system saves time for various wholesaler and resellers by allowing ordering to occur online instead of a paper based system.
Please check out the site and have a browse of all the interactive features, I hope you enjoy:

http://www.t2tea.com.au/

NOTE: As well as this project I have been working on several other flash driven sites, all content managed, as well as another flash ecommerce project to be launched shortly. I will keep you posted.

September 11, 2006

Actionscript 2.0 OOP Resources

You will find other articles relevant to this document in these sections:
Richard Lee @ 10:37 am

Been refreshing the Actionscript skills of late and came across some excellent resources for learning OOP in Flash.
Exploring Version 2 of the Macromedia Flash MX 2004 Component Architecture

http://www.adobe.com/devnet/flash/articles/component_architecture.html

Actionscript 2.0 Primer

http://www.person13.com/articles/index.php

Extending MovieClip/Creating Components - Part 1

http://www.communitymx.com/content/article.cfm?cid=4030D

Next Page »