Unload and Stop swf from stage

Hi,
I'm a newbie to Flash and Actionscript. I need to give links to around 20 swf files via buttons from the menu.swf. I'm able to give links. But when I come back by clicking HOME button kept at the newly loaded swf the audio files are still being played at the background.
Yes, It has got audio files playing at the back for each slide in the new swfs. When Click on the same link again in menu.swf again the files are being played with the unfinished old file. It's really hectic.
I need to unload it completely from stage when I come back to menu.swf by clicking on HOME button from any of 20 categories.
I used unloadAndStop but it is not doing. I hope that I'm commiting mistakes at somewhere but couldn't predict.
Need some help !
FOR HOME BUTTON:
var _content:Loader = new Loader();
function loadContent(content:String):void {
    if (_content != null) {
        _content.unloadAndStop(true);
        removeChild(_content);
        _content = null;
    var loader:Loader = new Loader();
    loader.load(new URLRequest(content)); //---->>>> I don't really know what should be put in this :-(
    _content = addChild(loader) as Loader;
Home_Button.addEventListener(MouseEvent.CLICK, home);
function home(event:MouseEvent) {
    _content.unloadAndStop(true);
    var homeSWF:URLRequest = new URLRequest("demo.swf");
    _content.load(homeSWF);
    addChild(_content);
FOR MENU.swf button
var loader:Loader = new Loader();
Category1_Button.addEventListener(MouseEvent.CLICK, category1);
function category1(event:MouseEvent):void {
    var Category1SWF:URLRequest = new URLRequest("Category1.swf");
    loader.load(Category1SWF);
    addChild(loader);

Hi,
Can this thread help us?
http://forums.adobe.com/message/3739886
I have seen you have replied to this. Would this give some idea ? Does this script serve the purpose ? I tried replacing the code with appropriate changes and looking like this.
Home Button:
var swf_loader:Loader = new Loader();
///unload previous swf
swf_loader.unloadAndStop();
removeChild(swf_loader);
////load new swf
swf_loader.load(new URLRequest("menu.swf"));
Home_Button.addEventListener(MouseEvent.CLICK, finishLoading);
function finishLoading(e:Event):void{
if(swf_loader.content){
addChildAt(swf_loader, 0);
but getting error as
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at Category1_fla::MainTimeline/frame55()
I think I'm complicating the simple thing.
Thanks.

Similar Messages

  • Unload and stop question

    I need to use the unload and stop method.  But  my actionscript code calls individual swf files which contain 1 video player  each. How would I add the unloadandstop methods into the  existing actionscript?
    First question, add this code to the main.swf that is calling the swfs with thre players correct?
    So far I would I add a second set of event listeners for this function, like this?
    home.addEventListener("click",afterClick);
    bio.addEventListener("click",afterClick);
    commercial.addEventListener("click",afterClick);
    films.addEventListener("click",afterClick);
    videomontage.addEventListener("click",afterClick);
    contact.addEventListener("click",afterClick);
    function afterClick(e:MouseEvent):void
       unloadAndStop(what goes here?);
    if so write separate functions for each swf being called? or call the same code
    the variable remove child calls below?
    ("swfs/" + event.target.name + ".swf");
    EXISTING CODE
    var Xpos:Number = 0;
    var Ypos:Number = 0;
    var swf:MovieClip;
    var loader:Loader = new Loader();
    var defaultSWF:URLRequest = new URLRequest("swfs/home.swf");
    loader.load(defaultSWF);
    loader.x = Xpos;
    loader.y = Ypos;
    addChild(loader);
    // Btns Universal function
    function btnClick(event:MouseEvent):void {
        removeChild(loader);
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
        loader.load(newSWFRequest);
        loader.x = Xpos;
        loader.y = Ypos;
        addChild(loader);
    // Btn listeners
    home.addEventListener(MouseEvent.CLICK, btnClick);
    bio.addEventListener(MouseEvent.CLICK, btnClick);
    commercial.addEventListener(MouseEvent.CLICK, btnClick);
    films.addEventListener(MouseEvent.CLICK, btnClick);
    videomontage.addEventListener(MouseEvent.CLICK, btnClick);
    contact.addEventListener(MouseEvent.CLICK, btnClick);

    var Xpos:Number = 0;
    var Ypos:Number = 0;
    var swf:MovieClip;
    var loader:Loader = new Loader();
    var defaultSWF:URLRequest = new URLRequest("swfs/home.swf");
    loader.load(defaultSWF);
    loader.x = Xpos;
    loader.y = Ypos;
    addChild(loader);
    // Btns Universal function
    function btnClick(event:MouseEvent):void {
        if(loader.content){
    loader.unloadAndStop();
       removeChild(loader);
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
        loader.load(newSWFRequest);
        loader.x = Xpos;
        loader.y = Ypos;
        addChild(loader);
    // Btn listeners
    home.addEventListener(MouseEvent.CLICK, btnClick);
    bio.addEventListener(MouseEvent.CLICK, btnClick);
    commercial.addEventListener(MouseEvent.CLICK, btnClick);
    films.addEventListener(MouseEvent.CLICK, btnClick);
    videomontage.addEventListener(MouseEvent.CLICK, btnClick);
    contact.addEventListener(MouseEvent.CLICK, btnClick);

  • In setting up my AppleTV it asks me to turn on "Home Sharing" on my computer. It is already ON. I have turned it off and back on several times. Rebooted the computer, rebooted the AppleTV. But the same message is up and stops me from progressing.

    In setting up my AppleTV it asks me to turn on "Home Sharing" on my computer. It is already ON. I have turned it off and back on several times. Rebooted the computer, rebooted the AppleTV. But the same message is up and stops me from progressing to the next stage.
    How can I access "Home Sharing" when it won't turn on?

    Hello EagleyeMe,
    Congratulations on your new Apple TV.  I am sure you are eager to get it setup.  I recommend following the steps in the article below to troubleshoot Home Sharing:
    Troubleshooting Home Sharing
    http://support.apple.com/kb/TS2972
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • HT5361 The quit line in my mail application is not accessible and stops me from shutting down my computer (it displays a message saying that "mail has blocker shutdown"

    ?  the quit option in my mail application is not accessible and stops me from shutting down.  Does anyone know what is wrong?  It started after my cable company installed a  new router and modum.

    Linda,
         see the link on the right with the highlighted tick. In short click on the apple icon at top left and choose the wayward app from the 'force quit' dialogue.   Another way is to put an icon in the dock for the Apple utility, "Activity Monitor". Set it to show all users processes and highlight that for the wayward app. The choose 'Quit Process'.  BE CAREFUL, do not choose the low number processes which are fundamental operations for the whole OS.

  • [svn:osmf:] 14178: PARB changes: Remove unload and query methods from PluginManager.

    Revision: 14178
    Revision: 14178
    Author:   [email protected]
    Date:     2010-02-15 21:35:12 -0800 (Mon, 15 Feb 2010)
    Log Message:
    PARB changes: Remove unload and query methods from PluginManager.  We lack compelling use cases for those methods, but can easily re-add them later if we come across some.
    Modified Paths:
        osmf/trunk/apps/samples/framework/DynamicStreamingSample/src/DynamicStreamingSample.mxml
        osmf/trunk/apps/samples/plugins/AkamaiPluginSample/src/AkamaiPluginSample.mxml
        osmf/trunk/apps/samples/plugins/CaptioningSample/src/CaptioningSample.mxml
        osmf/trunk/framework/OSMF/org/osmf/events/PluginManagerEvent.as
        osmf/trunk/framework/OSMF/org/osmf/plugin/PluginManager.as
        osmf/trunk/framework/OSMFIntegrationTest/org/osmf/plugin/TestPluginManagerIntegration.as
        osmf/trunk/framework/OSMFTest/org/osmf/plugin/TestPluginManager.as
        osmf/trunk/plugins/CaptioningPluginTest/src/CaptioningPluginTest.mxml

  • How could i cancel a purshed app from itune store and stop payment from my crediet card

    How could i cancell a purshed app from itune store and stop payment from my vredit card

    Contact iTunes Store support staff through the report a problem links in your account history or,
    iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html - Apple states all sales are final, but you can ask.

  • Start and Stop Weblogic From Admin Console

    Hi All,
    I am using weblogic7.0.I wanted to start and stop the weblogic server from the
    Admin Console(ie., from the GUI).I can stop the server but I cannot start.In order
    to start from admin console what should I do.
    Please post your suggestions.
    Thanks blazix

    You need to run the Node Manager on the manged servers you wish to remotely
    start.
    Chris
    "blazix" <[email protected]> wrote in message
    news:3fc37eea$[email protected]..
    >
    Hi All,
    I am using weblogic7.0.I wanted to start and stop the weblogic server fromthe
    Admin Console(ie., from the GUI).I can stop the server but I cannotstart.In order
    to start from admin console what should I do.
    Please post your suggestions.
    Thanks blazix

  • Starting and Stopping Instances from Netweaver Administrator does not work.

    When we go to our http://<host>:<port>/nwa and navigate to Systems. We see our instances, although we see status and UNKNOWN.
    Also, when we click down to see our server nodes, and try and restart them or stop them...we enter our user/pass for Unix and but it doesn't do anything.
    Does anyone know what is involved to get this functionality to work? We're not looking install CCMS or anything like that, we just want th ability to start and stop our cluster from the central instance web administration screens.
    Thanks,
    -Tim

    Just works for us, without needing any config.
    If your running unix the alternative method is to use a tool called JCMON, much better than NWA.
    log in as <sid>adm onto your host.
    jcmon pf=/usr/sap/PEP/SYS/profile/PEP_JC00_xxxxx
    for our production portal for example;
    Which allows you to do admin on your java instance only.
    use the menu options 10 - 21.
    Message was edited by:
            James Ibbotson
    Message was edited by:
            James Ibbotson

  • Starting and Stopping FMLE from command line yields corrupt .flv files

    I am using FMLE to record and live stream TV content. In order to this I am remotely calling FMLEcmd in order to start and stop encoding processes. The problem that I am running in to is that the .flv files generated are corrupt. The odd thing is that if I use the exact same profile XML from the GUI, then the encoding process works just fine and results appear as intended.
    Here is the way my workflow works:
    I start the process by calling
    FMLEcmd /p C:\lighttpd\htdocs\xml\default.xml /l C:\lighttpd\htdocs\logs\log.txt
    then at the conclusion of the recording I call
    FMLEcmd /s "C:\lighttpd\htdocs\files\default.flv"
    When I attempt to open the files using FFmpeg I get a codec error saying that no codecs were detected. When I attempt to open the files in VLC I get a error saying that the media types are "Undf". When I attempt to open or modify the files with flvtool2 I get an end-of-file error. My guess is that my stop command is incorrect and somehow abruptly stopping the stream, but I don't know another way to stop the stream. Do I need to specify a specific stream duration in the XML and make sure to call the stop command *after* the duration has been reached? What would cause this codec corruption when the same profile works properly from the GUI?
    Here is the profile I am attempting to use.
    <?xml version="1.0" encoding="UTF-16"?>
    <flashmedialiveencoder_profile>
        <preset>
            <name>Custom</name>
            <description></description>
        </preset>
        <capture>
            <video>
            <device>Osprey-440 Video Device 1A</device>
            <crossbar_input>0</crossbar_input>
            <frame_rate>20.00</frame_rate>
            <size>
                <width>640</width>
                <height>480</height>
            </size>
            </video>
            <audio>
            <device>SigmaTel Audio</device>
            <crossbar_input>0</crossbar_input>
            <sample_rate>22050</sample_rate>
            <channels>1</channels>
            <input_volume>75</input_volume>
            </audio>
        </capture>
        <process>
            <video>
            <preserve_aspect></preserve_aspect>
            <deinterlace></deinterlace>
            </video>
        </process>
        <encode>
            <video>
            <format>VP6</format>
            <datarate>650;</datarate>
            <outputsize>640x480;</outputsize>
            <advanced>
                <keyframe_frequency>5 Seconds</keyframe_frequency>
                <quality>Best Quality - Lower Framerate</quality>
                <noise_reduction>None</noise_reduction>
                <datarate_window>Medium</datarate_window>
                <cpu_usage>Dedicated</cpu_usage>
            </advanced>
            <autoadjust>
                <enable>false</enable>
                <maxbuffersize>1</maxbuffersize>
                <dropframes>
                <enable>false</enable>
                </dropframes>
                <degradequality>
                <enable>false</enable>
                <minvideobitrate></minvideobitrate>
                <preservepfq>false</preservepfq>
                </degradequality>
            </autoadjust>
            </video>
            <audio>
            <format>MP3</format>
            <datarate>48</datarate>
            </audio>
        </encode>
        <restartinterval>
            <days></days>
            <hours></hours>
            <minutes></minutes>
        </restartinterval>
        <reconnectinterval>
            <attempts></attempts>
            <interval></interval>
        </reconnectinterval>
        <output>
            <file>
            <limitbysize>
                <enable>false</enable>
                <size>10</size>
            </limitbysize>
            <limitbyduration>
                <enable>false</enable>
                <hours>0</hours>
                <minutes>60</minutes>
            </limitbyduration>
            <path>C:\lighttpd\htdocs\files\default.flv</path>
            </file>
        </output>
        <metadata>
            <entry>
            <key>author</key>
            <value></value>
            </entry>
            <entry>
            <key>copyright</key>
            <value></value>
            </entry>
            <entry>
            <key>description</key>
            <value></value>
            </entry>
            <entry>
            <key>keywords</key>
            <value></value>
            </entry>
            <entry>
            <key>rating</key>
            <value></value>
            </entry>
            <entry>
            <key>title</key>
            <value></value>
            </entry>
        </metadata>
        <preview>
            <video>
            <input>
                <zoom>100%</zoom>
            </input>
            </video>
            <audio></audio>
        </preview>
        <log>
            <level>100</level>
            <directory>C:\Documents and Settings\Administrator\My Documents\My Videos</directory>
        </log>
    </flashmedialiveencoder_profile>

    If issue of corrupt file after cmd line not in GUI mode. Are you using some automation to copy/paste output flv to someother location?
    AFAIK, after placing stop command, FMLE took some time to write proper EOF in FLV. wait ~10 sec for FMLE to complete file writing process and than play in FLV PLayer.
    I tried manually with steps you mentioned and it's working fine for me.I playerd file in Applian Flash PLayer. "http://www.applian.com/flvplayer/"

  • HT1933 When I updated my Iphone 4 with itunes. It deleted songs and changed my ringtones. How do I replace my lost songs and stop this from happening again. Thanks :)

    When I updated my iphone 4 with itunes. it deleted songs and changed my ringtones. How do I stop this from happening in the future and get my songs replaced?

    You have POP mail account.   That's how those types of email accounts work.
    You want an IMAP type of account, where if you delete on phone, it will also delete on server.   Should you ever restore your device again it will only update the mail that hasn't been deleted.
    You didn't say which email service you use, but try contacting them to see if they offer IMAP.  Or you can switch.

  • Starting and Stopping Server from Administration Console without using system ID

    Hi,
    I tried to create another user in the ACL and add it to the Administrators
    group. When I connect to the admin console using this user I receive error
    message NoAccessRuntimeException. Can anybody show me how ti configure user
    to access the console to start and stop managed server. I am using WebLogic
    6.1 SP1. TIA.
    regards,
    Rudy

    Any user added to the Admin group should be able to use the weblogic.Admin
    utility and stop the server and access the console. So if we add Rudy as a user
    to the Admin group then Rudy should be able to stop the server and also use the
    weblogic.Admin commands. however, you cannot start the server with rudy's
    password. You will require a system password for starting the server.
    Please check if the user has been added correctly to the Admin group. you can
    check this in the fileRealm.properties file:
    user.rudy=0x751cc5f18261ba5e570c19a0d2d3cc29a5c5de63
    group.Administrators=system,rudy
    hope this helps,
    Mihir
    Rudy Sutjiato wrote:
    Hi,
    I tried to create another user in the ACL and add it to the Administrators
    group. When I connect to the admin console using this user I receive error
    message NoAccessRuntimeException. Can anybody show me how ti configure user
    to access the console to start and stop managed server. I am using WebLogic
    6.1 SP1. TIA.
    regards,
    Rudy

  • Start and Stop Apex from linux

    I have tried to find out which script is used to start and stop apex, but i hadn't been able to find it. If i do a netstat i do not see the 8080 port open but i can use apex. If i do "service oracle-xe start" oracledb starts correctly but i cannot use apex. Thanx in Advance

    here are windows script...
    First stop db, then listener then opmn (Apache)
    net stop OracleServiceXE
    net stop OracleOraDb10g_home1TNSListener
    C:\oracle\product\10.2.0\db_2\opmn\bin\opmnctl stopproc ias-component=HTTP_ServerTo start:
    net start OracleOraDb10g_home1TNSListener
    net start OracleServiceXE
    C:\oracle\product\10.2.0\db_2\opmn\bin\opmnctl startproc ias-component=HTTP_ServerOn linux you start lister through lsnrctl start/stop "name of listener"... opmn is started the same way as shown here...
    db can be started/stopped as
    ORACLE_SID=XE
    sqlplus '/ as sysdba' @start/stop_script.sqlwhere start/stop_script.sql has:
    <b>startup</b>
    or
    <b>shutdown immediate</b>
    in it.
    Hope this helps a little

  • Messages icon indicates that there is an unopened message but when i go into it the message is blank and no option to delete it. Any ideas how i can get rid of this and stop it from opening up in the blank message each time i open my messages?

    The message icon on my iphone indicates that there is an unopened text message, but when i go into it, it just opens up a blank message, and there is no option to delete it. Any suggestions how i can get rid of this message, and prevent my phone from always opening up in the blank message whenever i go into my messages, rather than just opening as my inbox?
    Many thanks

    Hard restart..  While the phone is powered in, hold the power and home button.   Hold them down and keep them held down.  the phone will eventually shut itself off and reopen.  keep held down till you see the appl elogo, then release.  This will not delete anything off your phone, it will just force all apps to stop their current process.  If you just turn the phone on and off, it will just pick up where it left off.  Good luck

  • Pie Chart - Have no link and stop cursor from changing.

    Hi,
    I have a simple pie chart (flash) with the query:
    select
         NULL link,
         rag.meaning,
         count(wp_id)
    from ......
    For this particular chart I do no want a link from the pie chart to another page so I have defined the link as NULL. This works OK and clicking the chart does nothing (as expected).
    Unfortunately the cursor still changes from the normal arrow to a pointing finger (as it does for any other hyperlink) which may confuse the user into thinking they should be able to click here and drill down.
    How can I stop the link from existing entirely?
    Many thanks,
    Martin

    Bump

  • Flushing loaded swfs from stage target mc?

    Hi, I'm using buttons to send the playhead to frames in which swfs are then loaded into an otherwise blank movieclip called "stage_target_mc" ...how can I then flush out the previously loaded swf so only a newly loaded swf displays in "stage_target_mc"?  For example, after clicking upon the 'about' button the 'about' swf loads...then if the 'concepts' button is clicked the 'concepts' swf loads -- but the previously loaded 'about' swf still plays...I would like to be able to flush the 'about' swf so only 'concepts' is display, in this example.  Thanks!
    code associated with buttons used to send playhead to frames "concepts" or "about":
    about_btn.addEventListener(MouseEvent.CLICK, displayAbout);
    function displayAbout(e:MouseEvent):void {
    root.gotoAndStop("about");
    concepts_btn.addEventListener(MouseEvent.CLICK, displayConcepts);
    function displayConcepts(e:MouseEvent):void {
    root.gotoAndStop("concepts");
    code on frame called "concepts":
    stage_target_loader.load(new URLRequest("swfs/stages/concepts.swf"));
    MovieClip(root).stage_target_mc.addChild(stage_target_loader);
    code on frame called "about":
    stage_target_loader.load(new URLRequest("swfs/stages/about.swf"));
    MovieClip(root).stage_target_mc.addChild(stage_target_loader);

    Before loading, try using the unloadAndStop() method of the Loader class if you are using a newr version of Flash

Maybe you are looking for