Create a Flash Mini Site Part II

Mon, Nov 23, 2009

ActionScript

Create a Flash Mini Site Part II

This movie requires Flash Player 9



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>

Related Articles:

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

2 Responses to “Create a Flash Mini Site Part II”


Trackbacks/Pingbacks

  1. Your Story…

    I Love it so much that im bookmarking it!…

  2. great info…

    learn more info…

Leave a Reply

You must be logged in to post a comment.

My name is Avraham Saltoun, and I live in Jerusalem, Middle East. I am currently on my mid  40's and I am a computer programming technician. Here you will find over one hundred quality video tutorials on Actionscript, and yes, I give online support for aspiring programmers, and pros as well, sharing screen on skype and delivering source code by email, click the button for live flash actionscript support now!

 
oDesk Certified Action Script Programmer
oDesk Certified Adobe Flash CS3 Designer
oDesk Certified Adobe Photoshop 6.0 Designer
Skype Me™!

$7.49 .Com! Score Savings Cartoon Smart Tutorials


839
Unique Visitors
Previous 30 Days
Powered By Google Analytics