Click Here for the first part of this tutorial.
Well. It is a large movie clip that gets moved to specific coordinates every time a navigation bar button is pressed. Watch the tutorial and you will see!
CLICK HERE FOR A COMPLETE ACTIONSCRIPT 3.0 CARTOON SMART TUTORIAL
DOWNLOAD THE SOURCE FILE
DynamicMapNavigationFinal
HERE IS THE SOURCE CODE!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
//The ActionScript 3.0 Flash Mini Site
// Avraham Saltoun
// solutions at say-web dot com
// FREE to USE, COPY and DISTRIBUTE
// Let's import the libraries we plan to use
import fl.transitions.Tween;
import fl.transitions.easing.*;
// the star states we will import
// all eases
// Now we will create a batch of variables
// that will store the coordinates for each
// area of our large movie clip
// each pair represents a "page"
var homeX:Number= 103; // We will check on stage
// the coordinate for x and y when button home is clicked
var homeY:Number= 47;
// Now the same for prices
var pricesX:Number= 694;
var pricesY:Number=-365;
// Now the same for Contact
var contactX:Number= -489;
var contactY:Number=-379;
//These variables will hold the Tween
// to be executed
var xTween:Tween; // holds the horizontal tween
var yTween:Tween; // holds the vertical tween
xTween = new Tween (main_mc,"x",Strong.easeInOut,main_mc.x,homeX,2,true);
yTween = new Tween (main_mc,"y",Strong.easeInOut,main_mc.y,homeY,2,true);
// Event Listeners
home_btn.addEventListener(MouseEvent.CLICK, navigate);
prices_btn.addEventListener(MouseEvent.CLICK, navigate);
contact_btn.addEventListener(MouseEvent.CLICK, navigate);
//Note that all buttons will lead to the same function
//The only difference is the values they will pass
//Functions
function navigate (event:MouseEvent):void {
if (event.target == home_btn)
{
setTween (homeX, homeY);
}
else
if (event.target == prices_btn)
{
setTween (pricesX, pricesY);
}
else
if (event.target == contact_btn)
{
setTween (contactX, contactY);
}
}
function setTween ( tweenX:Number, tweenY:Number) :void
{
//This retrieves the location of our large movie clip
//To be used as starting point of our desired tween
xTween.begin = main_mc.x;
yTween.begin = main_mc.y;
//This assigns the values passed from
// the navigate function as the end location
// of the tween
xTween.finish = tweenX;
yTween.finish = tweenY;
//After assigning values, this fires the tween
xTween.start();
yTween.start();
}
xTween.stop();
yTween.stop();
// Subscribe from the website! </div> |






2 Responses to “Create a Flash Mini Site Part II”
Trackbacks/Pingbacks
Your Story…
I Love it so much that im bookmarking it!…
great info…
learn more info…