Flash’s Obtained a Model New Bag – A Record Aside

As broadband Web connections turn out to be extra ubiquitous, and extra company websites start to include Flash and use it as their major device, there might be extra of a necessity to include e-commerce performance into the Flash-based web sites that you simply design.

Article Continues Beneath

For the second, that is unusual, and I can suggest two the explanation why:

  1. Most e-commerce builders have expertise creating HTML-based websites, and the present crop of improvement instruments (i.e. ASP, PHP, JSP, Chilly Fusion) are particularly designed to spit out HTML pages.
  2. Many individuals nonetheless use dial-up modems. So, to offer straightforward, fast entry to the most important variety of prospects doable, easy HTML websites are virtually all the time the best way to go.

The brand new face of e-commerce#section2

Fortuitously, for designers a minimum of, a number of corporations are keen to push the envelope. Just lately, I received the possibility to develop a Flash-based e-commerce web site. The corporate’s objectives for the challenge have been to provide an e-commerce artwork gallery that offered the customer with an above-average visible expertise, and to “achieve prospects via high quality.” La Palette employed me to develop a database-driven web site with full e-commerce capabilities, and an interface created totally in Flash.

What follows are some classes I realized via this expertise: issues to do, issues to not do, and methods to maintain from beating your head in opposition to the wall. The next article does contain some superior ActionScripting/ASP ideas, so put in your goofy flying goggles and prepare.

The primary painfully irritating hurdle I encountered (oddly lacking from Macromedia’s documentation) was a quirk involving the LoadVariables perform. That is in all probability obvious to anybody who has expertise creating dynamic Flash websites, however for a newbie, it was a significant headache.

LoadVariables takes time. It’s an asynchronous transaction. You can’t name LoadVariables after which start to make use of the variables it hundreds in the identical script! Worst of all, as a result of flaky nature of TCP/IP communication over the Web, you possibly can’t even use it within the subsequent body. Certainly, you possibly can’t even estimate while you assume it’ll be there. Have a pleasant day.

A way mentioned briefly on one web page of the Actionscript Reference Information is invaluable; I used it time and again when constructing La Palette. Right here’s the trick: create an object and make it right into a film clip. Then use LoadVariables to load the variables you need into that film clip. On the film clip that’s receiving the variables it’s essential add the next:

OnClipEvent(information)
{
 ... your code right here…
}

This was the one dependable approach I may get usable variables into the film. Hopefully, this can prevent some frustration. When you perceive this dilemma and the workaround, you possibly can level the LoadVariables perform at no matter form of file you want (in the identical area), be it an ASP file, JSP file and even plain textual content. The one requirement is that the file should be in the identical area because the challenge you’re constructing.

Additionally, make sure you URLEncode any information you’re placing into your variables! In the event you’re spitting out issues like artist names with areas and commas in them, you received’t get very far with out encoding them.

In the event you’ve performed ASP, JSP or different net improvement earlier than, you recognize there are a handful of stuff you do time and again for nearly any web site. One good instance of that is while you get a recordset from a database, and spit out a properly formatted HTML record of things from that recordset. This will get a bit trickier in Flash, however there are two stuff you’ll be utilizing on a regular basis:

  1. LoadVariables
  2. DuplicateMovieClip.

From the Flash film, name LoadVariables and use a film clip as your goal. Be certain that the film clip has code to deal with the info ClipEvent. Do your entire database processing the best way you usually would in ASP/JSP/no matter, and spit out the variables from the ASP/JSP web page within the appropriate format:

result1=foo&result2=bar&resultcount=2

As soon as the OnClipEvent is triggered, you’re able to go to city.

Use the DuplicateMovieClip perform to generate your record. What you need is an inventory of outcomes through which every merchandise within the record might be clicked to get extra element. That is just about all the time the case: consider search outcomes, a show of purchasing cart gadgets, or appointments on a calendar.

So simply make one film clip that has all of the performance you need, after which make a replica of that film for every consequence returned from the LoadVariables name. (This film must include any information you wish to show for every consequence.)

Within the case of La Palette.com, there was an inventory of artist names. I made one film clip with the performance I needed, then used DuplicateMovie to create a replica for every artist’s title. Inside that film clip, there’s a dynamic textual content object that shows the artist’s title. I additionally added code to do hit monitoring within the film, to be able to click on on any of the artists’ names for extra element. This considerably awkward workaround was mandatory as a result of there isn’t a approach to duplicate a button via ActionScript.

You’re not performed but#section7

Another hurdle precipitated lengthy hours of painful head-scratching: find out how to load a picture dynamically in Flash? The unhappy reply I got here up with is which you can’t. The one answer I discovered was to make a Flash film that’s the similar measurement as your essential film for every JPEG or GIF it’s essential load dynamically, after which use LoadMovie to deliver that image in.

This looks as if an enormous omission on Macromedia’s half. When creating net functions, you’re all the time going to wish to dynamically load photos. Ebay has photos for his or her gadgets, Amazon has e-book covers, and even Slashdot has categorical icons!

I believed I’d have the ability to use Generator to do that, however after days and days of analysis, I made a decision to confess defeat and ask my assistant designer to assist me make a really giant variety of easy Flash motion pictures.

This can be a answer in fact, however as Larry Wall, the creator of Perl will let you know, “the three chief virtues of a programmer [are] laziness, impatience and hubris.” So it’s clearly not answer as a result of it includes a variety of grunt work.

I suppose I may’ve used some PHP Kung Fu to get it performed, however I didn’t have the time to mess around with getting PHP put in and operating. Hopefully, Macromedia will provide you with a greater answer for dynamically loading photos in future variations of Flash.

I counsel utilizing a wholly new window, or redirecting to a unique web page with GetURL, while you’re getting into any sections of your web site that should be transmitted with SSL encryption. The thought is to make the excellence between safe transactions and the remainder of the positioning as clear as doable to the person.

In the event you redirect to a brand new web page, they are going to get the annoying “You’re getting into a safe web site!” alert field,  and the lovable little padlock will present up of their browser window. Customers depend on these cues to ensure them that they’re utilizing safe communications. I do know I all the time search for that little lock every time I pull out my bank card and begin typing in these magic 16 numbers.

Some websites use safe communications inside Flash motion pictures and even inside HTML frames that don’t give you all the visible clues. The ensuing websites could look cool, however I think that many guests are cautious about whipping out their plastic with out visible reassurance that they’re purchasing safely.

When you be taught the quirks of integrating Flash and ASP, you’ll discover that it’s much like another kind of net improvement; there are a number of strategies that you simply’ll use time and again as soon as you determine find out how to do them proper.

As we enter the subsequent era of net improvement, we’ll start to see increasingly more e-commerce websites with a Flash interface. I, for one, might be pleased to see better-looking purchasing carts, so I can’t wait!

Leave a Comment