View Full Version : Two movie, actionscript interaction
synista methods
April 15th, 2002, 12:08 PM
I have a 136k flash file (call it PK) that is to act as an intro to a 720k flash site (SK). I would like to have PK play while SK is loading so I put PK on a separate layer on top of SK using Dreamweaver. My question is how to get these seperate movies to:
A: recognize each other
B: have SK remove PK when SK is fully loaded or have PK remove itself
Any advice would be helpful
Synista
RenaissanceGirl
April 16th, 2002, 10:35 AM
Whoa! That is a huge file... anyway, here it goes:
Is PK a separate swf file? If so, go to SK and insert an empty scene before everything else. In this scene, add three frames. You won't need to add any objects, just actionscript. So in the first frame, enter the following code:
loadMovie("PK.swf", this);
Basically it loads PK into this scene and it will get played until the rest of the site is loaded. Now go to the third frame and enter this actionscript:
if (_root.getBytesLoaded() != _root.getBytesTotal()) {
        gotoAndPlay(2);
} else {
        nextScene();
}
This checks to see if the movie is all loaded and plays it when it is.
I am not Jubba
April 16th, 2002, 10:47 AM
I suggest redoing that site and making it smaller and using LoadMovie. Just a suggestion. 720 is huge. too huge...
synista methods
April 16th, 2002, 10:52 AM
I do have a preloader already on there which is just a percent bar and text that says loading please wait. That takes up frames 1-9. I made a loop and the percent bar using script on another post on here. Here is the script on that:
totalK = getBytesTotal()/1000;
loadedK = getBytesLoaded()/1000;
remainingK = totalK-loadedK;
percentageK = (loadedK/totalK)*100;
setProperty ("bar", _xscale, percentageK);
if (loadedK>=totalK && totalK != 0) {
gotoAndPlay (10);
}
Where should I place the script you recommended? Somewhere in this preloader? I would like to be able to show how much time is left before SK is loaded while they watch PK.
Also I know that you can use dynamic text to show bytes loaded and bytes remaining and so forth but dynamic text boxes seem to have a white background instead of the transparent bkgrnd of regular text.
synista methods
April 16th, 2002, 10:58 AM
This site is an 8 page business site. How would you suggest I make it smaller? Are you sayin I should I have used the loadmovie fuction to load each page as a separate swf file?
Synista
lobstars
April 16th, 2002, 11:06 AM
when renni girl says insert an empty scene, does she mean just a layer with nothing actually drawn on the stage, with as she said three frames in the timeline with the script in?
I think I'm right?
Also I was asked to look at a site that was 1500k the other day. I waited forever and the thing never loaded in the end!
RenaissanceGirl
April 16th, 2002, 01:28 PM
Yikes - it's a business site! If so, I highly highly suggest you get the file size down! I have a flash site that has multiple sections and lots of animation but the main interface is only 54K. The main parts of the site are broken up into feasibly-sized pieces, but the whole size of the site doesn't come near 200K. And this is an art site, not a business site.
Now it's ok to have a huge site - I have waited for huge sites to load before, but I must honestly tell you that the longer the wait - the higher my expectations are. If it's bigger than 200 K, I'm expecting to see top of the line animation and imported art pieces (ie: www.happypencil.com, (http://www.happypencil.com,) a huge download, but check out the artwork)! Anything falling short runs the risk of losing business. It's just a thought.
How to shave it down: I could be wrong about this, but I'm willing to guess that you might have a lot of needless animation and effects going on in your flash site. Take a look at it and ask yourself what is the most pertinent animations and information. Yes, take advantage of the loadMovieclip feature, but the total size of swfs downloaded shouldn't exceed, 300ish K (for a business site). Find ways to simplify your scripts by creating functions and having a neatly organized swf wouldn't hurt you either. I know this isn't what your main concern was but if you want more help on this, give me a link to the project and I'll give you a hand.
Lobstars - yup, you're right on the money! Completely empty stage with the Actionscript residing on the timeline, I recommend on a layer entitled "Scripts" or "Actions." It's good to put all your actions in the same place so you don't go nuts trying to remember where you put it.
But you can still have the movie and your bar preloader working harmoniously together while the whole thing loads. Just do the following: create a movie clip, make it completely empty but add the loadMovie scripts as instructed above. Create a new layer on the main timeline (where the preloader is) and place an instance of the movie clip onto this new layer. Don't put anything else on this layer but the clip. According to your preloder, when the SK is fully loaded, it goes to frame 10 and that's when PK should disappear from the stage and from your life. So at frame 10, make sure you enter an empty keyframe on the layer containing the PK movie clip, so the PK movie clip should span only from frames 1-9.
lobstars
April 16th, 2002, 02:47 PM
yay hay :) thanks renni, that has explained that nicely for me! I was sort of sure how to do that, but! and it was a preety big but!, I wasn't certain...........
Thanks again, I'm chuffed with that ;)
Simon
synista methods
April 16th, 2002, 04:32 PM
unfortunately I am a rookie at this flash thing so I don't know how to make my animations more "economical". I also have not put the site up on the web. I would be glad to email it to you so you can help me. Also, renni, if you have some sort of IM that would be a little easier than the post.
Synista
RenaissanceGirl
April 16th, 2002, 07:12 PM
It's totally ok if you're a "rookie at this flash thing." We've all been there of course. You just might not want to promote a professional business site using Flash while you are still learning it. And making a professional flash site is hard to accomplish (I know I can't do it, so I avoid it whenever possible). You can reach me via AIM: RenaissanceGerl (aim:goim?screenname=RenaissanceGerl&message=whaddup+D?).
I am not Jubba
April 16th, 2002, 07:54 PM
I suggest more practice. I'm sure that your site can be cut to at least 1/4 the size if you use actionscript where ever necessary. Many times tweening can be replaced by actionscript and this cuts down the file size dramatically. If you aren't all the good with actionscript I suggest you try some tutorials on this site and then just go from there. Ask quesitons and post all you want here. Thats just too dam big of a site. I know that I, personally would not wait for that to load.
synista methods
April 17th, 2002, 11:09 AM
Well my AIM ID is tml1200. Who ever would like to help please hit me up.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.