Grupos » Flash Maniacs » Temas » [T] Current Page Variable

Listado 1-15 de 15    1   de  1
Autor Tema exclusivo Mensaje
Flash Mod

M/22
,
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder a esta publicación Publicado:  mar 7, 2007 6:31 p.m.
coming...right now!
Flash Mod


M/22
,
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: mar 7, 2007 6:37 p.m.
Advantage:
This will remove the need to have a movieClipLoader component and have to load a seperate swf for each section of your profile. Allows for smooth transitions between pages(fade in/out, bounce, etc.)

Disadvantage:
Usually causes a larger total file size.

1. To start, first set up a menu with as many different buttons as your like.

Ex:
Free Image Hosting at www.ImageShack.us
Here we have an About, Music, and Friends page

2. Make each button a separate movie clip and give each one an instance name.
for this example the instance names are.

aboutBtn_mc
musicBtn_mc
friendsBtn_mc

3. Now to create the content that will go in each section.

For this example I am just going to have the title of the section be the content also but you can add whatever images, text, etc that you want to.

Ex:
Free Image Hosting at www.ImageShack.us

Make the content for the about section into a movie clip and give it an instance name of about_mc

now double click on this movie clip to go into it.

4. You must create three layers in this movie clip.
make them Actions, Labels, and Content.

Lock the actions and labels layer. We will only be working in the content layer.

5. In your first frame of the about_mc movie clip make a label and title it "on"
and place a stop action on the first frame of the actions layer

in the content layer, create whatever type of effect you want the content to appear with. In this example, we create a simple motion tween for the text to move in from off of stage left and stop in the middle of the page.

Ex:
Free Image Hosting at www.ImageShack.us

and be sure to place a stop action at the end of the animation.

6. Now skip a few frames just for neatness and place a new label on the labels layer.
title it "off"

in the same frame on the content layer, insert a new keyframe.

7. Now create the exiting effect that you want your content to have. In this example I just made the content move from center stage to off of stage right.

it is not necessary to place a stop action at the end of this animation, because it will stop in the first frame as soon as it loops.

here is what your time line for your about_mc movie clip should look like now.

Ex:
Free Image Hosting at www.ImageShack.us

8. Now repeat steps 3 - 7 for each of your content pages. Making sure that you give each content movie clip an "on" and "off" label.
Place each page of content and the menu on seperate layers.

Now we are done with the animation portion of the tutorial. All that is left now is the action script.

9. Go to your root (Scene 1) timeline and create an actions layer and lock it. Then click on the first frame of the actions layer and press F9 to go to the actions panel.

Actions:

var currentPage = "about_mc";
_root.onLoad = function() {
animateOn("about_mc");
};

function animateOn(page:String) {
eval(page).gotoAndPlay("on");
}

function animateOff(page:String) {
eval(page).gotoAndPlay("off");
}

aboutBtn_mc.onRelease = function() {
if (currentPage != "about_mc") {
animateOff(currentPage);
animateOn("about_mc");
currentPage = "about_mc";
}
};

musicBtn_mc.onRelease = function() {
if (currentPage != "music_mc") {
animateOff(currentPage);
animateOn("music_mc");
currentPage = "music_mc";
}
};

friendsBtn_mc.onRelease = function() {
if (currentPage != "friends_mc") {
animateOff(currentPage);
animateOn("friends_mc");
currentPage = "friends_mc";
}
};

Explanation of AS:
It is highly recommended that you read this so that you actually know what is going on in the action script and to help you with future tutorials and pages of your own


function animateOn(page:String) {
eval(page).gotoAndPlay("on");
}

function animateOff(page:String) {
eval(page).gotoAndPlay("off");
}


this is declaring the functions that will call the page and cause the action decalred to happen.
We make put this in a function because it will be applied to numerous different movie clips.


aboutBtn_mc.onRelease = function() {
if (currentPage != "about_mc") {
animateOff(currentPage);
animateOn("about_mc");
currentPage = "about_mc";
}
};

musicBtn_mc.onRelease = function() {
if (currentPage != "music_mc") {
animateOff(currentPage);
animateOn("music_mc");
currentPage = "music_mc";
}
};

friendsBtn_mc.onRelease = function() {
if (currentPage != "friends_mc") {
animateOff(currentPage);
animateOn("friends_mc");
currentPage = "friends_mc";
}
};

these are the button actions that call the function we made and sets the current page. The if() statement says that if the current page is the one that is not the page on
the screen, then the actions of animating off the current page and animating on the seleted page will happen. Else, nothing will happen.

currentPage = "XXXX_mc" sets the current page to the page that was just animated on.


var currentPage = "about_mc";
_root.onLoad = function() {
animateOn("about_mc");
};


This last piece of AS simply sets up the page.
var currentPage = "about_mc" sets the initial currentPage value for the about page so that you cannot click on the about button to start because it will already be displayed.
The onLoad function says that as soon as the file loads, the "about_mc" movie clip will be the first to call the animateOn function.

currentPageVar.fla

Thank you for reading this tutorial. I hope you find it very helpful with your flash animations. For any help with this tutorial or questions, please post only in this forum thread.

~Flash Mods
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: abr 23, 2007 3:44 p.m.
**This tutorial only works in Action Script 2.0**
i dont use this account anymore


M/19
Tucson,
Arizona
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: jun 8, 2007 7:49 p.m.
once they click the about me button. hpw could i get my text to apppear when they clikc ech button
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: jun 9, 2007 4:29 a.m.
what?
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: jun 11, 2007 10:52 p.m.
No. I just bought some video tutorials that explained everything very very well. Its easy once you get the hang of it.
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: jun 11, 2007 11:08 p.m.
from learnflash.com

I got the Building A Website in Flash 8, Intros and Animations, and Tips and tricks Vol 1, 2, 3
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: feb 15, 2008 1:53 a.m.
you can use flash cs3 just fine. But make sure it is set to ActionScript 2.0 and not 3.0
Ryan


M/22
Denver,
Colorado
Mensaje instantáneo
Enviar mensaje
Responde con esta cita Responder Publicado: feb 15, 2008 4:23 a.m.
Publish Settings

then on the Flash tab, ActionScript version: AS 2.0
Listado 1-15 de 15    1   de  1

dspPostReplies v29