Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-01-2004, 05:00 PM   #1
Registered User
Join Date: Sep 2004
Posts: 10
Default Control a movie on a level using actionscript

Ok heres what I want to do...

I've got a main movie on _level0 which contains buttons that call up movies onto other levels eg. _level50. The movie on _level50 has a fade in and stops. When the user clicks on another button on _level0 i want the movie on _level50 to finish out it's timeline and then the movie relating to what ever button the user clicked on _level0 to replace it.

Also, say for example the user clicks on 'Contact' a button on _level0 and the 'Contact' movie loads and fades onto _level50. This 'Contact' movie has 50 frames but has only reached frame25 (the fade in) and stopped. The remaining 25 frames are a fade out. Currently when a user clicks the 'Contact' button on _level0 again the animation resets and fades in again and plays to frame25. I'm using a loadMovie function on the 'Contact' button, so I know it's re-exececuting this everytime and thats why the movie plays again. Is it possible to get the button to 'ask' whether there is a movie on a particular level? (therefore I can say 'if there is a movie on _level50 just stop, therefore it'll have played and won't repeat).

ianclarke is offline   Reply With Quote
Old 09-01-2004, 06:33 PM   #2
Super Moderator
Cota's Avatar
Join Date: Jul 2001
Location: NYC
Posts: 10,175

Yuo can do it with a few variables and a series of conditional statements. Lets set up a _global variables, we'll call it _global.newclip. Declared it on the _root timeline. Lets the user clicks on contact, we'll have this code:
ActionScript Code:
on(release){ if(_global.newclip != "contact"){ _global.newclip = "contact"; _level50.gotoAndPlay(26); } }

Now at the end of the loaded swf's, you can put this
ActionScript Code:
loadMovie(_global.newclip + ".swf",50);

Keep in mind I'm doing this off the top of my head, so if there are any errors, dont kill me. This is the basic logic for what you're trying to do, it can be greatly improved upon.
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com

cota - www.chadworkman.com | http://shavedplatypus.com
occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql)
Cota is offline   Reply With Quote
Old 09-01-2004, 06:40 PM   #3
Join Date: May 2004
Location: Sicily
Posts: 332

devonair is offline   Reply With Quote
Old 09-02-2004, 08:18 AM   #4
Registered User
Join Date: Sep 2004
Posts: 10
Default Thanks Guys

I knew it could be done! Thats excellent. You guys are the best.

ianclarke is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 03:22 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.