Keep imported SWF on top across scenes

Hi,
I have made a flash game using scenes, and am trying to get sound to play across all scenes. I have so far made an external SWF and imported this into the first frame of the first scene. This works as expected, and the sound continues throughout the game. The sound can also be controlled across all other scenes, however the button itself is not visible as it is underneath  all of the other content in the scene (hiding all layers allows the button to be seen)
How can I get the button to stay on top through the whole game?
Here is the code used to import the sound file:
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
function startLoad()
var SoundLoader:Loader = new Loader();
stage.addChild(SoundLoader);
var url:URLRequest = new URLRequest("sound.swf");
SoundLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
SoundLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
SoundLoader.load(url);
function onCompleteHandler(loadEvent:Event)
        addChild(loadEvent.currentTarget.content);
function onProgressHandler(mProgress:ProgressEvent) {}
startLoad();
P.S. Before anyone tells me not to use scenes, I know not to in future but it is a bit late now

you need to make SoundLoader not-local to startLoad:
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
var SoundLoader:Loader = new Loader();
function startLoad()
addChild(SoundLoader);
var url:URLRequest = new URLRequest("sound.swf");
//SoundLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
//SoundLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRES S, onProgressHandler);
SoundLoader.load(url);
function onCompleteHandler(loadEvent:Event)
        addChild(loadEvent.currentTarget.content);
function onProgressHandler(mProgress:ProgressEvent) {}
startLoad();
 any time other objects are added above SoundLouder and you want SoundLouder moved above, re-apply:
addChild(SoundLoader)

Similar Messages

  • Problem with persistence across scenes

    I have a student who has created some code- see below. At the moment this code is in Scene 5 - but the blocks also appear on other scenes.
    How does he limit this code to just one scene?
    Can he replicate this to be used on other scenes, but starting out fresh.
    Currently, 50 blocks spawn on top of one another. These are used for teaching addition or multiplication. When they've been dragged out into a pattern, we don't want that pattern on another scene, we want them on on top of the other.
    The code is not overly elegant, but it does work - except for being repeated across scenes.
    block = []
    //this function creates a block at a certain location and adds it to an array
    //new identifiers are block30 and so on
    function spawnBlock(){
      blockSpawn = attachMovie("block","block"+_root.getNextHighestDepth(),_root.getNextHighestDepth(),{_x:5 50,_y:300});
      block.push(blockSpawn._name);
    //this runs the spawnBlock funtion 50 times creating 50 new blocks
    //change 50 to the number of blocks desired
    for(i=0;i<50;i++){
      spawnBlock();
      //trace(block[i]); //testing if the funtion was working
    function dragSetup(clip){ //this is used to assign a movie clip to funtion that can be reused with each block that is created
      clip.onPress = function(){
      startDrag(this);
      clip.onRelease = clip.onReleaseOutside=function(){ //same as above
      stopDrag();
    //this lets each block that is needed to be dragged
    //add in more lines to let more blocks get dragged
    dragSetup(block0);
    dragSetup(block1);
    dragSetup(block2);
    dragSetup(block3);
    dragSetup(block4);
    dragSetup(block5);
    dragSetup(block6);
    dragSetup(block7);
    dragSetup(block8);
    dragSetup(block9);
    remainder removed for brevity.

    use:
    function clear_blockF():Void{
    for(var i:Number=block.length-1;i>=0;i--){
    this[block[i]].removeMovieClip();
    block.length=0;

  • Imported swfs display different every time

    Hello -
    I have tried importing swfs, and each time it displays different when published. The first time, it resized and could be seen completely within the window. The second time, it did not resize so only the top left of the image could be seen. The third, time it sort of resized, but is still cut off on the bottom. I inserted the same swf file the same way each time, so I'm not sure what affects the way it displays when published. I'm using the trial version of Presenter version 7.0.7 Build 7746. The swfs were created in Captivate 5.0, and I'm using Office/PowerPoint 2010. Below are examples of what each looks like after the publish. Does anyone know how I can control how the swf will display once published?
    Thanks!
    Katherine

    Hello -
    I think it has to do with resizing the swf once it is imported. I resized it first by widening it so it went the entire width of the page - the second time I believe I did the same thing and got the larger image. Then I tried various ways of resizing and also not moving or resizing at all, and got these different results. It is not consistent, the same way of resizing did not result in the same output. Is it not possible to resize the imported swf - for example, resize so it takes up the entire slide? Below is a link to download the swf I'm using.
    http://mylearn.documentum.com/curriculumdevelopment/slide4.zip
    Thanks!
    Katherine

  • HELP my imported SWF

    I have created an animation of a superman like character flying with the animation being his cape flapping, his eye moving occasionally, and he moves up and down slightly to imitate the movement of flight.
    I exported that animation as a SWF movie.
    I then opened a new document and then imported that SWF file into the library to use, but when I place it on the stage, the functionality doesn't work. The only animation that has carried over from the original file is the cape flapping. The moving eye doesn't work, and he doesn't move up and down anymore.
    I'm quite new to animation in flash, so maybe I'm exporting and importing too many times or something, or I'm just not going about it the right way.
    Should multiple animations be done in the same document? or should they be done individually and then all imported into a new document where they all come together?
    All help and advice most welcome.
    Thank you.

    First of all I done all the artwork in Illustrator, then I imported the pieces into Flash and set them in position, putting on seperate layers the parts that were to to move, eg. the pupil in the eye moving within the eyeball.
    For the cape, I had done what you said not to do, but it's the only thing that's working, ironically. I made the flapping cape animation in a separate flash document using 5 different images and changing to each along the timeline every 1 second. I then exported the flapping cape as a SWF movie and then imported it into the flash file where the body of the character was and positioned it where it should be.
    The eyeball moving occasionally was done using a motion tween, as was the gentle moving up and down of the man flying.
    Then I exported ALL that as another SWF movie so that it was one animation (which actually included 3 different animations. 2 done in the document, and one imported SWF), but it's only the flapping cape that continues to work even if I copy all the layers across instead of importing the SWF.
    I know that all sounds a bit of a mess to people who know how it should be done, but I'm a bit lost at the moment as I'm not sure which steps I should be taking and in which order.
    Thanks for your help with this.

  • After effects cs6 will not import swf files...

    after effects cs6 will not import swf files...keeps saying it's unsupported. why would this be? what do i need to change?

    What SWF file? What source? How was it generated? SWF generated by Flex/ Flash Server may contain constructs that are incompatible and SWFs that render all their elements dynamically using Flash drawing primitives and use lots of ActionScript may also not work...
    Mylenium

  • Actions not working to imported swf files in Flash Catalyst

    Hi,
    I have a problem with manipulating my imported swf files (created in Flash professional) in Flash Catalyst CS5. Whenever I add any of the swf control actions to a swf file in the timeline such as 'stop', the animation ignores it and keeps replaying. I tried to add action sequence when a certain button is pressed, and also tried to create 'On application Start' and added 'stop' so that the animation stops immediately when the application opens. No matter what I do, the animation refuses to perform the actions and simply replays. The animation is a simple shape tween between 2 states with no action script attached to it. I published the animation as an swf and exported it to Flash Catalyst. Is there any suggestions whatsoever on why this is happening? Is it something to do with setting up my flash file prior to import? The only way I figured out to stop the animation from playing is adding action script to the flash file in Flash Professional however this is not what I want because I would like the animation to be controlled by components in my flash Catalyst document.
    Thanks

    You can make you swf a custom component with 2 states.
    The first state will be empty and rename it "OFF" the second state will have your swf file and name it ON.
    Then go back to your artboard/project, add your 2 buttons ON & OFF.
    For the ON button add interaction "play transition to custom component ON"
    For the OFF button add interaction "play transition to custom component OFF"
    Here is an example swf_control

  • Unable to open or import .swf into flash CC IDE

    hello, since I installed flash CC yesterday, I am unable to import .swf file into my .fla neither open .swf file in flash IDE. SWF extension is even not listed in list of supported files (I did all this normally in CS6 and before). When I try to open swf file in flash (because I got some assets in swf and need to edit it and put it to fla) it says something like "one or more files  were not imported because there were problems to read them." Shall I reinstall flash CC again or any other suggestion please ? thank you

    Maýbe you can install the trial CS6 from the product page and then sign in with your cloud ID? It has worked for me before when I had to re-install. After installed it should ask if you want trial or has a license, sign in to license and it should work again I hope. You may have to update CS6 after through the cc manager.
    Adobe should have put a full list of dropped features to read in one place before updating. It´s very poor customer management not to. But wise to all previous updates of Flash I keep every version, for ever if possible.

  • Control imported swf/movieclip

    I have one swf importing a number of other swf's to play in turn. I wish to control the imported.swf which is loaded into a movieclip (MainScreen) from the main.swf - in AS2 I used
         MainScreen.sfp=1;
         MainScreen.gotoAndStop("wait");
    which stopped play and sounds in the imported.swf or  MainScreen.gotoAndPlay("go"); which started the imported.swf
    In AS3, I have tried the same thing but get no response, though I can lick on a button in the imported.swf to make it play, I cannot control it via the main.swf - have also tried this.MainScreen.gotoAndStop("wait"); but no change. Am stuck as I do not wish to include buttons on each imported swf.
    Also: Can I copy the contents of one movie clip to another.  I have a series of movieclips mcp1, mcp2... inside another movieclip (mcp). I initially load several external.swf into this movieclip (mcp.mcp1 mcp.mcp2 ...etc) so as to see the progress of each swf loading (maybe 15 or 25 depending) then show one page at a time fulll screen. I have then in the past simply relaoded one imported.swf into the MainScreen movieclip which is quicker having preloaded each swf in a group, but this seams inefficient. Any comments or ideas appreciated.
    Thanks

    Thank you Ned... 12,500 responses odd, you have made more responses than I've had hot lunches.
    I appreciate you comment about removeChild and not unload, and that is what I tried to try.
    stop();
    function fwd_bF(event:Event):void {
          trace("fwd:");
          SoundMixer.stopAll();
    MainScreen.removeChild(ldr);      // MainScreen  is a movieclip
            pgno+=1;
           gotoAndStop("g_g");
          function rev_bF(event:Event):void {
       MainScreen.removeChild(ldr);
               SoundMixer.stopAll();
               trace("rev: "+pgno);
               pgno-=1;
               gotoAndStop("g_g");
    books_b.addEventListener(MouseEvent.CLICK, books_bF);
    home_b.addEventListener(MouseEvent.CLICK, home_bF);
    fwd_b.addEventListener(MouseEvent.CLICK, fwd_bF);
    rev_b.addEventListener(MouseEvent.CLICK, rev_bF);
    ldr.contentLoaderInfo.addEventListener(Event.INIT, dealWithIt);
    MainScreen.addChild(ldr);
    function dealWithIt(evt:Event):void {
          var MainScreen:MovieClip = MovieClip(evt.target.content);
          MainScreen.gotoAndPlay("go");
          play_b.addEventListener(MouseEvent.CLICK, play_bF);
          stop_b.addEventListener(MouseEvent.CLICK, stop_bF);  
          function play_bF(event:Event):void {
                trace("go...");
                MainScreen.gotoAndPlay("go");
          function stop_bF(event:Event):void {
                trace("stop...");
                MainScreen.sfp=1;
                MainScreen.gotoAndStop("wait");
    ldr.load(new URLRequest("swf/"+arm[pgno]+".swf"));  // arm[*] is array containing swf names.
                                                                                          // pgno  :Number keeps track page we’re at
    I have trouble getting the MainScreen to removeChild, it either removes the ability to reload or leaves multiple swf’s loaded into the mc. I’ve tried using MainScreen.removeChild(ldr) and MainScreen.removeChild(evt.target.content) inside the dealwithit function, but it does not like that either.
    I found a loader at Google that brings in multiple files (swf, jpg, mp3 etc) and puts swf’s to an array. Which all sounds applicable to what I require, but being new to AS3 etc it seems to be hidden in packages and cryptography, so I will need to see how I can put it in place. But I think I will still be faced with the same problem of then controlling the various swf’s.

  • Error while importing swf file in to Crystal Xcelsius Designer 4.5

    help me...., Error while importing swf file in to Crystal Xcelsius Designer 4.5

    I read in the book called "CRYSTAL XCELSIUS for DUMMIES" on page 243 under topic called Nesting a Dashboard within another Dashboard.
    sorry i used the wrong word embed, here i am importing the swf using image component.
    My requirement is somethis like this parent child dependency menu.
    eg: i have to two tabs 1)alphabets 2) Numerics  First levet menu
    if you click alphabets tab then the following menu A/B/C/D/..... Z i have diff charts.. under each alphabet.
    If you click numberic tab then the follwing menu should one/two/three/.......ten  here also i have diff charts under number
    in over to avoid complexity in dynamic visibility i divided the into 3 dashboards.  1- alphabets 2- number and 3 -importing both swfs.. everything works fine except first tab and last tab under alphabets and numerics.
    If some one help me with some alernative ... would be great.
    Thanks

  • How to keep new applications on top within windows 8.1 desktop

    In previous Window versions when one opened applications such as word, excel or browser or snipping tool these applications stayed on top.  
    However, in windows 8.1 now when ne application is openned, one needs to minize other applications before starting to use it.  This is very non productive use of time and prevents swtiching between dpendent application, open version of documents, and
    images.
    Please provide suggestions how to configure the system to enable latest application on top.
    Thank you.

    Hi,
    Based on my knowledge, you can keep new applications on top of all other windows on your desktop, even while you're working in other programs.
    I would like to suggest you restoring healthy  by using this command: dism /online /cleanup-image /restorehealth first.
    Meanwhile, please ask on the following forum. This is where the Windows 8.1 experts answer questions.
    http://social.technet.microsoft.com/Forums/windows/en-US/home?category=w8itpro&filter=alltypes&sort=lastpostdesc
    Thank you for your understanding.
    Regards,
    Blair Deng
    Blair Deng
    TechNet Community Support

  • Import swf files in CP3, but export without any voice?

    Did anyone have the same problem with me?
    I imported swf file in slide and published. But I can't hear any voice in the slide....
    At the same time, I tried to import as flv file and published, then it works. Voice in slide can be heard with no problem.
    How can I fix the problem? thanks!!

    Hi,
    Just a quick check. Go to menu item " Edit > Preferences" and select category "Publish Settings".
    Confirm that option "Include Audio" is checked.
    regards,
    Mukul

  • Importing Swf

    Hi there,
    I have created a flash file using codebaby and it is transparent; however, when I bring it into adobe presenter, it has a black background.  How do I get rid of the black background of the imported swf file?  It looks great in other tools; however, I need it to be transparent in adobe presenter.  I have 7.0.
    Adobe presenter 7.0.6 build 7604

    Hi there,
    I am using AS2; however I still get the black background, so then I tried capturing the background and using that in my background and I get a border.

  • Why an imported SWF created in Flash CS5 doesn't works fine?

    perhaps I am not lucky. I find no answer.. perhaps im a noob (daaaah)  please if you can help it would be appreciated!
    I'm new in flash and flash catalyst.. but i'm not bad at all hehe. After publishing a swf from flash CS5 (that works perfect when i preview it) i want to import it in flash catalyst...
    ... i click on import swf and i select my swf. When i execute the project (CTRL+ENTER) in flash catalyst the motion tweens created in Adobe Flash doesn't start
    Even if it works well when i run the SWF from desktop or in Adobe Flash directly

    A detail that could help you guys..
    I used FlashEFF2 in Adobe Flash CS5 (as a Text Effect (it's awesome)) and this effect only starts and works fine in Flash Catalyst. The motions tweens created in Adobe Flash CS5 doesn't starts in Flash Catalyst
    Thanks to read it!
    Max

  • How can I keep a listbox on top of a string control?

    I would like to keep the listbox "on top" or "in front" of the string control.  Whenever I click in the string control, though, the listbox moves behind it.  I have set the order from the menu, but that seems to get overridden.
    Attachments:
    String-Listbox.vi ‏13 KB

    LOL
    That was just to pull the wool over somebody's eyes...
    Check the control editor of the string you will know the truth
    (Anyway thanks for the stars )
    Message Edited by Vsh on 04-08-2008 07:54 AM

  • How to keep figures at the top of the page.

    Hi there
    I have three figures which I have draw with Drawing tools.
    The first figure I want to keep always in the middle of my first page.
    Second figure I want to keep always on the top of my second page.
    Third figure I want to keep always on to of my third page.
    There position should not change even if I add few more paragraphs just before my first figure. How do I say OpenOfifice to keep the figure in place for me? I can do that in Latex. However, I am newbee in OpenOfifice .

    My previous post is regarding OpenOffice Writer

Maybe you are looking for

  • Sapgui scripting - export report to Excel then return to sap

    I am new to SAP and my company has just updated to 4.7. I can export a report to MS Excel as spreadsheet, run a excel macro on the spreadsheet in excel, save the excel workbook in a local directory, then close & exit excel. However, I can not get the

  • I want to edit photos on ipad, put in a folder and expert that edited folder to a pcdfolder

    I want to edit my photos on ipad, put in a folder and export that edited folder to PC. I find that the experted photos are reverting to the original unedited - VERY annoying! Any suggestions?

  • Align Image and Text Problem

    I have DW CS4 and Windows XP with plenty of memory and have used this method before to align text with an image.  I insert the image on the page and then type in the text beside the image that I want.  If the text is long, then the second line of tex

  • How to copy adobe forms

    please explain the purpose of copying the adobe forms in SFP WA_LB_VERS2 WA_SCHEINVERS1 WA_SCHEINVERS2 WESCHEINVERS1 WESCHEINVERS2 WE_FERT_VERS1 WE_FERT_VERS2

  • Failed to install the new preview build, please try again later. 0x80070003

    I am currently running build 9841. When I try to install the new preview build I get the following error Failed to install the new preview build, please try again later.  0x80070003 I have installed all updates and I am a full administrator of this m