"Detecting" a variable from an externally-loaded SWF via SWFLoader

I load an external SWF file from a click event.  Then, when the interactions has reached the end of the presentation, we'd like it to unload itself, and go into another state.
Is that possible?  ( actually transformed the SWF into a component using Flash Builder 4 hoping that would be easier to detect variables and events)
Thanks,
Doug

It is possible, but you'll have to wire up the communications between the
SWFs

Similar Messages

  • Passing events from externally-loaded SWFs

    Hi,
    We have an externally-loaded swf that acts as a kind-of-a slide show.  After a user selects a particular subject from a mxml-based "menu" application, they push "buttons" in the SWF to go through a presentation, then on the last frame of the swf, I'd like to unload the swf and replace it with another "mxml" application.  How can this be done?  I have not tried to pass/capture events "up" from an externally-loaded swf before.
    Thanks,
    Doug

    Do you own those SWFs?  If so, they should dispatch an event from a known
    place like a SlideShowManager or something like that.
    Other folks "cheat" and bubble events or dispatch off of the systemManager
    and/or top-level application.

  • Setting External Loaded SWF dimension

    hi guys...,
    i'll be straight to point,well i'm now working on a project using action  script 3 now what i'm trying to make is a Main SWF that load whatever  other swf into it the tricky thing is that i used 1 xml document read  the external swf source and it's setting(such as it's x,y position and  it's width and height) and i'm having problem setting the loaded swf width and  height btw it's an desktop application and not a website application.,
    here is my code:
    //variable list
    var swfList:XMLList; //hold all the zone list from the xml
    var totalZone:uint; //total of zone there is in the xml
    var myURLLoader:URLLoader = new URLLoader();
    var swf:Movie Clip;//hold the loaded swf
    var swfLoader:Loader = new Loader();//loader instance used to load the external swf
    var myCounter:uint = 0;
    //load the xml file
    myURLLoader.load(new URLRequest('myXMLFile.xml'));
    myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
    function processXML(e:Event):void
        removeEventListener(Event.COMPLETE, processXML);
        XML.ignoreWhitespace= true;
        var myXML:XML = new XML(e.target.data);
        swfList = myXML.SWF;
        totalSWF = myXML.SWF.length();
        loadSWF();
    function loadSWF():void
        swfLoader.contentLoaderInfo.addEventListener(Event.INIT, swfSetting);
        swfLoader.load(new URLRequest(swfList[myCounter].@source));
    function swfSetting(e:Event):void
        //making new instance of sprite to hold the new loaded swf
        swf = new MovieClip();
        //casting the loader content into a movieclip
        swf = e.target.content;
        addChild(swf);
        swfLoader.unload();
        swf.x = swfList[myCounter].@left;
        swf.y = swfList[myCounter].@top;
        swf.width= swfList[myCounter].@width;
        swf.height= swfList[myCounter].@height;
        addChild(swf);
        if(myCounter < totalSWF)
            myCounter++;
            trace('myCounter: ' + myCounter );
            loadSWF();
    and here is what the result ( it make the width and height of the loaded swf to 0):
    swfLoader.contentLoaderInfo.width : 320
    swfLoader.contentLoaderInfo.height : 240
    module: MyVideo/flvplayer.swf
    x:0
    x container:0
    y:0
    y container:0
    xml width:550
    width container:0
    xml height:400
    height container:0
    myCounter: 1
    swfLoader.contentLoaderInfo.width : 550
    swfLoader.contentLoaderInfo.height : 400
    module: AnalogueClock.swf
    x:50
    x container:50
    y:0
    y container:0
    xml width:250
    width container:250
    xml height:200
    height container:200
    myCounter: 2
    swfLoader.contentLoaderInfo.width : 800
    swfLoader.contentLoaderInfo.height : 30
    module: MyNewsticker/newsticker.swf
    x:0
    x container:0
    y:0
    y container:0
    xml width:300
    width container:0
    xml height:50
    height container:0
    most of my loaded swf beside the analouge clock is full action script code and in case of the analouge clock it is a swf that has a movie clip on it's stage (the other are fully created from action script 3.0)
    please do help me..,
    cause i'm already really desperate and going crazy by this problem..,

    sorry i copied the code from the other swf i used to do try and error test..,
    basically the container is the same as swf varibale
    here the code so you would'nt get confused:
    //variable list
    var swfList:XMLList; //hold all the zone list from the xml
    var totalZone:uint; //total of zone there is in the xml
    var myURLLoader:URLLoader = new URLLoader();
    var swf:Movie Clip;//hold the loaded swf
    var swfLoader:Loader = new Loader();//loader instance used to load the external swf
    var myCounter:uint = 0;
    //load the xml file
    myURLLoader.load(new URLRequest('myXMLFile.xml'));
    myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
    function processXML(e:Event):void
        removeEventListener(Event.COMPLETE, processXML);
        XML.ignoreWhitespace= true;
        var myXML:XML = new XML(e.target.data);
        swfList = myXML.SWF;
        totalSWF = myXML.SWF.length();
        loadSWF();
    function loadSWF():void
        swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfSetting);
        swfLoader.load(new URLRequest(swfList[myCounter].@source));
    function swfSetting(e:Event):void
        //making new instance of sprite to hold the new loaded swf
        swf = new MovieClip();
        //casting the loader content into a movieclip
        swf = e.target.content;
        addChild(swf);
        swfLoader.unload();
        swf.x = swfList[myCounter].@left;
        swf.y = swfList[myCounter].@top;
        swf.width= swfList[myCounter].@width;
        swf.height= swfList[myCounter].@height;
        addChild(swf);
        if(myCounter < totalSWF)
            myCounter++;
            trace('myCounter: ' + myCounter );
            loadSWF();
    well in my code i did cast the loader into a movie clip and then set it's width and heigt,right???
    wouldn't it just give me the same result??
    if it's not can u describe what u mean in more detail??
    some example about accessing the loader content would be really appreciated

  • Using the DateField in an Externally loaded SWF

    Hello,
    I have been having major trouble trying to get a basic PHP
    contact form to work within an externally loaded SWF file inside of
    a parent SWF. When I test the movie on its own it seems to work
    fine (example: I'm able to select a date from the DateField
    component). However, when I open up the parent SWF file and call
    the external SWF file with the form the DateField is basically
    unusable (example: when you click on it nothing happens, no
    calendar pops up to select a date).
    I have no ActionScript on it yet, simply because I figure I
    need it to work before I tell it what to do with the PHP file. The
    instance name on the DateField is "theDate". Any help is very much
    appreciated. Thank you.
    Also, I have just successfully used the contact form on the
    web. But, the only user interface components I am able to edit are
    the input text boxes, not the DateField or the ComboBox I have in
    it as well. This is very odd, I was not aware that anything special
    had to be done using these UI components within an external file.
    Elijah

    Hello 2m,
    Maybe if you were to see it, it may help you out a bit. If
    you
    click
    here for the external file you will see that the components are
    working. However, if you
    click
    here for the parent file and then click on "Meetings" on the
    top menu you will see that they do not work at all. However, if
    someone were to hit the "send" button, the PHP code would actually
    interact with the form. Let me know if that helps at all. Thanks
    again for replying.
    Elijah

  • How can I make my external loaded .SWF file smoothly disappear after 15 seconds?

    Hi,
    How can I make my external loaded .SWF file smoothly disappear after 15 seconds? The following is the code to load an external .SWF file:
    var K:Loader=new Loader();
    addChild(K);
    K.load(new URLRequest("clock.swf"));
    K.x = 165;
    K.y = 247;
    K.contentLoaderInfo.addEventListener(Event.INIT, growLoader);
    function growLoader(evt:Event):void {
         K.width = 130;
         K.height = 130;
    I want to make clock.swf file disappear from the page after 15 seconds using some smooth disappear effect.
    Please help.
    Thanks.

    Something even better:
    http://www.greensock.com/
    Check out TimelineMax I LOVE it...
    The guy that made this (and gives it away for free!) is a saint.

  • Dynamic Text in Externally Loaded swf

    hi. i have a dynamic text field in an externally loaded swf. Its a digital clock so i want the numbers to update in the dynamic text field.
    this is not my exact code but it is very similar. i show below that i add the loader.swf, and once its loading is complete, i can work on its movieclips and add event listeners to its buttons, etc. but i cannot change the dynamic text field (its "classic text" set to "dynamic text"). after running this, the text just stays empty as it is in the external swf).
    here is the sample code:
    var loader:Loader = new Loader();
    loader.load(new URLRequest("loader.swf"));
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
    function loaded(event:Event):void{
         addChild(loader);
         var loader_mc:MovieClip = (loader.content as MovieClip)
         loader_mc.myMovieClip.gotoAndStop(2);//***this works
         loader_mc.myButton_btn.addEventListener(MouseEvent.CLICK, clickMe);//***this works
         loader_mc.myText_txt.text = "12";//***this doesn't work******
    please help. thanks!

    Did you embed the font in the textfield--it needs to be done in the loaded swf when you create it? One other thing to check is that the color for the textfield is not the same as the background it sits on.

  • 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 ; )

  • Air 1.0, Externally Loaded SWF Accessing Camera

    Hello.
    I am building a touch screen kiosk Air App using Flash CS3 and Air 1.0.
    I have my application downloading external SWFs for different advertisements, one of which will need access to the webcam built into the kiosk.
    By itself, the advertisement accesses the camera just fine, however Camera.getCamera() returns null when it the SWF loaded into the kiosk app. Both the main kiosk app and the advertisement app are compiled using Air 1.0.
    It appears that I'm getting a security sandbox violation, however I'd like to avoid completely rewriting my app using the sandbox bridge architecture just so one of my ad pieces can access a webcam.
    Does anyone have any suggestions or know of any work-arounds for allowing webcam accesss from within an embedded SWF in Air?
    Would upgrading to CS5 / Air 2.5 help?
    Thanks for any resposes.
    -John Berman

    I was able to find a workaround of the security sandbox using Loader.loadBytes();
    Aleksandar Andreev's Loader class really helped:
    http://blog.aleksandarandreev.com/?p=42

  • Color external loaded swf in AS3 Help Urgent!

    Hi i have loaded swf from an external path using the following command.
    var cviewer:Loader=new Loader();
    var curlRequest:URLRequest=new URLRequest("clipArts/"+evt.target.name);
    So this is the scenario.
    Suppose say i load Movie1.swf
    I have three movie clips inside Movie1.swf called step0, step1, step2
    I need to change the color of step0, step1 and step 2 from the parent flash file which loads movie1. All the inner movie clips color may be different from each other.
    I am able to change the color of the whole movie clip by using
    var colorInfo:ColorTransform = cviewer.transform.colorTransform;
    colorInfo.color=evt.target.selectedColor;
    cviewer.transform.colorTransform=colorInfo;
    But not of individual ones. I even tried cviewer.step0.transform.colortransform and other stuff to see if it would work. But nothing worked. Help at fastest would be deeply appreciated.
    Regards and thanks in advance.

    try:
    var colorInfo:ColorTransform = MovieClip(cviewer.content).step0.transform.colorTransform;
    colorInfo.color=evt.target.selectedColor;
    MovieClip(cviewer.content).step0.transform.colorTransform=colorInfo;

  • Map and externally loaded swf working together

    Here's the setup:
    I have a panoramic viewer, and i'd like to have a map go
    along side it. The panoramas are loaded externally into the player.
    Inside these external swf files are "hotspots" that link to other
    panoramic swf files that load and take the previous swf's place. I
    have all of this set up, and you can see how I did it in my
    previous post:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1274410&enterthread=y
    So now my new question is... how can I have a map with points
    on it, that when you click on a point, it will load a corresponding
    swf file into the player. I believe that part is easy. My big
    problem is if someone clicks on a hotspot in the external swf file
    first, which in turn loads another swf file, and if that person
    goes back to the map, I want the map to change the position of lets
    say, a marker or a pin to indicate the new position on the map that
    correllates to the new external swf that was loaded.
    make sense? Any ideas? I was thinking maybe it would be some
    kind of listener or something so that should a specific swf load,
    it will recognize it and automatically change the location of the
    marker on the map to the point that relates to the loaded swf or
    something...

    Hi Thanks for your reply, I tried with a small AS3 file as
    well and I get the same ERROR.

  • Calling a variable from a external txt file that is equal button name

    Hello
    I have a variable in an external txt file that is = the name
    of my button. I have loaded the file in to flash in an object
    called my_lv.
    How do I make line three in the code valid ?
    _root.map.name1900.onRollOver=function() {
    this._alpha=20;
    txName=my_lv.+(this._name); // this line is wrong!! I need
    to place name1990._name in side the ().

    do you have an object called "my_lv" and a child object have
    named as "name1900" . ie "my_lv.name1900"\
    if i am right then...
    >> txName=my_lv.+(this._name); //
    should be
    txName= eval("my_lv."+ this._name)

  • Trying to call a root level function from within a loaded swf

    I'm not very familiar with AS3... I'm trying to have a loaded swf file call a function from the parent to unload itself when it comes to the end (on the timeline, not as a button). I'm assuming I need to be calling the function (that is used for the close button) from the loaded swf (perhaps I'm mistaken though?).
    Here's the code from one of my buttons that loads an swf. I'm guessing I need to call the closeSWF function from the timeline of my loaded movie but having no luck figuring out how to do that.
    Any help would be appreciated.
    // 01 ------------------------------------------------------
    function loadWeaving(ev:MouseEvent):void {
      // load SWF
      var movieClip:MovieClip = new holder_mc;
      //add it to the stage
      addChild(holderSWF);
      holderSWF.x=0;
      holderSWF.y=0;
      var requestEN:URLRequest = new URLRequest("WhatIsWeaving_Eng.swf"); // english
      holderSWF.load(requestEN);
      close_bt.addEventListener(MouseEvent.CLICK, closeSWF);
      function closeSWF(infoObject:Object):void {
      trace("close SWF");
      removeChild(holderSWF);
      // reset switch
      close_bt.visible = false;
      showAllButtons();
      infoObject.currentTarget.removeEventListener(infoObject.type, closeSWF);
      setChildIndex(close_bt,numChildren - 1);
      close_bt.visible = true;
      hideAllButtons();
      // - start timer last
      myTimer.addEventListener(TimerEvent.TIMER, closeSWF);

    You're exactly right. If you attach an event listener to the Loader before you add it to the stage, you can then use event.currentTarget to refer to the loader. And this is definitely the better way to do it if you're planning to use the loaded swf from multiple places or could ever need to do this in the future.
    So:
    protected function initLoader():void {
         var loader:Loader = new Loader();
         loader.addEventListener('closeMe', closeLoader);
         loader.load(new URLRequest(...));
         addChild(loader);
    protected function closeLoader(e:Event):void {
         var loader:Loader = e.currentTarget as Loader;
         if (loader) {
              loader.unloadAnstop(true);
              loader.removeEventListener('closeMe', closeLoader);
              removeChild(loader);

  • Using a transition on an externally loaded swf

    Hi, I would have no problem doing this the old fashioned way,
    but for some client-requested reason it has to be in AS3. Here's
    what I have:
    var myLoader:Loader = new Loader();
    addChild(myLoader);
    var url:URLRequest = new URLRequest("movie.swf");
    myLoader.load(url);
    //Fade-in 9 seconds
    TransitionManager.start(myLoader, {type:Fade,
    direction:Transition.IN, duration:9, easing:Strong.easeOut});
    Apparantly, myLoader isn't the instance name of the loded
    swf. I have no idea what it is though. Can someone help me? Thanks!

    The loaded swf is at loader.content, but you can only access
    it once the loading has completed and the loader has been added to
    the display list. For example, CODE 1 will not work, but CODE 2
    will.
    //CODE 1
    var myLoader:Loader = new Loader();
    addChild(myLoader);
    myLoader.load(new URLRequest("movie.swf"));
    var loadedSwf:MovieClip = MovieClip(loader.content); //ERROR
    //CODE 2
    var myLoader:Loader = new Loader();
    addChild(myLoader);
    myLoader.load(new URLRequest("movie.swf"));
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    loadCompleted);
    var loadedSwf:MovieClip;
    function loadCompleted(ev:Event):void {
    loadedSwf = MovieClip(loader.content);
    trace(loadedSwf);
    PS. I recommend using the Tweener library for tweening in
    ActionScript. It is much better than the Adobe functions and there
    is a tutorial at:
    http://gotoandlearn.com/player.php?id=45

  • Loading a remote SWF via SWFLoader Issue

    I have a simple flex app which loads an external XML into an
    arrayCollection using HTTPService send method. This works fine as
    both a stand-alone, or when loaded into it's parent as a LOCAL file
    via the SWFLoader tag. However, when I place this child file onto a
    remote server and try to load it into the parent which resides on
    my desktop, the ArrayCollection default resultFormat of the send
    method triggers the following runtime error (listed below). I don't
    think it's a sandbox issue because when I change result format to
    e4x, it works fine remotely. I've been hitting a wall on this for
    days now... Any insight would be greatly appreciated and thanks to
    all in advance!!!
    PARENT SWF (resides on local desktop)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical" initialize="initData()">
    <mx:Script>
    <![CDATA[
    public var baseURL:String;
    public function initSWF(swfURL:String):void {
    remote_swf.load(swfURL);
    public function initData():void
    baseURL = "
    http://blahblahblah";
    Security.allowDomain(baseURL);
    ]]>
    </mx:Script>
    <!-- WORKS when loading child swf LOCALLY -->
    <mx:Button label="Load LOCAL SWF APP"
    click="initSWF('remoteSWF.swf')"/>
    <!-- DOES NOT WORK when loading child swf REMOTELY -->
    <mx:Button label="Load REMOTE SWF APP" click="initSWF('
    http://blahblahblah/remoteSWF.swf')"/>
    <!-- LOADER -->
    <mx:SWFLoader height="100%" width="100%" id="remote_swf"
    autoLoad="false" visible="true" scaleContent="false"/>
    </mx:Application>
    CHILD SWF (resides on remote server)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="getXMLData()">
    <mx:HTTPService id="myTeams" url="
    http://blahblahblah/xml/myXML.xml"/>
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.rpc.events.ResultEvent;
    import mx.collections.ArrayCollection;
    public function getXMLData():void
    Alert.show(Security.sandboxType);
    myTeams.send();
    ]]>
    </mx:Script>
    <mx:Label text="THIS IS THE LOADED SWF WHICH HAS JUST
    PERFORMED A SEND ON HTTP SERVICE TO CREATE ARRAY
    COLLECTION"></mx:Label>
    </mx:Application>
    ------------ RUNTIME ERROR ---------------------------------
    ArgumentError: Error #1063: Argument count mismatch on
    Object/
    http://adobe.com/AS3/2006/builtin::hasOwnProperty().
    Expected 0, got 2.
    at mx.rpc.xml::SimpleXMLDecoder/decodeXML()
    at mx.rpc.xml::SimpleXMLDecoder/decodeXML()
    at mx.rpc.xml::SimpleXMLDecoder/decodeXML()
    at mx.rpc.http::HTTPService/
    http://www.adobe.com/2006/flex/mx/internal:rocessResult()
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::resultHandler()
    at mx.rpc::Responder/result()
    at mx.rpc::AsyncRequest/acknowledge()
    at :irectHTTPMessageResponder/completeHandler()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio
    n()
    at flash.events::EventDispatcher/dispatchEvent()
    at
    flash.net::URLLoader/flash.net:URLLoader:nComplete()

    After further investigations, it appears that the problem might be, due the fact that in the remote (loaded) swf, the following is null:
    var sm:ISystemManager = ISystemManager(SystemManagerGlobals.topLevelSystemManagers[0]);
    sm.swfBridgeGroup <----- equals null
    I tried creating the swfBridgeGroup in the local (loading) swf, but the loaded one still thinks it is null.
    Any ideas?

  • Loading swf into SWFLoader before it is added to a container

    I want to dynamically load a SWF file, before a particular view is created in a Flex 4.5 mobile app. Is it possible to load a SWF file into a SWFLoader before the SWFLoader is added to a container? I tried this but it didn't work.
    I tried doing this using the AS3 Loader class and movieclips, but when I compile for iOS this method does not work for me. Is there a way to do what I want?

    Hello,
    Firstly, why do you want to do this?
    Secondly, you cannot run runtime-loaded SWF files on iOS devices.
    By that I mean you can probably only use static SWF files like assets, but code inside them will not work.
    If you still want to load it, try inside the initialize event handler.

Maybe you are looking for