Close an external swf which is part of an array

Hi.
Noob and having to learn all this pretty quick.. So thanks for any help you can give me.
Here's the basics - Flash cs4 and as3.
I'm making an app which is, at the moment, a game.
I have an animation on the maintimeline - this (at the momoent - until I make it functional) animates through the menu selection to the games menu.. All fine.
I then have placed an empty MC on the stage which will contain all the games. So I click the first game - Flash then selects from 5 possible versions (3 in the code at the mo) and it plays on top of the menu - with a master menu at the bottom of the page.
The game loads fine, the random loading works fine - I just can't get rid of the imported SWF.  I've tried a multitude of ways and codes from the internet - had to give up in the end yesterday and so am starting with fresh hope today
I think, the ideal scenario, for me, is to have each SWF that imports - to switch itself off at the end of the game - last frame and disappear. I know it is possible - I'm pretty sure, back in the day in AS2, it was as simple as close.this (or something like that)
thanks
    stop();
    bee.addEventListener(MouseEvent.CLICK, Click);
function Click( event:MouseEvent):void {
    gotoAndPlay(currentFrame+1);
bee.addEventListener(MouseEvent.CLICK,f);
function f(e:Event):void{
var movieArray:Array = ["howmanybees1", "howmanybees2", "howmanybees3",];
var loader:Loader = new Loader();
var index:int = movieArray.length * Math.random();
var url:String = movieArray[index] + '.swf';
trace("Attempting to load", url);
loader.load(new URLRequest(url));    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);
addChild(loader);
function loaderComplete(e:Event):void {    
    trace("Successfully loaded", url);
    } function loaderIOError(e:IOErrorEvent):void {    
    trace("Failed to load", url);   

Thanks Ned.
I have tried - which essentially means - I've been stalking forums - copying code and trying to shoehorn it in to my game.. I guess my real problem not understanding code enough yet to be able to use it with my set up.
I've tried to dispatch an event from the ext swf on the last frame and have the main swf hear the call - but I can't get it to work - most likely because I am putting the code in the wrong place??

Similar Messages

  • Unable to unload external swf which is using runtime sharing

    Unable to unload external swf which is using runtime sharing of some symbols and classes.
    Due to this problem i am unable to load another swf or the same for the second time and getting errors at runtime.
    It works fine when the swf is opened in IE.
    Can anyone please help me in solving the issue.

    thank you
    i have tried to use   this.parent.Click_To_Close  but it gives compilation error
    i checked the tutorial about custom events i think its little complex for me now to understand the typeriter app.
    also i cheked the similer thread and tried to test that code myself..i found that the last block of main movie does not works and does not unload the loader2. however  all the trace are showing in the output windows that i added to check the code but last trace from the main movie is not showig...   
    trace("child removed from Main Movie") 
    so if this can work somehow i will use this method of event dispatch in my application that i am working...
    Thank you
    -----main movie ---------
    var loader1:Loader = new Loader();
    var loader2:Loader = new Loader();
    loader1.contentLoaderInfo.addEventListener(Event.COMPLETE, assignMovie1Listener);
    loader1.load(new URLRequest("movie_1.swf"));
    loader2.load(new URLRequest("movie_2.swf"));
    addChild(loader1);
    addChild(loader2);
    function assignMovie1Listener(evt:Event):void {
          MovieClip(evt.currentTarget.content).addEventListener("eventTriggered", removeLoader2);
                trace("listner is listning..")
    function removeLoader2(evt:Event):void {
          loader2.unloadAndStop();
          removeChild(loader2);
             loader2 = null;
                trace("child removed from Main Movie")
    //------------- movie_1.swf code:
    removeMovie2_btn.addEventListener(MouseEvent.CLICK , removeMovie2);
    function removeMovie2(event:MouseEvent):void
          dispatchEvent(new Event("eventTriggered"));
                trace("event triggered form Child Movie-1");
    as u can see when i click close button its triggering the trace from movie-1 but its not unloadign the movie2

  • Looping external swf which has no .fla

    Hi!
    What I have is a sliding menu with buttons - each button calls an external swf - which plays in an empty movie clip.
    Now, I want the current loaded swf to loop till the time the user clicks on another button. The problem is, I do not have the fla files for any of the external swfs (these are screencam recordings using a software that does not publish .fla) - so I can't put a code at the end of each external swf asking it to not stop.
    Any suggestions on how I might be able to have the external swf loop?
    Thanks & Regards,
    ~ Raven

    Thanks for your help Ned. Actually, I did manage to decompile the swf (using a 3rd party software) - yes, it is a movieclip on frame 1. I could even go inside it and place the loop code. But decompiling meant loss of the control bar that the screen capture software put in it and I can't compromise on that. I guess the screen capture guys should've chosen another softwares that publishes the .fla.
    Thanks again and regards,
    ~ Raven

  • Unable to load external swf which has runtime sharing with another swf.

    Hi,
    I am getting issues on loading external swf say "importer.swf" file into another swf file say "loader.swf" for second time like
    ReferenceError: Error #1065: Variable testSymbol is not defined. VerifyError: Error #1014: Class testClass could not be found.
    at global$init()
    In the external swf "importer.swf", i am trying to import the symbol "testSymbol" from another swf file say "exporter.swf", which exports through runtime sharing option for the symbols.
    I am having some buttons in loader.swf file and on each button click i am loading different swf files into the loader.swf after unloading the previous one.
    I am able to load and unload different swf files but unable to load the importer.swf file which is sharing symbols from external swf and that too for the second time i.e., when i click the button twice.
    When trying to debug with flash debugger, all the other swf files are being unloaded before loading of another swf but the swf which is sharing symbols/classes with another swf is not getting unloaded.
    Output when i am trying to load two files example and importer files into loader.swf file on two different button clicks. On first button click example.swf is loaded. On second button click , example.swf is unloaded and importer.swf is loaded which is successful. On first button click again importer.swf is unloaded and example.swf is loaded. On second button click again, example.swf is unloaded and importer.swf is loaded, here i am getting issues shown above.
    Attemping to launch and connect to Player using URL D:\runtime issue\loader.swf
    [SWF] D:\runtime issue\ loader.swf - 8181 bytes after decompression
    [SWF] D:\runtime issue\example.swf - 441708 bytes after decompression
    [UnloadSWF] D:\runtime issue\example.swf
    [SWF] D:\runtime issue\importer.swf - 1920 bytes after decompression
    [SWF] D:\runtime issue\importer.swf - 441708 bytes after decompression
    [SWF] D:\runtime issue\ example.swf - 441708 bytes after decompression
    [UnloadSWF] D:\runtime issue\ example.swf
    [SWF] D:\runtime issue\importer.swf - 1920 bytes after decompression
    ReferenceError: Error #1065: Variable xxxxxx is not defined.
    Debug session terminated.
    Code i am using
    b1.addEventListener(MouseEvent.CLICK, b1Clicked);
    b2.addEventListener(MouseEvent.CLICK, b2Clicked);
    var ldr:Loader;
    function b2Clicked(e:MouseEvent)
        if(ldr != null)
            ldr.unloadAndStop(true);
        ldr = new Loader();
        ldr.load(new URLRequest("importer.swf"));
        addChild(ldr);
    function b1Clicked(e:MouseEvent)
        if(ldr != null)
            ldr.unloadAndStop(true);
        ldr = new Loader();
        ldr.load(new URLRequest("example.swf"));
        addChild(ldr);
    If i try to open the swf using IE, i am not getting any issues at all. But i need to open this loader.swf in a air application. Also when i use loaderContext for the loader instance i am able to get rid of this issue but i cant use it in my application.
    So, please help me in resolving this issue.
    Thanks

    I got my answer. I had to append the photo url to the 'movie' value of the javascript embed method. Like this:
    <script language="JavaScript" type="text/javascript">
       AC_FL_RunContent(
          'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
          'width', '550',
          'height', '400',
          'src', 'lesson2',
          'quality', 'high',
          'pluginspage', 'http://www.adobe.com/go/getflashplayer',
          'align', 'middle',
          'play', 'true',
          'loop', 'true',
          'scale', 'showall',
          'wmode', 'window',
          'devicefont', 'false',
          'id', 'lesson2',
          'bgcolor', '#ffffff',
          'name', 'lesson2',
          'menu', 'true',
          'allowFullScreen', 'false',
          'allowScriptAccess','always',
          'movie', 'lesson2?photo=http://www.flash-mx.com/images/image1.jpg',
          'salign', ''
          ); //end AC code
    </script>
    Thanks,
    srb.

  • PrintJob unable to print my external swf which created from a pdf.

    Hi Everybody,
    We developed a tool which split pdf's uploaded by user into single page and convert each single page into swf. We used swftools to convert pdf to swf.
    after converting swf files we show each swf as a single page to user, where user can add more colors, clip arts, text, images to it and later we can take print out, for testing we will print the final output as pdf.
    Most of the times everything is working fine, but when pdf page have many layers, we are able to convert into swf successfully, but while printing some layers (mainly images) are missing in final print. We tried converting pdf to AVM1 swf and AVM2 swf files, in both cases the result is same. Did anybody have idea about this issue?
    Regards
    Vikram

    Hi Karthik,
    Please check below
    You can view Log files on 14 hive folder <System Root>:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS . Use the ULS Logviewer tool to eficiently view the Log files http://ulsviewer.codeplex.com/.
    Search for Log file with the viewer or check the latest file with time provided by Error page. That will show exact issues.
    or
    BCS supports null columns, but make sure the column is set to IsNullable in the db schema.
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Unloading a loaded external SWF with a close button on the external SWF to unload

    I have found some discussion on this topic but I am still having trouble getting it to work and was hoping to get some help here.
    Here I have a file: http://www.dril-quip.com/test/main.swf
    I have: main.swf (a menu) and I have module.swf (content)
    If you navigate to Subsea Wellhead Systems/SS-15 BigBore II and click on that I have it load an external swf which covers most of the parent.
    So far so good. My problem is unloading the loaded 'Child' swf with the button provided on the loaded 'Child' swf.
    below is the code I used to load the file but I cant, for the life of me, find a way to unload it.
    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
    function bigborecontent(event:MouseEvent):void{
    var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
    bigboreLoader.load(bigboreRequest);
    stage.addChild(bigboreLoader);
    I am certain it requires the Child to communicate with the parent somehow but I am at a loss. If I could get a bit of advice or a link to something deal with this, it would be a big help. I just need to have my links load my modules and the remove them when the close buttong is hit on the loaded swf. I promise I have done searches and I admit I have found asnwers but still they are not working. I found the code below:
    Main FLA:
    function removeF() {
    removeChild(bigboreLoader);
    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener(MouseEvent.MOUSE_UP, bigborecontent);
    function bigborecontent(event:MouseEvent):void{
    var bigboreRequest:URLRequest = new URLRequest("moduletemplate.swf");
    bigboreLoader.load(bigboreRequest);
    stage.addChild(bigboreLoader);
    EXTERNAL FLA:
    btnClose2.addEventListener(MouseEvent.CLICK, bigborecontent);
    function bigborecontent(myevent:MouseEvent):void {
    MovieClip(parent.parent).removeF();
    I think I have a misunderstanding of the code. Thanks for any help you might be able to provide.

    This was the original code I got:
    Main FLA: (on AS layer inside DropDownButton Movie Object)
    function removeF() {
    removeChild(myLoader);
    var myLoader:Loader=new Loader ();
    page1_mc.addEventListener(MouseEvent.CLICK, page1content);
    function page1content(myevent:MouseEvent):void {
    var myURL:URLRequest=new URLRequest("page1.swf");
    myLoader.load(myURL);
    addChild(myLoader);
    EXTERNAL FLA: (on main time line of this file)
    close_mc.addEventListener(MouseEvent.CLICK, closeMC);
    function closeMC(myevent:MouseEvent):void {
    MovieClip(parent.parent).removeF();
    Main.FLA
    myLoader=bigboreLoader (my new loader)
    page1_mc=btnbb2 (the button who event will call external swf)
    page1content = bigborecontent (name given to SWF being loaded???)
    myURL=bigboreRequest (my new URLrequest for bigbore)
    page1.swf=moduletemplate.swf (actual address of what I am loading)
    External.FLA
    close_mc=button that will close external swf
    closeMC=movie clip to close?

  • How do I load an external swf at a frame after ClickToGoToAndStopAtFrame?

    Hi, I'm quite new in working with AS3.
    I am designing a site with a menupage with buttons.
    Some of these buttons are linked to a frame that contains an external swf, which is a portfolio.
    By pressing the buttons 'AQUAREL" and "OLIEVERF" you will go to another frame and the swf-portfolio shows up.
    Now the problem is: sometimes it seems to work, sometimes it doesn't.
    You can check out yourself at www.erwinvanzijl.nl
    Is there a better whay of programming these functions?
    Am I doing something wrong or is there a better way to do it?
    This is the actionscript that I put on the second frame where the swf is to show up:
    stop();
    var Xpos_2:Number = 52;
    var Ypos_2:Number = 59;
    var swf_2:MovieClip;
    var loader_2:Loader = new Loader();
    var SWF_2:URLRequest = new URLRequest("aquaportfolio.swf");
    loader.load(SWF_2);
    loader.x = Xpos;
    loader.y = Ypos;
    addChild(loader);
    btn_menu.addEventListener(MouseEvent.CLICK, unloadcontent_2);
    function unloadcontent_2(event:MouseEvent):void {
    removeChild(loader);
    gotoAndStop("menu");

    For the unloading it is a simple matter of...
    function unloadcontent_2(event:MouseEvent):void {
       loader.unload();
       removeChild(loader);
       gotoAndStop("menu");
    Follow what Dave has to say... he's far more experienced than I.  I was too hung up wondering what swf2 was all about to ntoice there were two loaders involved in the code.

  • External swf and the tween class

    i have an external swf which i import into my main swf using
    the loadMovie command. my external swf has some tween class
    animations in it. if i run the main movie, the external swf movie
    runs fine of course...but the tween classes are not loaded. am i
    missing somthing?
    here is the code from the external swf file which is applied
    to a clickable movie clip of course.
    this.onRollOver = function() {
    rewind = false;
    play();
    var squaretween = new mx.transitions.Tween(previewthumb,
    "_xscale", mx.transitions.easing.Elastic.easeOut, 0, 1200, .5,
    true);
    var squaretween = new mx.transitions.Tween(previewthumb,
    "_yscale", mx.transitions.easing.Elastic.easeOut, 0, 1200, .5,
    true);
    squaretween.onMotionFinished = function() {
    loadMovie("hotairlarge.swf",
    "_root.homecontainer.printworkcontainer");
    any help would be great!

    try inserting the following to line 1,frame 1 your main swf:

  • XML TREE calling external .swf

    Thanks to some research and the help from you guys, I am
    getting the hand of
    this XML tree business for Flash 8.
    Now, my question to you is this:
    How can I create a clickable link for (let's say) my nome
    Fornecedor 1.
    I would like to click on this link and call an external .swf,
    which I would
    load into an empty MC.
    Thanks again!
    <node label="Comercio e Servicos">
    <node label="Materiais Basicos">
    <node label="areia">
    <node label="SP">
    <node label="Fina">
    <node label="Fornecedor 1" /> //
    THIS WOULD BE THE CLICKABLE ITEM to call an external swf.
    <node label="Fornecedor 2" />
    </node>
    <node label="Media">
    <node label="Fornecedor 1" />
    <node label="Fornecedor 2" />
    </node>
    <node label="Grossa">
    <node label="Fornecedor 1" />
    <node label="Fornecedor 2" />
    </node>
    </node>

    To sum up:
    Clicking on a <node label> to call an external .swf
    "Sergiomon" <[email protected]> escreveu na
    mensagem
    news:eli0tj$aqd$[email protected]..
    > Thanks to some research and the help from you guys, I am
    getting the hand
    > of this XML tree business for Flash 8.
    >
    > Now, my question to you is this:
    >
    > How can I create a clickable link for (let's say) my
    nome Fornecedor 1.
    > I would like to click on this link and call an external
    .swf, which I
    > would load into an empty MC.
    >
    > Thanks again!
    >
    >
    >
    > <node label="Comercio e Servicos">
    > <node label="Materiais Basicos">
    > <node label="areia">
    > <node label="SP">
    > <node label="Fina">
    > <node label="Fornecedor 1" /> //
    > THIS WOULD BE THE CLICKABLE ITEM to call an external
    swf.
    > <node label="Fornecedor 2" />
    > </node>
    > <node label="Media">
    > <node label="Fornecedor 1" />
    > <node label="Fornecedor 2" />
    > </node>
    > <node label="Grossa">
    > <node label="Fornecedor 1" />
    > <node label="Fornecedor 2" />
    > </node>
    > </node>
    >

  • Loading External swf - different versions

    This must be an easy question that I thought I knew the
    answer to. I recently made a series of games that required parsing
    an XML document which provided the paths to various external swfs.
    The UI and the external swfs were all exported as Flash 7 movies.
    However, for a variety of reasons, it was necessary to update the
    UI to Flash 8. I made updates, tested in Flash and all was dandy.
    However, testing in a browser / the stand alone player and the
    external movies did not load. Pure and simple. I tried a whole host
    of things until i finally re-exported the external swfs (which had
    remained untouched) and suddenly it works. Long story short, can a
    movie exported as a later version of Flash not load movies that
    were exproted in a previous version? This doesn't seem right. I
    knew the reverse was true and made sense, but this seems crazy
    especially since testing the files in Flash itself works.

    interesting point. The only thing I could think of is any
    "init" code from flash 7 might have been depreciated that you are
    using and not supported in 8.

  • [ISSUE] Load external .swf into an AIR for iOS app

    I want to load an external .swf which is included theme objects of the application. The loader class finishes loading but after this when I try to get objects in the swf I get this error.
    Device is iPad v.2 iOS v5.1.
    ReferenceError: Error #1065: Variable MenuHome is not defined.
        at adaptive.controls.thememanager::ApplyTheme/applyStyle()[D:\ConsumerProductInterface\Consu merProductBusiness\src\adaptive\controls\thememanager\ApplyTheme.as:41]
        at adaptive.controls.thememanager::ApplyTheme/apply()[D:\ConsumerProductInterface\ConsumerPr oductBusiness\src\adaptive\controls\thememanager\ApplyTheme.as:54]
        at adaptive.controls.thememanager::ThemeManagerSystem/checkIfAllLoaded()[D:\ConsumerProductI nterface\ConsumerProductBusiness\src\adaptive\controls\thememanager\ThemeManagerSystem.as: 139]
        at adaptive.controls.thememanager::ThemeManagerSystem/backgroundImageLoadHandler()[D:\Consum erProductInterface\ConsumerProductBusiness\src\adaptive\controls\thememanager\ThemeManager System.as:119]
        at adaptive.controls.thememanager::ThemeManagerSystem/backgroundImageLoadHandler()
        at flash.events::EventDispatcher/dispatchEvent()
        at adaptive.controls.thememanager::ThemeManagerImageLoader/loadImageCompleteHandler()[D:\Con sumerProductInterface\ConsumerProductBusiness\src\adaptive\controls\thememanager\ThemeMana gerImageLoader.as:60]
        at adaptive.controls.thememanager::ThemeManagerImageLoader/loadImageCompleteHandler()
        at flash.events::EventDispatcher/dispatchEvent()
        at adaptive.controls.imageloader::ImageLoader/imageCompleteHandler()[D:\ConsumerProductInter face\ConsumerProductControls\src\adaptive\controls\imageloader\ImageLoader.as:32]
        at adaptive.controls.imageloader::ImageLoader/imageCompleteHandler()
    Steps are:
    1- Create a .fla file and one object in it (like below):
    2- In Flash Builder 4.6
    Load the external swf:
                    var swfLoader:Loader = new Loader();
                    var url:URLRequest = new URLRequest("themes/DefaultTheme/DefaultTheme.swf");
                    var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
                    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
                    swfLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
                    swfLoader.load(url, loaderContext);
            private function completeHandler(event:Event):void
                var evt:LoadThemeSWFEvent = new LoadThemeSWFEvent(LoadThemeSWFEvent.COMPLETE);
                if (AdaptiveHelper.getInstance().platform == PlatformType.DESKTOP)
                    evt.swfLoader = SWFLoader(event.currentTarget);
                else
                    evt.loader = Loader(event.currentTarget.loader)
                dispatchEvent(evt);
              // load is OK
            private function ioErrorHandler(event:IOErrorEvent):void
    After load is complete I tried to get the object from the swf file and use it as a skin class of a button.
    cssSelector.setStyle(property, Class(content.loaderInfo.applicationDomain.getDefinition("MainMenu")));
    I am stuck here. Any ideas what the problem is?
    My Best,
    Suat

    Hi Suat,
    Can you send me a sample application  @[email protected] with which I can reproduce your problem and can look into the issue?
    Thanks,
    Nimisha

  • External swf in powerpoint communicating with eternal xml

    Hi there,
    I have a powerpoint presentation where I've put a shockwave object with an URL to an external swf, which is infact an application form and is storing data to XML in the same location as swf. Now this functionality works fine in a browser, but now if you imagine that I use powerpoint as a browser and apply the form from there it just doesn't get to the XML on the server.
    Are there any security restrictions in powerpoint that don't let data flow from external swf opened in powerpoint ? Is it possible to overcome it ?

    you are right the blue thinguy is in fact a bouton in my swf.
    i'm still kindof lost tho, i don't quite understand what you means by "move the loader" sorry i'm still a noob at flash and speaking english doesnt help.
    here's the full source files with everything if you have time to take a look, it might be easier than pasting chunk of code
    source files

  • How to unload externally loaded swf which contains 3D Carousel?

    Hello to all
    I am learning AS3 and have been taking on various tutorials found on the net. While learning about AS3 I came across a lesson on http://tutorials.flashmymind.com/2009/05/vertical-3d-carousel-with-actionscript-3-and-xml/ titled "Vertical 3D Carousel with AS3 and XML".
    I completed the tutorial and all worked fine so I then wanted to load the swf into a existing project. The loading of the swf goes fine and when I unload my loader it is removed but only visually as in my output panel in flash CS5 I get an error as follows
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at carousel_c_fla::MainTimeline/moveCarousel()
    this error repeats over and over again slowing my swf movie.
    So does this mean my main flash movie trying to still play / find my unloaded 3D Carousel?
    If so how do I unload remove all the AS3 that is trying to run from the 3D Carousel?
    I have included the AS3 below from the tutorial page and I understand that this is what I have to remove to "break free" from the 3D Carousel swf when it is unloaded. This is where I am stuck as my knowledge of AS3 is limited - Can you guys / girls help?
    //Import TweenMax
    import com.greensock.*;
    //The path to the XML file (use your own here)
    // old var from tutorial - var xmlPath:String = "http://tutorials.flashmymind.com/XML/carousel-menu.xml";
    var xmlPath:String = "carousel-menu.xml";
    //We'll store the loaded XML to this variable
    var xml:XML;
    //Create a loader and load the XML. Call the function "xmlLoaded" when done.
    var loader = new URLLoader();
    loader.load(new URLRequest(xmlPath));
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    //This function is called when the XML file is loaded
    function xmlLoaded(e:Event):void {
         //Make sure that we are not working with a null variable
         if ((e.target as URLLoader) != null ) {
              //Create a new XML object with the loaded XML data
              xml = new XML(loader.data);
              //Call the function that creates the menu
              createMenu();
    //We need to know how many items we have on the stage
    var numberOfItems:uint = 0;
    //This array will contain all the menu items
    var menuItems:Array = new Array();
    //Set the focal length
    var focalLength:Number = 350;
    //Set the vanishing point
    var vanishingPointX:Number = stage.stageWidth / 2;
    var vanishingPointY:Number = stage.stageHeight / 2;
    //We calculate the angleSpeed in the ENTER_FRAME listener
    var angleSpeed:Number = 0;
    //Radius of the circle
    var radius:Number = 128;
    //This function creates the menu
    function createMenu():void {
         //Get the number of menu items we will have
         numberOfItems = xml.items.item.length();
         //Calculate the angle difference between the menu items (in radians)
         var angleDifference:Number = Math.PI * (360 / numberOfItems) / 180;
         //We use a counter so we know how many menu items have been created
         var count:uint = 0;
         //Loop through all the <button></button> nodes in the XML
         for each (var item:XML in xml.items.item) {
              //Create a new menu item
              var menuItem:MenuItem = new MenuItem();
              //Calculate the starting angle for the menu item
              var startingAngle:Number = angleDifference * count;
              //Set a "currentAngle" attribute for the menu item
              menuItem.currentAngle = startingAngle;
              //Position the menu item
              menuItem.xpos3D = 0;
              menuItem.ypos3D = radius * Math.sin(startingAngle);
              menuItem.zpos3D = radius * Math.cos(startingAngle);
              //Calculate the scale ratio for the menu item (the further the item -> the smaller the scale ratio)
              var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
              //Scale the menu item according to the scale ratio
              menuItem.scaleX = menuItem.scaleY = scaleRatio;
              //Position the menu item to the stage (from 3D to 2D coordinates)
              menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;
              menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;
              //Add a text to the menu item
              menuItem.menuText.text = item.label;
              //Add a "linkTo" variable for the URL
              menuItem.linkTo = item.linkTo;
              //We don't want the text field to catch mouse events
              menuItem.mouseChildren = false;
              //Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item
              menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
              menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
              menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
              //Add the menu item to the menu items array
              menuItems.push(menuItem);
              //Add the menu item to the stage
              addChild(menuItem);
              //Assign an initial alpha
              menuItem.alpha = 0.3;
              //Add some blur to the item
              TweenMax.to(menuItem,0, {blurFilter:{blurX:1, blurY:1}});
              //Update the count
              count++;
    //Add an ENTER_FRAME listener for the animation
    addEventListener(Event.ENTER_FRAME, moveCarousel);
    //This function is called in each frame
    function moveCarousel(e:Event):void {
         //Calculate the angle speed according to mouseY position
         angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;
         //Loop through the menu items
         for (var i:uint = 0; i < menuItems.length; i++) {
              //Store the menu item to a local variable
              var menuItem:MenuItem = menuItems[i] as MenuItem;
              //Update the current angle of the item
              menuItem.currentAngle += angleSpeed;
              //Calculate a scale ratio
              var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
              //Scale the item according to the scale ratio
              menuItem.scaleX=menuItem.scaleY=scaleRatio;
              //Set new 3D coordinates
              menuItem.xpos3D=0;
              menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);
              menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);
              //Update the item's coordinates.
              menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;
              menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;
         //Call the function that sorts the items so they overlap each other correctly
         sortZ();
    //This function sorts the items so they overlap each other correctly
    function sortZ():void {
         //Sort the array so that the item which has the highest
         //z position (= furthest away) is first in the array
         menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
         //Set new child indexes for the item
         for (var i:uint = 0; i < menuItems.length; i++) {
              setChildIndex(menuItems[i], i);
    //This function is called when a mouse is over an item
    function mouseOverItem(e:Event):void {
         //Tween the item's properties
         TweenMax.to(e.target, 0.1, {alpha: 1, glowFilter:{color:0xffffff, alpha:1, blurX:60, blurY:60},blurFilter:{blurX:0, blurY:0}});
    //This function is called when a mouse is out of an item
    function mouseOutItem(e:Event):void {
         //Tween the item's properties
         TweenMax.to(e.target, 1, {alpha: 0.3, glowFilter:{color:0xffffff, alpha:1, blurX:0, blurY:0},blurFilter:{blurX:1, blurY:1}});
    //This function is called when an item is clicked
    function itemClicked(e:Event):void {
         //Navigate to the URL that's assigned to the menu item
         var urlRequest:URLRequest=new URLRequest(e.target.linkTo);
         navigateToURL(urlRequest);

    Hi Ned thanks for the reply,
    Ok so I have a button in my main movie that loads the external swf
    stop();
    var my_loader:Loader = new Loader();
    var my_btn:Button = new Button();
    var my_pb:ProgressBar = new ProgressBar();
    my_pb.source = my_loader.contentLoaderInfo;
    my_btn.addEventListener(MouseEvent.CLICK,startLoading);
    function startLoading(e:MouseEvent):void{
    my_loader.load(new URLRequest("carousel.swf"));
    addChild(my_pb);
    my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishloading);
    function finishloading(e:Event):void{
    addChild(my_loader);
    my_loader.addEventListener("killMe",
    killLoadedClip);
    removeChild(my_pb);
    function killLoadedClip(e:Event):void {
    my_loader.removeEventListener("killMe",
    killLoadedClip);
    my_loader.unloadAndStop();
    removeChild(my_loader);
    Then I have a button in my loaded swf that closes the loader
    This is spread over 2 frames
    Frame1
    function closeIt(e:MouseEvent):void {
    parent.dispatchEvent(newEvent("killMe"));
    Frame 2
    back_btn.addEventListener(MouseEvent.CLICK, closeIt);
    Frame 2 also holds all the code for the carousel
    Thanks for your time and help in advance people ; )

  • Is this possible - Import Flash swf which then imports an external swf

    Hi,
    I was wondering if it's possible to (as the title says) to import an swf which itself imports an external swf?
    Explanation - I've got an scrollbar created in flash...and to keep it tidy i've created the scroll 'content' as another swf which is imported into  the scrollbar swf.
    Whenever i publish/render the project the scroll bar appears but the content does not.
    Is it possible to do this?
    Captivate > imports flash > which imports external swf
    Cheers
    Craig.

    Yes that shouldn't be a problem at all. You probably won't be able to see it working when you preview the project from within Captivate but if you publish it and manually copy/paste the external swf to the publish directory, it should work just fine.
    www.cpguru.com - Adobe Captivate Widgets, Tutorials, Tips and Tricks and much more..

  • Get external swf width height

    Hi,
    I'm am trying to load an external swf file using a different swf that is on a different domain. I have noticed that it is possible to use addChild on the external swf, but when I try to get its contents width and height using contentLoaderInfo I get a security sandbox error.
    It seems it is possible to fix it by using  Security.allowDomain("*") and Security.allowInsecureDomain("*") in the external file.
    And now it's get tricky, the external swf file is a file that users upload to my site so I don't have control on the code so I can't add the "allowDomain" part.
    The second swf (the host file that loads the external file) is a file that I let others to embed on their site.
    The intresting thing is that when I share the host swf on facebook there is no problem, and I don't even need to add the code for "allowDomain" on the external file.
    I it makes a different, I use HTTPS protocol to access to the external swf.
    I tried to load the crossdomain.xml file, but it didn't help.
    What can I do? the only data I need to get on the external swf is its width and height to scale it to the host file.
    Thank you

    Thank you.
    Now it looks i am getting close but not exacly there.
    Everytime I get near something else doesn't work properly.
    Now I get the dimension after two things:
    I added 'secure="false"' to the https' crossdomain and added LoaderContext to when I load the external event:
    context.securityDomain = SecurityDomain.currentDomain;
    context.checkPolicyFile = true;
    Now you probably ask what's the problem.
    well I have no idea why, but it looks like the external swf file I load (which is as2, but I still didn't check if it matters) keeps on jumping between its first frame and second frame ( The swf has two frames). If you having hard time to imaging what I mean, lets  say this jumping between frames is really not recommended for people with Epilepsy.
    It has a stop() action, but sadly the player doesn't care.
    let me remind you that if I only addChild the Loader (without the context)  it looks fine, but I need the width and height to resize the swf.
    anyone knows what can cause this?
    and thx again martinjamesroberts1 for the link, it put me on the right track.

Maybe you are looking for

  • Trying to add a new calendar to Mountain Lion iCal

    I have two Macs using 10.6.8 and if I add a calendar to iCal on either Mac I have the choice of adding a calendar (or Calendar Group) "On My Mac" or in my "CalDev Calendars".  I do have most of my calendars syncing via CalDev to my server.  When I go

  • How to install manually the specific drivers o keyboard in windows 7 well?

    After install Windows 7 all work ok, but the some keys os my keyboard do not wor, @, volume + or - the brightness etc etc, onli work the letters. how can i do for install the specific keyboard driver? thanq´s all for anwser

  • XI system down due to file generation in file System

    Hi All, We are facing one issue in our XI Prod system. Messages will get sturck in inbound queue as system is frequently getting stoped due to insufficient space in the FileSystems . This is happening due to generation of files heapdump.phd and javac

  • Change Background color of Logon page

    Hi all,     I need to change the background color of Logon page of portal. I have searched the forums & tried many ways, but in vain. I have changed the BGcolor attribute tag of umlogontoparea.txt. It doesn't reflect. Don't know where am I going wron

  • How do you fix a phantom podcast episode that won't go away on AppleTV?

    Anybody encounter this or have any suggestions on how to fix this? In a nutshell ... On my MacBook Pro I am subscribed to many podcasts, one of which is GFW Radio. This MacBook Pro syncs with my AppleTV, so all podcasts are on the AppleTV. My podcast