View Full Version : Transition class
punstc
10-22-2007, 03:18 AM
i'm trying to use the transition class to create a fade out and fade in for loading in external movies. I found a tutorial on it searching through the forums on the topic. I'm having a troubles though when i click on my buttons nothing occurs. I've checked my script with the source script and its identical as far as i can see except for the slight changes i made since my buttons are inside of another movie clip and perform actions inside. Can anyone have a look and see if i have any errors or just going about all wrong.
import mx.transitions.Tween;
import mx.transitions.easing.*;
//Transitions & Navigation
var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mcl.addListener(mclL);
mcl.loadClip("news.swf",holder_mc);
mclL.onLoadStart = function(){
preloader_mc.progress_mc._width = 0;
preloader_mc._visible = true;
theText._visible = true;
}
mclL.onLoadProgress = function(target,loaded,total){
theText.text = "Loading" +Math.round((loaded/total)*100) + "%";
preloader_mc.progress_mc._width = preloader_mc.base_mc._width * (loaded/total);
}
mclL.onLoadInit = function(){
preloader_mc._visible = false;
theText._visible = false;
var myTween1:Tween = new Tween(holder_mc, "_alpha",Back.easeOut,0,100,1,true);
initButtons();
}
function initButtons():Void {
nav.b_news.onRelease = function(){
nav.gotoAndStop("Closed");
var myTween2:Tween = new Tween(holder_mc, "_alpha",Back.easeOut,100,0,1,true);
myTween2.onMotionFinished = function(){
mcl.unloadClip(holder_mc);
mcl.loadClip("news.swf",holder_mc);
}
}
nav.b_web.onRelease = function(){
nav.gotoAndStop("Closed");
var myTween2:Tween = new Tween(holder_mc, "_alpha",Back.easeOut,100,0,1,true);
myTween2.onMotionFinished = function(){
mcl.unloadClip(holder_mc);
mcl.loadClip("web.swf",holder_mc);
}
}
}
stop();
thanks in advance
BLiZZaRD
10-22-2007, 07:58 AM
At first glance the code looks fine. If you can zip up your fla I can take a look at that and make sure the inner AS is making the correct calls.
It always helps to have a visual of the problem :D
punstc
10-22-2007, 02:50 PM
hey thanks a lot heres a zip of it.
BLiZZaRD
10-22-2007, 03:06 PM
Will have a look as soon as I can. Will get back to you here when I have something. :D
punstc
10-22-2007, 03:19 PM
Thanks, I appreciate it a lot, i know there are better ways of doing my navigation movie clip as well, instead of timeline animation. Maybe that could be one reason for it not working.
anyway thanks a lot again
BLiZZaRD
10-22-2007, 05:52 PM
Maybe I won't. Your using the Flash for Mac huh?
Can you publish the swf and upload it to a server and I can look at it live? Also, double check that when everything is uploaded it is uploaded to the same directory. In your AS make sure your getURLs or LoadMovie()s are using complete URLs not just the file names.
If all else fails post all related AS here and I will comb over it :D
punstc
10-22-2007, 07:04 PM
Yeah sorry i'm a mac user here's a link to what i have the only buttons that have links set to them for the transition and load movie is the web and news buttons
i have it set so news is loaded in right away also.
http://www.manifolddesigns.com/Site/main.html
thanks again
i really appreciate this
Jake
BLiZZaRD
10-22-2007, 08:11 PM
Here is a silly thought.. you gave your buttons instance names right?
The code tells button with instance name nav.b_web to do something blah blah...
Make sure nav.b_web is the instance name for that button (or nav is parent button and b_web is child button)
Also in the library find your buttons and right click, choose linkage and check "export for action script"
Let me know how that works.
punstc
10-22-2007, 08:23 PM
i've checked them hundreds of times and they are all correct (thats the first thing i check now because i always tend to make a dumb mistake with those but they are correct this time) they are movie clip buttons if that makes a difference, i'm not sure. its actually just duplicates of the same movie clip and i define what the button says in the navigation movie clip. but yes the instance names are correct. "nav" is the instance name of my navigation movie clip where the buttons lie within.
Sorry for slow response after this, i have to go to class.
I'm a digital art and design major, can't wait for my action script class.!
just pondering i have an intel mac running flash cs3 shouldnt a pc be able to open the document.
BLiZZaRD
10-23-2007, 02:16 PM
Should but that CS3 part is why... I am still running versions 5, 7, and 8 :)
patmanbofh
10-23-2007, 03:19 PM
Inadvertantly picked this thread up in GTAL. Might save you some effort Blizzard in knowing that the export frame for classes is set up for frame 3 for this project and all the AS code is initiated in frame one. All the tween statements will fail as a result. you can test this punstc by changing your publish setting for Flash/Action Script Version/Settings/Export frame for classes from 3 to 1. your code will now work (Obviously this knocks out your loader functionality, but this can be easily fixed - In this instance cut all your AS code from frame 1 to frame 2 and change Export Frame from 3 to 2
BLiZZaRD
10-23-2007, 03:34 PM
Well, telling the Flash what to do and then skipping the instructions will definitely make it not work. :D
Glad you can see it. I should get CS3, but I just haven't found a real use for it yet.
punstc
10-23-2007, 09:13 PM
ok i saved it as 8 if you don't mind taking a look at it still.
BLiZZaRD
10-24-2007, 02:34 AM
Okay I got that file - kind of -
All I can see is some weird ass linkage names that you never use anywhere else... Your button linkage names should match the instance names, it makes everything easier.
Other than that your code looks fine from what I can make of it. If it still fails I would suggest getting rid of the functions and putting the codes directly on the buttons themselves.
Think simple :D
punstc
10-24-2007, 02:50 AM
hmm.. i didnt put linkage names on them since they are all from 1 movieclip i'll look into it and play a little more. and see what i can come up with.
thank you
punstc
10-24-2007, 04:35 AM
I've messed around with it a little more with still no success, i'm not sure where you saw weird linkage name's because i didnt have any set i had it turned off for actions script. If you have the time do you think you could make a real small maybe one button working example of something simular so i can compare and maybe try to figure out where mine is messing up.
BLiZZaRD
10-24-2007, 07:09 PM
Yeah I can do that. Might be tomorrow late or even Saturday though, I have football the rest of this week and I will be out all day and home late.
I will see what I can do though.
punstc
10-24-2007, 08:54 PM
Sounds good take all the time you want. i'm in no rush to get this done. Learning experience.
Thanks again I really appreciate it.
BLiZZaRD
10-27-2007, 05:30 PM
Okay, got an example done for you with working animations and loadMovie().
I tried to use the same buttons and movies as you did, but I may have a few variances.
What I did was made the nav_menu, with 3 sets of animations, located by labels. (first, second, third), this is all one movie clip and all your actionscript is inside there. There is a lot of code but it is all really easy, I just hand coded it as Flash works better that way,
I have the animations run on mouse click on certain buttons, and all other buttons return the nav menu to it's default state.
on the web and news buttons I tell it to load the movie (web.swf and news.swf) as well as return the nav menu to default state.
I will leave a live example on my site for a few days, you can view it HERE (http://cleverwasteoftime.com/blizzcorner/nav_menu.html)
I have also attached the zip file (done in Flash 8) with all the files I made including the swfs and the html for you to break apart and look at.
If you have any questions, feel free.
on an aside: I would stay away from preformed scripts until you know how to make your own. They may save a bit of time, but if you forget one little thing they are a huge nightmare to try to deal with. :)
punstc
10-27-2007, 05:43 PM
Thanks a lot i'm gonna take a look at it. I really appreciate your help.
Jake
BLiZZaRD
10-27-2007, 05:45 PM
No problems :)
punstc
10-30-2007, 02:18 AM
hey finally got a chance to sit down and look at what you did for me. and thank you i completely understand. What would you suggest for me to look into for the fade transition. I'de like to really look into it so i can learn how to write the script myself.
BLiZZaRD
10-30-2007, 02:21 PM
The fade transition that I placed on the buttons?
All I did was make the MCs on their own time line and used alpha with a tween.
1) Create the object you want to fade.
2) Place on stage on it's own layer (layers with multiple MCs will not tween)
3) Click ONCE on the MC and from the properties box select "color" >> "alpha"
4) Slide the scroll to 1 (don't use 0)
5) Place a new keyframe (not a blank one) at the point of the timeline you want the MC to be visible.
6) Repeat steps 3 and 4 on this keyframe, except scroll to 100.
7) Right click anywhere between the two keyframes and select "create tween"
That's all there is to it. You can also Fade with AS, but there really is no point, unless you want multiple MCs on one layer, but then, there is no real advantage to that either.
punstc
10-30-2007, 02:33 PM
No, sorry for not specifying i ment the holder_mc i want it to fade out and fade back in when loaded.
BLiZZaRD
10-30-2007, 02:46 PM
Check out the coders in this thread (http://friendsofed.infopop.net/2/OpenTopic?a=tpc&s=989094322&f=3183053165&m=1591070431)
Good explanation and shows the different ways of handling it. :D
punstc
10-30-2007, 02:47 PM
alright thank you
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.