Flash
PapervisionShowcase.com Officially Official
by Scott King on Aug.06, 2009, under Flash, Papervision
It’s officially official, PaperivisonShowcase.com has undergone it’s final redesign and it has been launched on the Papervision Blogs. It’s a great honor to be joining the official Papervision team and I hope to find other interesting ways to help support the PV3D community.
I’ve also got some ideas for a few enhancements to the site and I’m adding Papervision projects daily so check it out, the best Papervision web sites at PapervisionShowcase.com
Site Preview: Crust Pizza
by Scott King on Aug.04, 2009, under ActionScript, CSS, Design, Flash
A preview of the new Crust site featuring quite a cool Carousel I created from pre-rendered FLV video. I did a version of this Carousel in Papervision 3D but decided to run with a 3D pre-rendered version as the level of interactivity didnt require a full PV3D application.
The Carousel uses 2 small FLVs, one for the scrolling and one for the box opening. I simply loop part of the scrolling video to allow the boxes to slide multiple times and reverse the videos for animating the slide in the opposite direction or to close the box lids. I then load the Pizza PNG itself under a dynamic mask on top of the FLV along with the Pizza information from an XML web service. Video rendering by Jonathan Miranda.
ActionScript 3, Tweenlite, Bulkloader.
Cool effect. Check it out at:
http://www.scottking.com.au/portfolio/crust/
Site Launch – Olympus PEN ver 2
by Scott King on Aug.04, 2009, under ActionScript, CSS, Flash
Last week I launched version 2 of our Olympus PEN promotional site. This site has a range of Flash including a Flickr based Papervision 3D Gallery and competition, 360 Product spinners, YouTube videos and informational panels.
Design: Jonathan Miranda, Glen McPherson, Aliza Nordin
Disable the yellow Flash form tab highlights
by Scott King on Jun.25, 2009, under ActionScript, Flash
Flash has built-in functionality to allow a user to tab around the page elements using their Tab key on their keyboard, just as you would with a normal HTML site.
Flash highlights the focused Flash element with a 2px yellow border around the element.
Often designers will want to disable this highlighting effect so as to not disrupt their design. This can be achieved witha few simple lines of ActionScript:
Be mindful of your implementation as this script uses a _root reference.
Button.prototype.tabEnabled=false;
for(var obj in _root){
_root[obj].tabEnabled = false;
_root[obj]._focusrect=false;
}
More Mini Banner games for GlaxoSmithKline
by Scott King on Jun.18, 2009, under ActionScript, Flash
Two more banner games I created for Glaxo Smith Klines range of anti-smoking products, Nicabate.
This time I took on Pac Man and Space Invaders, Nicabate style.
- ActionScript2 (Flash Player 7)
- TweenLite
- AutoPlay timeout features
- Build time: 2 days per banner
Pac Man
Space Invaders
Site launch: Olympus new PEN Camera
by Scott King on Jun.18, 2009, under ActionScript, CSS, Flash
Olympus have released a revolutionary new camera and required a new mini-site to be built to conincide with the launch of the new camera named the PEN. Unforntaly, we were only given 2 days to build the mini-site which included a online competition for photographers to upload pictures int a competition. A good job on a very tight deadline.
View the site at:
Part 5: Adding Google Analytics tracking to the SWFAddress include
by Scott King on May.31, 2009, under ActionScript, Flash, SEO
Dynamic SEO tags for your Flash site using PHP
To include Google Analytics tracking into your deeplinked flash site configure your SWF address like this:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXX-1");
</script>
<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script type="text/javascript" src="swfaddress/swfaddress.js"></script>
Substitute UA-XXXXX-1 with your actual UA number (available in your Google Analytics control panel), make sure you’ve got the var pagTracker set before including the swfobject.js & swfaddress.js files.
Remove any original Google Analytics code you have in the page and you should be set.
In your Google Analytics control panel you will now see your deeplinks being tracked such as /#/page.
Site Launch: Ocean Sound Studios
by Scott King on May.28, 2009, under ActionScript, Flash
I created this site for Ocean Sound Studio company who wanted something with advanced animations that they could update themselves, on a relatively small budget and restricted timeline (build time was around 4 days). I created this full Flash site for them with a custom CMS, featuring the ability to add new Sounds and Audio Tracks, Images and to update all of the content.
http://www.oceansoundstudios.com/
Design by the talented Aliza Nordin.
A new banner game for GlaxoSmithKline
by Scott King on May.27, 2009, under ActionScript, Flash
This a new banner I created for Glaxo Smith Klines range of anti-smoking products, Nicabate. It is another Flash banner game, this time the classic arcade shooter “Helicopter”.
- ActionScript2
- TweenLite
- ~30kb
Part 2. Enabling back, forward and history buttons for your Flash site
by Scott King on May.22, 2009, under ActionScript, Flash, SEO
Dynamic SEO tags for your Flash site using PHP
Step 1, lets get those back buttons, forward buttons and history working in our browsers navigational bars.
This functionality relies heavily on utilizing the excellent swfaddress script which you need to download from here (http://www.asual.com/download/?swfaddress).
1. Extract the swfaddress script to the same directory that your Flash .FLA’s live in, then setup your Flash file to use swfaddress. I’ll provide a quick guide here. if you require more information no the setup of swfaddress you can view the documentation online here: http://www.asual.com/swfaddress/docs/.
2. We need to include the swfaddress javascirpt support files into our HTML, so add the following two lines:
<script type="text/javascript" src="swfobject/swfobject.js"></script> <script type="text/javascript" src="swfaddress/swfaddress.js"></script>
So your HTML looks like:
<?php
function getDeepLink(){
$requestedDeepLink=curPageURL();
$requestedDeepLink = substr($requestedDeepLink,strrpos($requestedDeepLink,":80")+3);
if(strrpos($requestedDeepLink,"/")==strlen($requestedDeepLink)-1){
$requestedDeepLink = substr($requestedDeepLink,0,strlen($requestedDeepLink)-1);
}
$requestedDeepLink = substr($requestedDeepLink,strrpos($requestedDeepLink,"/"));
$exclusions = array(".html", "/","index.php"); // URL extension exclusion list
$requestedDeepLink = str_replace($exclusions, "", $requestedDeepLink); // remove extensions eg: "about.html" becomes "about"
}
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$requestedDeepLink=getDeepLink();
$title="Home";
$description="Meta Tag Description for Home";
$keywords="Meta Tag Keywords for Home";
$inPageContent="Some altenate content for non-flash users on Home";
$noscript="Some altenate content for non-javscript users on Home";
if($requestedDeepLink=="about"){
// SEO Tags for About Me
$title="About Me";
$description="Meta Tag Description for About";
$keywords="Meta Tag Keywords for About";
$inPageContent="Some altenate content for non-flash users on About";
$noscript="Some altenate content for non-javscript users on About";
$inContent=true;
}
if($requestedDeepLink=="contact"){
// SEO Tags for Contact Us
$title="Contact Us";
$description="Meta Tag Description for Contact ";
$keywords="Meta Tag Keywords for Contact ";
$inPageContent="Some altenate content for non-flash users on Contact ";
$noscript="Some altenate content for non-javscript users on Contact ";
$inContent=true;
}
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=$preTitle." ".$title?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="Description" content="<?=$description?>">
<meta name="Keywords" content="<?=$keywords?>">
<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script type="text/javascript" src="swfaddress/swfaddress.js"></script>
</head>
<body>
<div id="flashcontent">
<?=$inPageContent?>
<a href="http://www.adobe.com/go/getflashplayer">Click here</a> to download the latest flash player to view this site.
</div>
<script type="text/javascript">
// <![CDATA[
//INSERT YOUR SWF OBJECT EMBED CODE HERE
// ]]>
</script>
<noscript>
<?=$noscript?>
</noscript>
</body>
</html>
3. Now we need to move on to setting up the actual Flash .FLA. We will need to import the swfaddress class, this is done by simply adding this ActionScript line to the first frame of your Flash .FLA's:
import com.asual.swfaddress.*; // SWFAddress code
4a. And we need to tell swfaddress when a user clicks on a navigational item in your Flash file. We do this by adding the following code to your Flash Navigational Buttons/MovieClips:
this.onRelease = function() { SWFAddress.setValue('DEEPLINK_URL'); //Here you can add the rest of your navigational logic, eg if you need to load a new SWF called example.swf into a MovieClip called "loaderClip", you might add the following line: // loaderClip.loadMovie("example.swf"); }
4b. Substitute your required deeplink URL into the "DEEPLINK_URL" section. For example if this code was going on the button for your "About Me" section of your Flash site, the code would look something like:
this.onRelease = function() { SWFAddress.setValue('/about-me/'); //Here you can add the rest of your navigational logic, eg if you need to load a new SWF called example.swf into a MovieClip called "loaderClip", you might add the following line: // loaderClip.loadMovie("example.swf"); }
4c. You can then add your ActionScript that you would call normally to load the About Me section of your Flash movie, this might look eg if you need to load a new SWF called example.swf into a MovieClip called "loaderClip", you might add the following line:
loaderClip.loadMovie("about-me.swf");
So the code for your About Me button now looks like this:
this.onRelease = function() { SWFAddress.setValue('/about-me/'); loaderClip.loadMovie("about-me.swf"); }
Repeat steps 4a to 4c for each of your navigational buttons. eg, your "Portfolio" section might look like this:
this.onRelease = function() { SWFAddress.setValue('/my-work/portfolio/'); _root.gotoAndPlay("portfolio"); _root.breadCrumbs.text="My Work > Portfolio"; }
So now every time a user clicks on a navigational button in your Flash .SWF, the SWFAddress.setValue(); function will be called and swfaddress will create an entry in your browsers History and add the previous content section to the browsers Back button.
You can now test your Flash movie by previewing it in your browser. Now when you click on a button to load a new section of your Flash file you'll notice the browser's URL has the DEEPLINK_URL appended to the URL.
eg: from the example above, clicking the "Portfolio" section will change the URL from:
http://www.example.com
to:
http://www.example.com/#/my-work/portfolio/
or clicking our "About Me" section will produce:
http://www.example.com/#/about-me/
If you open up your browsers History bar, you may also notice some new entries going in each time you hit a your nav buttons. You may also notice that your browsers Back and Forward buttons become active but clicking on them doesnt load the previous section - but don't worry we're just about to address that.
Summary
Now we have our Flash file telling the browser each time a user clicks on a section in your Flash file. Next we need to a way for the browser to tell the Flash file that the user has clicked the Back or Forward button in the browser window.
5. Making your Back and Forward buttons work.
Tell the Flash file that the user has clicked the Back or Forward button in the browser window. We do this by adding an SWFAddress.onChange listener to our ActionScript, so copy and paste the following below the import statement we added in step 2:
import com.asual.swfaddress.*; // SWFAddress code
SWFAddress.onChange = function() {
var sectionToLoad = SWFAddress.getValue();
}
Now, everytime a user click the Back or Forward button in the browser, this function will be called inside your Flash .SWF and the variable sectionToLoad will contain the section that the browser expects to load. For example if the user was on the "About Me" section, then clicked the Flash navigation button to load the "Portfolio" section and then hit the Browsers Back button, the sectionToLoad variable would contain the "about-me" as this is the section the Browser is trying to load.






















