Jaslabs: High performance Software

High Performance Software

Archive for the 'flash' Category

Embedding flash movies made easy

By Justin Silverton

There are a few way to embed a flash object or movie in a webpage:

1) Default code from adobe

It consists of an Object tag with an Embed tag placed inside it. This is the most popular Flash embed method and is the default choice when publishing your Flash movie from the Adobe Flash IDE. This is the most compatible way to embed a Flash movie, and will work in the widest range of browsers.

2) A separate flash movie

This method involves placing a Flash movie on the index page of your website, and this Flash movie then checks the versopm variable in the Flash player and redirects the user either to the Flash content inside the site, or an upgrade page.

Issues to consider with this method

  • It will damage your search engine positioning - Since you are now using your index page as an empty Flash detection page, when people search for you in Google or other search engines, many times, the description text ends up showing up as “Detecting Flash Player” or even no description at all.
  • It is not valid HTML or XHTML

3) The Adobe Flash Player Detection Kit

Adobe has a flash detection kit that comes with Flash versions 8 and higher.

Issues to consider with this method

  • Not very user friendly
  • has the same issues as #2

A better solution is to use SWFObject, a Javascript Flash Player detection and embedding script.

The script can detect the Flash plug-in in all major web browsers (on Mac and PC) and is designed to make embedding Flash movies as easy as possible. It is also search engine friendly, degrades gracefully, can be used in valid HTML and XHTML 1.0 documents.

SWFObject works in all the current web browsers, including, on PC: IE5/5.5/6, Netscape 7/8, Firefox, Mozilla, and Opera. On Mac: IE5.2, Safari, Firefox, Netscape 6/7, Mozilla, and Opera 7.5+.

How to use it

Usage is straight-forward and simple. Include the swfobject.js Javascript file, then use a small amount of Javascript on your page to embed your Flash movie. Here is some example code:

<script type="text/javascript" src="swfobject.js"></script>

<div id="yourcontent">
This text is replaced by the flash object
</div>

<script type="text/javascript">
var so = new SWFObject("test.swf", "mymovie", "400", "200", "8", "#FFFFFF");
so.write("yourcontent");
</script>

Here is a description of its parameters:

var so = new SWFObject(swf, id, width, height, version, background-color [, quality, xiRedirectUrl, redirectUrl, detectKey]);

Create a new SWFObject and pass in the required arguments:

  • swf - The file path and name to your swf file.
  • id - The ID of your object or embed tag. The embed tag will also have this value set as it’s name attribute for files that take advantage of swliveconnect.
  • width - The width of your Flash movie.
  • height - The height of your Flash movie.
  • version - The required player version for your Flash content. This can be a string in the format of ‘majorVersion.minorVersion.revision’. An example would be: “6.0.65″. Or you can just require the major version, such as “6″.
  • background-color - This is the hex value of the background color of your Flash movie.

Optional arguments are:

  • quality - The quality you wish your Flash movie to play at. If no quality is specified, the default is “high”.
  • xiRedirectUrl - If you would like to redirect users who complete the ExpressInstall upgrade, you can specify an alternate URL here.
  • redirectUrl - If you wish to redirect users who don’t have the correct plug-in version, use this parameter and they will be redirected.
  • detectKey - This is the url variable name the SWFObject script will look for when bypassing the detection. Default is ‘detectflash’. Example: To bypass the Flash detection and simply write the Flash movie to the page, you could add ?detectflash=false to the url of the document containing the Flash movie.

The latest version can be downloaded here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
7 comments

VNC client in flash

By Justin Silverton

FVNC is an open source VNC client for flash.

From the author:

“I’ve updated the code to compile with the release version of Flex 2. Previously, the application was only functional in beta versions and stopped working when Flash Player 9 was officially released. I’ve also started to do some refactoring, but decided it was better to get the code out there as-is than keep it locked up while I tweak it. I’ve been beyond busy lately, and I don’t see myself finishing this round of refactoring any time soon, so better to release now than wait a few weeks…”

Screenshots

Login Screen

Actual screenshot

How to use/install

Download and run from your browswer.

Important notes:

Because of Flash Player security restrictions in connecting to remote addresses, you have to run the .swf file from your local file system. This means either launching it with the standalone Flash Player, or dropping the .swf file inside IE or FireFox.

More about the client:

The following encodings are implemented: CopyRect and HexTile. The Flash Player itself is fully capable of rendering the screen without slowdown.. any choppiness seems to be due to the amount of data coming over the wire, so switching to a compressed encoding format should improve speed.

This has only been tested using TightVNC server

Download

The VNC flash client can be download here

Link to project: Here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
6 comments

Flash 8 security hacks

By Justin Silverton

Digg This StoryI recently came across the following message when I tried to run a flash program on a client’s machine:I recently came across the following message when I tried to run a flash program on a client’s machine:flash 8 security error

I recently came across the following message when I tried to run a flash program on a client’s machine:The security dialog comes up because when you fire getURL() with Local Playback Security set to
“Access Local Files only” it sees the getURL call as a request for network resource (and pops up the
security dialog).

If you then set Local Playback Security set to “Access Network”…. Normally that would allow the
call access to the network. But the requested communication is actually between a local SWF and a
local HTML file, so it sees that as a local file accessing a local file, which is outside of what’s
allowed when LPS is set to “Access Network”. Which results in a Flash Player 8 Security Sandbox dialog .

For Developers, there are three ways to solve the above issue:

1. The end user has to use the Settings Manager to set local file security to “Always Allow” AND
they have to add the path to the file as a trusted path.
The direct path to this section of the online Settings Manager is
(http://www.macromedia.com/support/documentation/
en/flashplayer/help/s…).
The default is ‘always ask’. Change that to ‘Always Allow’.
Then add the path to your local content to the trusted locations. For example, if your content
is on a CD-ROM then you’d add the path to the CD (for example, “F:/”).

Doing these two things is essentially enabling a local Trust File. Settings manager then
writes the trust file settings for you, to the #SharedObjects (which is obfuscated so nobody can
crack it)
So that’s how you can do it if your users are internet-connected and you feel they’re savvy
enough to handle the steps.

What if your users are not internet connected? In that case you have to manually add the trust file
to one of two locations:

2. You can create a trust file in C:\Documents and Settings\\Application
Data\Macromedia\Flash Player\#Security\FlashPlayerTrust.
The name of the file can be whatever you want.
The only minimum thing in the file is one line of text that’s the path you want to trust.
Additional paths can be one per line.
Do this if you just want to set up trust for one unique user account on that machine.

3. You can create a trust file in C:\WINDOWS\system32\Macromed\Flash\FlashPlayerTrust.
This is the same trust file as step #2, but sets it for all the users on this machine.
The catch here is that you have to be an admin on the machine to create this trust file. Options #2 and #3 are obviously also available to end users who do have internet connections but
whom you might not want to direct to the Flash Player Settings Manager. 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
7 comments