Blog

"tutorial"

Items tagged with tutorial:

Use Javascript to interact with Flash

JUN
17
2010
Posted in category Tutorials | 2491 views
Tags: flash  actionscript  interaction  javascript  web  site  tutorial 
Click me!I've now redesigned my portfolio page, and as a result there's no space for this little feature, so I'm going to write about it instead and give the example.

It's a handy way of having extra interaction on the web page, by allowing a nice little animation every time a link is clicked. I was using a jQuery plugin to load content dynamically, and it gave me the idea that because the rest of the page outside of the target div is static, it would be good to have a small animation. So each time the page swapped from one section to another, this little guy pressed the button.

The Javascript used is pretty much the same as that found at Permadi. Just copy that code and stick it in some 'script' tags:


function getFlashMovieObject(movieName)
{
if (window.document[movieName])
{
return window.document[movieName];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[movieName])
return document.embeds[movieName];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(movieName);
}


This allows the browser to communicate with Flash. Next, it needs to be told what to tell Flash once the command is given. In my case, my Flash file was looping between frames 60 and 111, once the initial part of the animation (lasting 60 frames) had finished, so I wanted a 'gotoAndPlay(112) command:


function PlayFlashMovie()
{
var flashMovie=getFlashMovieObject("robot");
flashMovie.GotoFrame(112);
flashMovie.Play();
}


Note that I have called the Flash file 'robot', and this needs to be defined above. To display the


AC_FL_RunContent( "codebase","http://download.macromedia.com /pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0","width","312","height","250","src","flash/robot","wmode","opaque", "allowfullscreen","true", "quality","high", "pluginspage","http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash","movie","flash/robot", "swliveconnect","true", "name","robot" );


This method of displaying Flash is probably quite out of date, but it works and doesn't produce errors as far as I know.

Finally, add a button, just a standard 'a' link and include the onClick action:

onclick="playFlashMovie();"


And that's it! Your Flash movie should now gotoAndPlay frame 112. You just have to be careful to design your animation so that if someone goes crazy and keeps clicking, it still looks OK. And if it's in a loop as mine is, that it doesn't matter from which frame of the animation it jumps from. You should add in an extra bit to the Flash telling it to trigger a certain animation once it reaches the happy frame though. Now if only Flash worked on Apple devices...

Credit for the code goes to Permadi.com.

Click me!

How to Build a Car Rig in 3ds Max

FEB
06
2010
Posted in category Featured work | 7589 views
Tags: car  rig  vehicle  animation  f1  project  ford  scripting  tutorial 
 
You need to download the latest version of Flash to play and/or enable JavaScript.

Car Rig Tutorial - 3ds Max and Reactor

APR
13
2009
Posted in category Tutorials | 6102 views
Tags: tutorial  car  rig  reactor  3ds 
 
You need to download the latest version of Flash to play and/or enable JavaScript.
This tutorial is to create the simple car rig you see in the video above using 3dsmax and Reactor physics simulation. I'll assume you don't know much about 3dsmax or Reactor, so should be able to follow it and get similar results to me. I'm going to provide all the values that I used so you can repeat exactly what I have, but feel free to experiment.

First, create a cylinder with radius 10 and height 1. Increase number of sides to 36 to make the motion a little...

Creating Dynamic RSS Feeds in PHP

APR
12
2009
Posted in category Tutorials | 4514 views
Tags: tutorial  web  rss  xml  php 
RSS_icon.pngWell, here it is. My first tutorial. I've decided to write this tutorial on creating a basic RSS/XML feed in PHP because it's something I couldn't really find a good tutorial on to suit my needs, so hopefully this will help somebody out. The same technique can also be applied to create XML feeds for sitemaps, which is always good for search engines.

I'll assume you have content being fed from an...
Sign in | Register
Mobile theme on