Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

AS3 How To unload from my Flash a dynamicaly loaded swf

Posted on 2009-04-24
6
Medium Priority
?
643 Views
Last Modified: 2013-11-11
Hello everyone, ok this is my problem,
I have the following files:
Main.fla
Video1.swf (this is an embeded video)

from my Main.fla I call dynamicaly to my Video1.swf and that works just fine, BUT,  I have a button in my Main.FLA with which i want to unload the video1.swf
Now, the problem is that i am able to change its visibility to false but the music still goes on.

Any ideas on how to STOP the video1.swf or to destroy it from Main.FLA? or to unload it in any way?
0
Comment
Question by:fsilva79
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:john_hollings
ID: 24229348
trying using th removeChild(nameofmc);

0
 
LVL 2

Author Comment

by:fsilva79
ID: 24230188
I already used it, but this will only hide it, or make it desapear or invisible, but the audio from the video keeps going and if you click to another video then you have 2 audios playing, and if you keep clicking new videos it will keep all the previous ones in the background.
0
 
LVL 6

Accepted Solution

by:
biyik earned 1000 total points
ID: 24232063
you can try to add SoundMixer.stopAll(); to your button's function.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Author Comment

by:fsilva79
ID: 24239023
Tahnks biyik,

that did work, but I had to investigate a lot to find out how to use that command.
I apprecitate and thank you for your advice, but seriously if you are really wanting to help, be more specific and detailed.

I have to give you the points because I have to close this question, but honestly I got the full answer from another website.
0
 
LVL 2

Author Comment

by:fsilva79
ID: 24239073
ok, I found the solution and here it is how I managed to do it

ok, finaly I manage to solve this problem, i did the following:


import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundMixer;

var loader:Loader = new Loader(); //this variable will load the file
var movieClip:MovieClip = new MovieClip();

...(your code here)
...(your code here)
...(your code here)

//then... i wrote my CloseButton function as follows:

private function closeMovieClip(evt:MouseEvent):void
{
var movieClip:MovieClip = MovieClip(evt.currentTarget);
movieClip.removeEventListener(MouseEvent.DOUBLE_CLICK, closeMovieClip);
Tweener.removeTweens(movieClip);

if(contains(movieClip))
removeChild(movieClip);
SoundMixer.stopAll();
loader.unload();
}
/* the only downside of this is that if you had a background sound */
0
 
LVL 6

Expert Comment

by:biyik
ID: 24239202
Sorry, you're right. Thank you for your comment.
See you!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question