Create a Flash Mini Site Part I

Thu, Nov 19, 2009

ActionScript

Create a Flash Mini Site Part I

This movie requires Flash Player 9



Click here for the second part of this tutorial.


Avraham! What a great effect! How did you do it?

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!


DOWNLOAD THE SOURCE FILE
DynamicMapNavigationFinal

CLICK HERE FOR A COMPLETE ACTIONSCRIPT 3.0 CARTOON SMART TUTORIAL

HERE IS THE SOURCE CODE!

//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!

Related Articles:

, , , , , , , , , , , , , , ,

1,942 Responses to “Create a Flash Mini Site Part I”

  1. a1375543 Says:

    I’ve said that least 1375543 times. SCK was here

  2. urgent care Says:

    That’s a great post!

  3. DariOrbiz Says:

    Wilbobrerox http://www.hogan-scar-pe.com – hogan

  4. DariOrbiz Says:

    Wilbobrerox http://www.hogan-scar-pe.com – scarpe hogan


Trackbacks/Pingbacks

  1. HGH says:

    News info…

    I was reading the news and I saw this really interesting topic…

  2. elektrische zigarette…

    [...]usually posts some pretty exciting stuff like this. If you are new to this site[...]…

  3. weee recycling…

    [...]always a huge fan of linking to bloggers that I enjoy but do not get lots of link enjoy from[...]…

  4. b of a says:

    Superb website…

    [...]always a big fan of linking to bloggers that I love but don’t get a lot of link love from[...]……

  5. Great website…

    [...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]……

  6. Recommeneded websites…

    [...]Here are some of the sites we recommend for our visitors[...]……

  7. Superb website…

    [...]always a big fan of linking to bloggers that I love but don’t get a lot of link love from[...]……

  8. Yahoo results…

    While searching Yahoo I discovered this page in the results and I didn’t think it fit…

  9. Great website…

    [...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]……

Leave a Reply

Security Code:

Free PageRank Checker

$7.49 .Com! Score Savings Cartoon Smart Tutorials

oDesk Certified Action Script Programmer oDesk Certified Adobe Flash CS3 Designer oDesk Certified Adobe Photoshop 6.0 Designer

3,036
Unique Visitors
Previous 30 Days
Powered By Google Analytics