ActionScript 3.0 :: If Statement To Unload Any Active Swf Before Starting Another

Aug 10, 2010

I have a video player of sorts that plays one of 6 videos based on which buttons is clicked. Everything works perfectly if the user selects the "stop" button on the video control bar before switching to another video. But, if the current video is left playing when another video is started, the audio from the first video continues on overlapping the second one.
 
I know this is a common problem in AS3 and should be easy to remedy with unloadAndStop() but I can't get my if statement to work right. I'm working with the videos march_mc and august_mc to figure this out. Basically I'm trying to tell Flash that if march_mc is playing when august_mc is requested to unload march_mc then play august_mc. This works if march_mc was playing to begin with, but if I try to play august_mc when march_mc isn't playing it returns a null object error. In my head, the if statement should prevent this from happening but I'm doing something wrong...
 
Here's my code that's on august_mc:
 
augustPlay_btn.addEventListener(MouseEvent.CLICK, startAugust);
function startAugust(event:MouseEvent):void{
if (MovieClip(root).march_mc.currentLoaded == MovieClip(root).march_mc.totalLoaded)
{

[Code]....

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Unload All Active Movieclips Within Another?

Jul 14, 2005

How would I unload all active movieclips within another movie clip, if I dont know their names at runtime?

View 3 Replies

ActionScript 2.0 :: Login - First Frame Is Not Active Frame The 2ed Is The Active And 3ed Is Blank So It Wont Show?

Jan 18, 2012

im working on my own site im lost though i copyed and pasted so much but i cant seem to figer somthing out.i have a members sys sitting on a few frames every thing works. but the profile button, i have a total of 11 buttons that are working. i coppyed them put them all on 1 frame with there own instances that contain 3 frames?the first frame is the not active frame the 2ed is the active and 3ed is blank so it wont show. so my login code at this point is

ActionScript Code:
//Button Functions
signupBtn.onRelease = function() {[code]...

View 0 Replies

ActionScript 1/2 :: Window Component - Keep Buttons From Being Active While The Popup Window Is Active?

Mar 26, 2009

I have a window component on my main timeline that gets called up on several instances. When the popup window appears, everything looks fine, except that the user can still click on links that are now behind the actual popup window itself. My question is how do I keep those buttons from being active while the popup window is active?

View 2 Replies

ActionScript 2.0 :: Unload Movie Stuff - Current Swf To Unload And The New One To Load Only After A Transition Occurs

Jun 16, 2003

I want the current swf to unload and the new one to load only after a transition occurs. Is there a more efficient way to do this than if. switch()?

View 2 Replies

ActionScript 3.0 :: Unload The Previous Loaded .swf And Load The New .swf Without Having A Separate Button To Unload

Aug 9, 2008

I am working on a school project that requires me to load external .swf or .jpg files. I currently have all of the buttons working and are loading an external .swf file on to the screen. The problem I am having is that when I go from one button to the next the loaded .swf stays on the screen and the next .swf gets loaded on top of it. I know that I need to unload the file but I am not sure where to put the code for the unload or what code exactly to use. I would like when the button is pressed to unload the previous loaded .swf and load the new .swf without having a separate button to unload.

[Code]...

View 3 Replies

ActionScript 3.0 :: Unload Not Unloading - Unload An External SWF On _root To Load A New One Instead

Jul 23, 2009

I'm trying to unload an external SWF on _root to load a new one instead. I've tried (almost) everything but can't figure it out... I get this error : "Error #1010: A term is undefined and has no properties."

[Code]....

View 3 Replies

ActionScript 2.0 :: First Requirement Of The If Statement When Type In The Proper Input And Go Straight To The Else Statement

May 14, 2009

Having a few problems with what I thought was a simple if statement. Here is the code:

[Code]...

I can't quite figure out the small problem with the code. It seems to just bypass the first requirement of the if statement when I do type in the proper input and go straight to the else statement.

View 7 Replies

ActionScript 1/2 :: Execute Code In Previous If Statement If Second If Statement Is Executed?

Aug 31, 2011

if (variable == 1){
//code
//Execute this code.
} else if (variable == 2) {
//code

[Code]...
 
I dont want to copy the code from the first into the second and the first and second into the third.
 
My mind isn't working and there is probably an extremelly simple way to get this working.
 
I know I could used functions but for some reason it stops the instance referencing working: _root["bullet"+j] doesnt work in a function.

View 7 Replies

ActionScript 2.0 :: Loading Data From XMl File And Uses It To Run An If Statement. If Statement Fails?

Oct 10, 2008

The Flash movie contains 2 Text files, one Component button, and 1 component checkbox.The purpose of the application is to load an XML file(works)Populate 2 text fields with information from the XML file(works)Compare the two text fields, if they contain the same information then the checkbox, via AS is told to be selected. (Heres the problem);

Heres the code:

Code:
runCode_btn.onPress = function() {
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success) {

[code]....

The idea behind this app is that its an electronic form. The user fills it out, the information is then sent to a newly created XML file, months later the open the XML file in flash, and Flash fills out text fields and check and or unchecks Checkboxes based on the XML data.CheckBoxes are mandatory.But I don't see how I'll be able to use them if i can't create and condition statements based on the loaded Data.

View 1 Replies

ActionScript 2.0 :: If Statement Inside If Statement Won't Work

Mar 30, 2011

why this code won't work

[Code]...

I'm sure you can put if statements inside other if statements, seriously I can't figure it out

View 4 Replies

ActionScript 3.0 :: Another 'if' Statement Inside An 'if' Statement?

Sep 22, 2010

I need to write an if statement inside an if-else statement. But no matter how I write it it keeps giving me a syntax error.The syntax error is "1083: syntax error: else is unexpected".[code]No matter how or where I place the braces, it keeps giving me errors.

View 13 Replies

ActionScript 3.0 :: Use A For Statement To Create An If Statement

Jul 12, 2010

what I'm trying to do is create an else if argument for each object in an array based on a user set number

Code:
for(var i:int=0; i < numberOfElseIfs; i++){
GENERATE AS3 CODE
}

to which I want it to GENERATE THE FOLLOWING CODE:

Code:
}else if(baskets[i].used == false){
baskets[i].used = true;
drawButton(i);
}

the problem is obviously that the compiler reads this code rather than understanding I'm trying to regenerate the code within the for loop...does that make sense :S? So basically I need as3 to read the code between the for statement as if it is going to echo that out later. Is this even possible?

View 4 Replies

ActionScript 3.0 :: Write Another "if Statement" Inside Another If-else Statement?

Sep 22, 2010

I have a script which is giving me a lot of trouble since I have no idea how to write another "if statement" inside another if-else statement. I keep getting errors, I guess I don't know where to put the braces exactly...

example:
if(bla == bla) {
<------------how would I write another if statement here?
}else if (bla == bla){
}

View 3 Replies

CS3 : Starting MC Frame Other Than 1?

May 19, 2011

Is there any way to make a movie clip start at a frame other than 1? I know with graphics it's simple, but with MCs I'm not sure. If possible, I'd like to do it without code, but if that's the only way to do it, I'd like to know that way too.

View 1 Replies

ActionScript 2.0 :: Bullet Is Not Starting From The Car?

Nov 26, 2010

I'm creating a small car game where you shoot from the car, so I've made a bullet animation with this code inside the mocieclip:

Actionscript Code:
shellNo = 0;function shellEject(){shell_holder.attachMovie("shellAnim", shellNo, shellNo);shellNo++;}

But the problem is that the car is moving when you controll it so the bullet stays on the same position and I want it to follow the car and start from the same position as the car whereever it goes.

View 1 Replies

Starting And Stopping Video And MP3

Aug 5, 2009

I can't seem to get around my video and audio files starting when I arrive at the page. I'm even using some example code with start and stop buttons. This is in CS4 Flash. I expect it's because the ActionScript is in the wrong place because when I run the movie it flashes through all of the pages on the site without stopping at the home page. Is there some generic code that will allow me to simply swap out the name of the video or audio file I want to start. If there is, do I need to locate it on its own layer at the top of the timeline?

View 6 Replies

Starting Off With Flash Animations?

Sep 11, 2009

I just started to make flash animations using Adobe Flash CS4, but there's something I just don't understand. To create an animated object, I know I have to create a new movie clip symbol, animate it, and then put it in the main scene. But when I drag the symbol from the library to the main scene, only the first frame of the animation is copied! How can I copy the entire animation of a movie clip symbol to the main scene?

View 5 Replies

ActionScript 1/2 :: Bullet Is Not Starting From The Car

Nov 25, 2010

I'm creating a small car game where you shoot from the car, so I've made a bullet animation with this code inside the mocieclip:

shellNo = 0;
function shellEject(){
shell_holder.attachMovie("shellAnim", shellNo, shellNo);
shellNo++;
}

But the problem is that the car is moving when you controll it so the bullet stays on the same position and I want it to follow the car and start from the side of it whereever it goes.

View 1 Replies

Determine When FMS Is Starting To Get Overloaded?

Aug 5, 2011

We have a set of FMS's deployed on Amazon's EC2.  One of the things we want to be able to do is automatically detect when we should start up another FMS instance.  To do that, I've been looking for metrics I could measure on the local FMS box to help me identify "transition" points, e.g., when we should add capacity or remove excess capacity.

I ran some load testing to find out where the capacity limits of a particular box, but ran into a couple of problems[code]...

View 9 Replies

Starting From Current Y Position?

Sep 22, 2011

i have a text area that can be swiped using a touchevent....

var myText:TextField = new TextField();
myText.width = 300;
myText.x = 0;

[code].....

View 7 Replies

ActionScript 2.0 :: What Encapsulation Is Best Used Starting Out

Dec 15, 2009

Figuring out Public, Private, Internal, Protected for every variable in even a basic banner is a lot for me to figure out. Defining permissions of movieclips is totally new to me. Personally, I could truly care-a-less as I don't build apps. I work in smaller media. But I need to do things right for stuff to work fast when clients want changes every 5 minutes.What's good to use starting out so I don't trip all over myself with errors?Is there a general rule of thumb for a least path of resistance? I'm thinking I should just make everything public (or what I used to know as global) unless something "bad" happens.

View 2 Replies

ActionScript 3.0 :: Starting A Timer At 2:00?

Nov 9, 2010

i've got a timer that at the moment starts at zero and goes on forever. It is also visable on stage. What I want to know is how can I get it so the timer starts at 2:00 and continues down to zero?

View 5 Replies

IDE :: Video Starting Too Fast

Jun 27, 2009

[URL]

You don't have to understand anything the problem is into the intro. It is quite simple but I don't really know how to fix it. The problem is the movie in the first page start before it totally loaded so depending of your connection and your cpu in doesn't start at the begin.

I want to fix that.

Here's my structure.

I have a swf which load the "template" which load another swf which load the movie

index.swf (preloader)--->base.swf--->preloader2.swf---->movie.swf

I think that the only thing you need is the code of the preloader

Code:
//code for the preloader and loader element
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);

[Code]....

View 1 Replies

ActionScript 2.0 :: Bullet Is Not Starting From The Car

Nov 26, 2010

I'm creating a small car game where you shoot from the car, so I've made a bullet animation with this code inside the mocieclip:

[Code]...

But the problem is that the car is moving when you controll it so the bullet stays on the same position and I want it to follow the car and start from the same position as the car whereever it goes.

View 1 Replies

ActionScript 2.0 :: Starting With XML Sockets?

Jul 18, 2004

I've begun playing with Flash and XML Socket Servers and I thought I started taking to it easy, but now I'm running into some problems and I'm a bit confused! I was able to connect and disconnect to a socket server I wrote and Unity but I seem to be having problems sending and/or recieveing data.I wrote a small amount of code to try it out:

var server:XMLSocket = new XMLSocket();
server.connect("66.194.238.241",10000);
server.onConnect = function(success:Boolean) {[code].....

It seems to be connecting fine but when I click and I try my send.

View 2 Replies

Flash :: "IF" Statement, Within A For Statement, To Control Movieclip Within Movieclip?

Dec 18, 2011

I have a movieclip on the screen called "mc_bg". Within this movieclip are 7 movieclips called "barrier1" through "barrier7".From main.as I want to be able to do this call:

for (var i: int = 1; i < 3; i++ ){
trace("got here")
trace(mc_bg["mc_barrier" + String(i)])

[code]....

View 1 Replies

ActionScript 2.0 :: Starting Two Videos At Same Time

Oct 19, 2009

Currently I've got 2 of the same movie clip. both containing an flvplayback component. One of them has a heavy blur effect, one of them doesn't. The blurred one is the 'reflection' of the other one, but the problem is they don't load at exactly the same time alot of the time. Is there any simple code that will make one wait for the other to load? You can see it here... [URL].

View 2 Replies

Starting Animation When Button Pressed?

Dec 22, 2009

I have done an animation which includes a button that I want to use to start it. I've added action script to stop the animation on the last frame, I just have no idea what action script to put in to start it when the button is pressed. I have 14 layers + an action script layer. 7 of the layers are animated.

View 3 Replies

ActionScript 3.0 :: One MovieClip Starting Another OnStage

Sep 2, 2011

In the transitional stage to AS3, I have 2 MovieClips onstage both with a short animation in them. MovieClip2 has the stop(); on its first frame. When movieClip1 gets to the end of its timeline I want it to start movieClip2 playing.
parent.movieClip2.gotoAndPlay(2); doesn't work.
Do I need evenetlisteners or something?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved