Accessing a loaded swf

I'm using this code to bring in another swf into a movieClip called "movieLoader":
var myLoader:Loader = new Loader();
movieLoader.addChild(myLoader);
var urlMovie:URLRequest = new URLRequest("movie1.swf");
myLoader.load(urlMovie);
The movie loads just fine, but how do I access it?
I tried:
trace(movieLoader.totalFrames);
and it just gave me "1".  I know the movieclip has more than 1 frame.
What do I do to access the swf called "movie1.swf" I just brought into that movieClip?

The swf you loaded is inside the Loader.  Since you have direct access to that Loader, you don't need to target its content thru the movieLoader mc.  But you do have to wait until after the swf is loaded, so you will need to have a listener assigned to the Loader for completion of loading.  In that listener's event handler function you can then access the loaded swf using something like...
MovieClip(myLoader.content)
OR
MovieClip(evt.target.content)
if evt is the argument opassed to the handler function

Similar Messages

  • AS3 Access a Loaded SWF By Name

    Hello All,
    In AS3, when an swf is loaded via the Loader class, how do I
    access the loaded swf by name? Here is my code:
    stop();
    var loader:Loader = new Loader();
    var whichMovie:String = "main.swf";
    addChild(loader);
    function wakeLoadBar():void{
    loadBar.gotoAndPlay("fadeIn");
    function loadTheMovie(theMovie:String):void{
    trace("LOADTHEMOVIE");
    loader.contentLoaderInfo.addEventListener(Event.OPEN,
    onLoaderOpen);
    loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    onLoaderProgress);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    onLoaderComplete);
    loader.load(new URLRequest(theMovie));
    function onLoaderOpen(event:Event):void{
    trace("OPEN");
    function onLoaderProgress(event:ProgressEvent):void{
    var percent:Number = Math.floor(event.bytesLoaded /
    event.bytesTotal * 100) + 10;
    loadBar.gotoAndStop(percent);
    trace("Progress " + percent);
    function onLoaderComplete(event:ProgressEvent):void{
    trace("Progress Complete");
    wakeLoadBar();
    function loadTheMovie is called after the loader "fadesIn"
    and the movie begins to load.
    Let's say that after the movie loads, I want to change its x
    and y, how do I go about doing that?
    laodedMovieName.x = 50;
    laodedMovieName.y = 150;

    KGlad,
    LOL... You rock!
    Thanks,
    V

  • Script access for loaded SWFs in Flash CS3

    In ActionScript 2 I would do the following:
    var loader:MovieClipLoader=new MovieClipLoader();
    var listener:Object=new Object();
    loader.addListener(listener);
    listener.onLoadInit=function(m:MovieClip) {
    m.something="12345";
    loader.loadClip("foo.swf",placeholder);
    What is the equivalent for this in ActionScript 3? I can load
    a MovieClip with the Loader class, but I don't know how to get or
    set one of the variables in the root timeline.

    So long as the movie you loaded in is also AS3, you can just
    type the name of the loader object and then use dot syntax to grab
    the variable. If the loaded movie is AS2, you are a great deal more
    limited. I don't think you lose all control 100% over the lodaed
    movie but I think it takes leaps and bounds to get at the AS2
    vars.

  • Controlling loaded SWF inside a child

    Hello to everyone, may this question be too obvious to
    everyone, but I've been googling for hours without any luck.
    Have seen examples but they are not exactly as my scenario...
    Please, I need some help.
    I have loaded a SWF and attached to a MovieClip which exist
    in my current movie using the following code, and now I just want
    to access the loaded SWF to send it orders like play() or
    gotoAndPlay(); I have tried also: container=
    MocieClip(loader.content); instead adding child, but it trhows an
    error

    //this is your minimum code to load a file
    var url:String = "put your url here ";
    var request:URLRequest = new URLRequest(url);
    var loader:Loader = new Loader();
    loader.load(request);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    loadComplete);
    function loadComplete(event:Event):void {
    addChild(loader.content);
    //you don't need all that code just concentrate on the bit
    you need; when this work then you can start putting the rest

  • Is it possible to load content into a loaded swf?

    I'd like to access a loaded SWF and load images/videos into it and trigger functions inside the loaded *.swf.
    Is this possible ??

    Yes, see the "Chromeless..." examples in the Example Player sample app.  The basic idea is that you subclass SWFElement and map the SWF's API into the MediaElement API, so that your SWFElement subclass can be handed to a MediaPlayer, integrate with compositions, etc.

  • How to access properties of symbols in loaded SWF?

    I'm making the migration from Flash to Flex, but I'm running
    into a dead end on one particular area: accessing and manipulating
    properties of symbols in a loaded SWF.
    The SWF is actually a simple library of a detailed parts
    illustration. I would like to load the entire SWF in position, and
    be able to change the attributes (i.e. colors) of individual
    symbols (or parts of the illustration). I can load, display and
    manipulate each symbol separately, but I need the parts to remain
    in place.
    The original art was created in Illustrator and exported as
    SWF using the symbols palette.
    I can always go back to Flash, but I'm forcing myself to move
    forward and do this project in Flex (baptism by fire!!).
    Is there some sort of dot notation to access the symbols from
    within the SWF, without loading them all separately?
    Let me put this another way: it appears that I can load an
    SWF and then instantiate each symbol in that SWF, and then load
    each symbol to the 'stage' (or whatever it's called in Flex)
    separately.
    I can certainly instantiate each symbol separately, and then
    align it on stage, but it seems to me to be bass-ackward to do it
    that way, expecially since I created the original SWF with
    everything in position.
    Is there no way to access the attributes of the individual
    symbols within an SWF without separately instantiating them?
    I'm just having trouble getting my head around this. Any help
    is greatly appreciated.

    Okay, I took a look at this info and it's what I was already
    doing.
    Here's a simplified example of what I'm trying to do, using
    the example in the swf9.pdf file.
    Let's assume I've created a SWF with a "BlueSquare" movieclip
    (in the symbols panel in Flash, exported for AS). In that clip,
    there is another symbol called "Star". I import the SWF and
    BlueSquare symbols in with the following code:
    <mx:Script>
    <![CDATA[
    [Embed(source=”../assets/circlesquare.swf”)]
    [Bindable]
    public var LogoCls:Class;
    [Embed(source=”../assets/circlesquare.swf”,
    symbol=”BlueSquare”)]
    [Bindable]
    public var LogoClsBlueSquare:Class;
    </mx:Script>
    If I instantiate the BlueSquare on stage, it includes the
    Star symbol when previewed, but I can't figure out how to get at
    the Star symbol to change color. If I apply a color change to the
    symbol, it changes the entire BlueSquare symbol.
    If I instantiate the Star symbol separately, I can then
    position it on the stage and make changes, but that requires
    positioning it with actionscript. I'm trying to not have to
    position a sub-element of my actual artwork because of it's
    complexity.
    I'd like to display the main movieclip (or sprite) with the
    ability to access the attributes of a sub-movieclip or
    sprite.

  • Can't Access MovieClips and Functions in Loaded SWF

    Hi everybody,
    I'm trying to simply access anything inside this loaded SWF and all I get is 'null'.
    I have code in the parent SWF that needs to tell the child SWF movieclip what to do but nothing works. This was a piee of cake in AS2 and I can't seem to get anything to crossover in AS3.
    Here's my code:
    import com.greensock.TweenMax;
    import flash.display.MovieClip;
    var myLoader:Loader = new Loader();
    var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf"); // in this case both SWFs are in the same folder
    myLoader.load(url);  // load the SWF file
    panel2.addChild(myLoader);   // add that instance to the display list, adding it to the Stage at 0,0
    panel2 = myLoader.content as MovieClip;
    photo_about.alpha = 0;
    photo_downloads.alpha = 0;
    //panel2.content_about.alpha = 0;
    //panel2.content_downloads.alpha = 0;
    function closeSection():void
              panel2.controlsMC.forcePause();
              TweenMax.to(photo_about, .5, {alpha:0});
              TweenMax.to(photo_downloads, .5, {alpha:0});
              TweenMax.to(photo_home, .5, {alpha:0});
              TweenMax.to(panel2.content_about, .5, {alpha:0});
              TweenMax.to(panel2.content_downloads, .5, {alpha:0});
              TweenMax.to(panel2.controlsMC, .5, {autoAlpha:0});
              TweenMax.to(panel2.content_home, .5, {alpha:0});
    panel2 traces null and all the clips loaded within pull up undefined property errors.
    Can somebody please tell me what I'm doing wrong? I'd be stoked to know what I'm missing and feel like this should be a piece of cake.
    Thanks for any help!

    You are not adding the content to the stage at 0,0, you are adding it to panel2 at 0,0.  THen you take panel2 and assign it to be something that likely doesn't exist by the time you assign it.  You need to wait until the loader completes loading before you attempt to do anything with its content, otherwise it has no content (null).  Similarly, you cannot control anything in the loaded swf until it has finished loading.  So assign an event listener to the contentLoaderInfo property of the Loader to determine when loading is complete, and have the event handler function deal with starting the interaction with it.
    var myLoader:Loader = new Loader();
    var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf");
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedSWF);
    myLoader.load(url);
    function processLoadedSWF(evt:Event):void {
        // deal with the loaded swf here
        // but you don't want to be assigning it to the panel2 object that contains the loader
    As far as controlling anything inside the swf you load, is it an AS1/2 or an AS3 swf?

  • How to access dynamic movie clips in a loaded swf

    Hello,
    I have a main movie file that loads a swf through loadclip.
    There are several dynamic movie clips in the library of the
    loaded swf (all set to export in first frame).
    I'm trying to create a popup window (using the Window
    component) by using code in the main movie to popup content that is
    in a dynamic movie clip within the swf loaded by loadclip.
    So far, I can create the popup without any problem as long as
    the contentPath refers to a linkage identifier of a library item in
    the main movie, but it won't work for a library item in the loaded
    movie. Is there a way to make this work? Is there a special way to
    reference library items in loaded movies?
    Here's my code to create the window:
    myWin = mx.managers.PopUpManager.createPopUp(this,
    mx.containers.Window, true, {title:mytitle, contentPath:myref,
    closeButton:true});
    where myref is a string containing the linkage identifier for
    the library item within the loaded swf.
    Thanks in advance for any assistance,
    Julia

    I have found out that I can access a dynamic mc from the
    loaded library (using attachMovie), but cannot use that same
    dynamic mc as the contentpath for a popup window.
    Any ideas why?

  • Access the property of main class in loaded swf.

    Hi
    i have one main.fla, its document class is main.as. the code in main.as is
    package
    import flash.display.MovieClip;
    public class Main extends MovieClip
    private var loading:Loading;
    public var trovami:Number=10;
    public function Main()
    stage.frameRate=31;
    loadSWF();
    private function loadSWF():void
    loading=new Loading(this);
    Loadind.as is another class where i load another swf its name is my_swf.
    the code of loading class is:
    package
    import flash.display.MovieClip;
    import flash.display.SimpleButton;
    import flash.text.TextField;
    import flash.display.Loader;
    import flash.events.*;
    import flash.net.URLRequest;
    public class Loading extends MovieClip
    private var _fla:MovieClip;
    private var url:String;
    public var val:String;
    private var loader:Loader;
    public function Loading(fla:MovieClip)
    _fla=fla;
    init();
    private function init():void
    url='my_swf.swf';
    var request:URLRequest=new URLRequest(url);
    loader=new Loader();
    initListeners(loader.contentLoaderInfo);
    loader.load(request);
    private function initListeners(dispatcher:IEventDispatcher):void
    dispatcher.addEventListener(Event.COMPLETE,completato);
    private function completato(event:Event):void
    _fla.addChild(loader);
    loader.y=10;
    val="hello"
    and the document class of loaded swf is Main2. in my_swf.fla there is one text its name is:
    a_txt.
    so i have to use property of Loading class in Main2 for text.
    code of Main.as is
    package
    import flash.display.MovieClip;
    import flash.text.*;
    public class Main2 extends MovieClip
    public function Main2()
    a_txt.text=val;
    where val is the property of Loading class.
    so how can i access.

    You have a reference to your loaded movie within your Loading class - instead of just setting val to a string - add a method in your Main2 class - and call that from Loading - passing the string to it. Push not pull...
    Main 2 becomes:
    public function Main2() {
         //a_txt.text=val;
    public function setText(val:String):void {
        a_txt.text = val;
    And then in your Loading class - when you're done loading just call setText:
    private function completato(e:Event):void
        addChild(loader);
        loader.y=10;
        MovieClip(loader.content).setText("hello");
        //val="hello";

  • Accessing a class from a loaded SWF

    In Flash Professional, I drew a shape, converted it to symbol, linked it to class Symbol1 (extends MovieClip) which is generated at run-time, and saved the SWF file as shape.swf.
    Now my main application wants to load shape.swf and create multiple instances of Symbol1 but I get ReferenceError when trying to access the class Symbol1.
    Below is my main application's code. Errors thrown are mentioned in comments.
    public class MovieClipTest extends Sprite
        public function MovieClipTest()
            var url:String = 'shapes.swf';
            var l:Loader = new Loader();
            l.contentLoaderInfo.addEventListener(Event.COMPLETE, f);
            l.load(new URLRequest(url), new LoaderContext(false, ApplicationDomain.currentDomain));
        private function f(event:Event):void
            var content:Sprite = (event.currentTarget as LoaderInfo).content as Sprite;
            trace(getQualifiedClassName(content.getChildAt(0))); // output: Symbol1
            trace(ApplicationDomain.currentDomain.getDefinition('Symbol1')); // throws Error #1065: Variable Symbol1 is not defined.
            trace(getDefinitionByName('Symbol1')); // throws Error #1065: Variable Symbol1 is not defined.

    Your "Symbol" is obviously not in the current ApplicationDomain, but in the loaded SWF's domain:
    var symbolClass:Class = event.target.applicationDomain.getDefinition("Symbol") as Class;
    var symbolInstance:MovieClip = new symbolClass() as MovieClip;
    Also because you're loading a SWF, the content of the Loader is a MovieClip, not a Sprite.
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • Accessing Loaded SWF Library Items

    In _root level I'm loading a swf that contains button
    skins(In library with linkage names)
    And I want to load a button skin in _root._mc level. I can do
    this using attachMovie but, it adds to _root level because the swf
    is loaded from _root level. But, I want it to be added to _root._mc
    level. Hopefully this is clear.
    1) Load a swf that contains button skins in _root level
    2) in _root._mc using attachMovie add a button skin in
    _root._mc level NOT _root level.
    Thanks,

    >>that doesn't make sense. you can't attach a library
    movieclip that's in loaded swf
    -Yes I can I do this all the time. Once a swf is loaded you
    can load its library items. This is a trick I learned from this guy
    who works for Adobe.
    http://orcad.optimumreturn.com/LoadingLibrary.zip
    Thanks,

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

  • Loaded SWF not displaying

    I've created a 'plugin' SWF file in CS3 using actionscript 3.
    The purpose of this file is to be included as a postroll in the
    open source flash media player JW FLV/Media Player (
    http://www.jeroenwijering.com/?item=JW_Media_Player).
    I have heavily customized the media player libraries to do
    various new things/alter how things worked, and now want to be able
    to include the SWF file within this into a child sprite/movie clip.
    HOWEVER, the problem lies in that the media player is written
    completely in AS2, and therefore I have to use the MovieClipLoader
    class to load in the SWF. Updating the source to AS3 isn't an
    option unfortunatly, and downgrading the AS3 SWF to AS2 isn't an
    option either, mainly due to the fact I've learnt AS3, not AS2, and
    find it frustrating trying to find the AS2 equivalent to the AS3
    methods I know.
    The problem though lies in that MovieClipLoader does not like
    my SWF at all. Initially I was presented with a load of sandbox
    errors from when it was loaded in, which I then resolved so that no
    security errors are produced. However, whenever I load in the clip,
    the target sprite/clip is empty. I have gone through checking that
    no errors occur on load, and it reports that the loaded SWF has
    been initialized, yet I see nothing. Also, the code loading the SWF
    is not at fault as it loads any other SWF (even another AS3 SWF
    which just creates a rectangle) no problem.
    Oddly enough, using the MovieClip.loadMovie method works in
    one situation - when you load it into the root of the AS2 file.
    When loading it into an empty movie clip, the same problem of a
    blank clip occurs. The problem is not specific to the media player
    either, as it happened in any AS2 file where I was testing how to
    load in the AS3 SWF.
    If it is of any use, the sandbox errors produced by the AS3
    file when loaded into AS2 swf I had to resolve where to do with
    stage access for getting the stage height and width, and a
    Loader.content error when pulling out the BitmapData. These were
    resolved via setting the allowed domains policy and eliminating any
    reference to stage.stageHeight/With.
    Does anyone have any ideas on how to solve this? The only
    possible solution I've been able to think of so far since the AS3
    swf won't display is to play with the LocalConnection class as
    tests showed I can communicate between the AS2 and AS3 files, but
    this would have to be a last resort, and is less than ideal when
    there can be multiple instances of the player running (I would need
    to use unique connection names for each instance so as to prevent
    player A interacting with player B, and also as only one of the
    players can listen on the connection at once).

    I have the component in the top level also,
    I get this error:
    TypeError: Error #2007: Parameter child must be non-null.
              at flash.display::DisplayObjectContainer/addChildAt()
              at fl.controls::BaseButton/drawBackground()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\BaseButton.as:615]
              at fl.controls::LabelButton/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\LabelButton.as:724]
              at fl.core::UIComponent/drawNow()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1343]
              at fl.controls::List/drawList()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:594]
              at fl.controls::List/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:474]
              at .tree::TreeList/draw()
              at fl.core::UIComponent/callLaterDispatcher()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1532]
    I've checked the definitions for the tree component,
    The LabelButton and List I don't have much control over.
    I'm not sure how to fix this.  The xml is correct and loads easily if it's in the root document.
    The list component doesn't load the labels, It stops on the first one.
      What do I do next?

  • Loading swf with XML on Click

    Hi all, can anyone help
    can anyone shine a little light onto a little confusion I am having, I have a menu that already loads in images via an XML file on a menu, what I am trying to do is when an image/meni Item is click I would like to load in an swf into the same place as the image Item loads into! am I making any sense.
    on a click event, do I use in the XML file the <link>link to swf</link>   ????
    this is what I have in my xml file that loads in the images so far;
    <image name="image 12" path="img/img12.jpg"
    title="Lorem ipsum 12"
    text="Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo 12" />
    what I am getting confused with is what I also put within the AS, I am sure it is not alot but I'm just not sure what needs to go where??
    this is what I have within the AS that loads in XML, I hope its ok to paste this code, never like posting to much code incase is scares people off, I just don't want to leave anything out, hope thats ok with everyone:eek:
    // Use URLLoader to load XML
    xmlLoader = new URLLoader();
    xmlLoader.dataFormat = URLLoaderDataFormat.TEXT;
    // Listen for the complete event
    xmlLoader.addEventListener(Event.COMPLETE, onXMLComplete);
    xmlLoader.load(new URLRequest("data.xml")); 
    stage.addEventListener( MouseEvent.MOUSE_WHEEL, onMouseWheel );
    //———————————————EVENT HANDLERS
    private function onXMLComplete(event:Event):void
    // Create an XML Object from loaded data
    var data:XML = new XML(xmlLoader.data);
    // Now we can parse it
    var images:XMLList = data.image;
    for(var i:int = 0; i < images.length(); i++)
    // Get info from XML node
    var imageName:String = images[i].@name;
    var imagePath:String = images[i].@path;
    var titles:String = images[i].@title;
    var texts:String = images[i].@text;
    // Load images using standard Loader
    var loader:Loader = new Loader();
    // Listen for complete so we can center the image
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImageComplete);
    loader.load(new URLRequest(imagePath));
    // Create a container for the loader (image)
    var holder:MovieClip = new MovieClip();
    holder.addChild(loader);
    var button_main:Button_mr = new Button_mr();   /
    holder.addChild(button_main);               
    var tooltip:ToolTip = new ToolTip();
    tooltip.field.text = titles;  //loads tooltip 1
    tooltip.field2.text = texts;  //loads tool tip 2
    tooltip.x = -350; 
    tooltip.y = 0;   
    holder.addChild(tooltip);
    // Same proceedure as before
    holder.buttonMode = true;
    holder.addEventListener( MouseEvent.CLICK, onMenuItemClick );
    // Add it to the menu
    circleMenu.addChild(holder);
    many thanks for any help!!!!

    1. Be sure in main.swf there is no masking or layering hiding
    the reflection area. A way to test quickly is to load in a plain
    master swf that is much larger than the externals swf.
    2. Know the weakness of loadMovie for timing issues that
    require the external movie to be fully loaded before actions are
    taken on it. I see a bunch of these in the code you posted. Best to
    use
    MovieClipLoader.onLoadInit
    before you attempt to access the external swf properties or code or
    add code.
    3. Be sure the code is firing on load and all objects are
    created. Add some trace statements for those objects.
    4. I noticed you do not use BitmapData so this may not be
    relevant but be sure to add
    System.security.allowDomain("*");
    to the main.swf as well as in external swfs and only if you
    are using the BitmapData class.
    5. As I started to look at the code a bit and noticed this
    item:
    There is no constructor for the Flash MovieClip class. You
    will not see a compiler error message because you do not have the
    code wrapped into a class.
    var home:MovieClip = new MovieClip();
    However it does not have impact on the code.
    better would be
    var home:MovieClip;

  • Controlling a Movie Clip on the Main Timeline from a loaded SWF?

    Is it possible to control a MovieClip on the main timelne from another loaded clip?
    I see posts that control loaded clips, but most are all from the loader in the main timeline.  I have a moviclip on the main timeline that I want to make visible or invisible depending on what keyframe is playing in another loaded swf.
    If I try to call the movieClip from the loaded SWF I get "error #1119.  Access of possibly undefined property...." because it doesn't exist in the loaded SWF, just the main timeline. 
    The old AS2 way just used "_root".  Since "_root" doesn't exist any more, how do you control items on the main TimeLine from a loaded SWF?

    I am not clear what you mean because you are saying you are trying to target a movieclip that does not exist where you are trying to target it.
    Try using a trace to see what you are targeting when you you target the MovieClip(parent.parent)....
    trace(MovieClip(parent.parent));
    The other approach I mentioned earlier is the more OOP-correct approach if you would rather try that way.  Here's a rough outline of it...
    AS3 - Dispatch Event
    http://forums.adobe.com/thread/470135?tstart=120
    Example:
    Add something to trigger the event in the child (your loaded swf):
    dispatchEvent(new Event("eventTriggered")); (
    if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
    In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo.  In the complete event handler, add a listener for the event on the loaded swf.
    // event handler triggered when external swf is loaded
    function loaderCompleteHandler(event:Event) {
        MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
    function eventHandler(event:Event):void {
        trace("event dispatched in loaded swf");
       // this is where your main file can set the visible property of your movieclip

Maybe you are looking for