Access to an instance of a loaded SWF file.

Hi all

I have a Flash movie and in this film I want to load an external SWF (intro.swf)

This is the code I use in frame 1:

var mclListener:Object = new Object();
mclListener.onLoadStart = {function (target_mc:MovieClip)}
vacuum
};
mclListener.onLoadProgress = function (target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {}
infoField_txt.text = Math.round(bytesLoaded/bytesTotal*100);
};
mclListener.onLoadComplete = {function (target_mc:MovieClip)}
movieLoader_mc.object_mc._x = 200;
};
mclListener.onLoadInit = {function (target_mc:MovieClip)}
vacuum
};

var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl. AddListener (mclListener);
image_mcl.loadClip ("intro.swf", movieLoader_mc);

Stop();

The loading of the movie works fine. BUT the question is... How do I enter the object_mc of the Forum in my main movie intro.swf?

I tried many things like _root.movieLoader_mc.object_mc but it does not work :(

Thanks in advance.

The problem is that the whole event is sent when the film is loaded, but before the first image in the film loaded items are available.

You must use the MovieClipLoader class and use the onLoadInit event, which is sent when after the execution of the first frame of the loaded movie.

If you used the Loader component because you wanted to use the ProgressBar component Pentecost, you can always join the ProgressBar source usage of movieclip to load the swf file, but do not forget to change the mode of the ProgressBar to interviewed as described in using the ProgressBar component.

Tags: Adobe Animate

Similar Questions

  • To access the MovieClip instances in a loaded SWF file

    The situation as follows:

    loadedSWF.swf (published with Flash Player 8 AS2 or AS3 of Alpha Flash Player 9), contains on the symbols of the stage with the instance names: clipA, clipB, clipC, etc... No ActionScript is included in the file.

    In a Flex Builder 2.0 project, a component that extends mx.core.UIComponent load loadedSWF.swf:

    script
    var request: URLRequest = new URLRequest ("loadedSWF.swf");
    loaded var: Loader = new Loader();
    Loaded.Load (request);
    addChildAt(loaded,0);


    loadedSWF.swf successfully is displayed in the component's display list, but MovieClip instances that it contains are inaccessible.

    Its existence is verified:

    script
    trace (getChildAt (0)) / / result: [object Loader]
    trace (getChildAt (0) .root) / / result: [object _system_mx_managers_SystemManager]

    However, even if .root getChildAt (0) returns a mx.managers.SystemManager and mx.managers.SystemManager supports the numChildren property, trace (getChildAt (0).root.numChildren) survey error: 1119: access of the numChildren property possibly not defined through a reference with static type flash.display:DisplayObject.. Other methods like getChildAt(), etc. are also impossible to call. Direct access with getChildAt (0).root.clipA also throws an error, etc...

    Is it possible to access instances of the MovieClip on the stage of the loaded SWF file of a component that loads? I would appreciate any advice on this issue.

    a.Neko


    Note:
    The goal is to be able to load multiple clips into a component in a single loading of SWF file, then to instantiate the separately if necessary with addChild() and addChildAt() methods.

    Solution found:

    (Checked for loadedSWF.swf published with Adobe Flash Professional 9 Alpha Public)

    script (excerpt from Flex 2.0 AS3 component class)

    protected var clip: MovieClip = new MovieClip();

    protected final void requestSWF(value:String):void {}
    var request: URLRequest = new URLRequest (value);
    var asked: Loader = new Loader();
    requested.contentLoaderInfo.addEventListener (Event.COMPLETE, this.onRequestSWFComplete);
    requested. Load (request);
    return;
    };

    protected final void onRequestSWFComplete(event:Event):void {}
    event.stopPropagation ();
    This.clip = event.target.content.clipA; conversion of a local variable.
    this.addChild (this.clip);
    return;
    };

    this.requestSWF ("loadedSWF.swf");

    Result: clipA is added separately to the display of the component list.

    a.Neko

  • Unable to access MovieClips and functions in a loaded SWF

    Hello world

    I'm just trying access anything whatsoever within the loaded SWF and all I get is 'null '.

    I have the code in the SWF parent who must tell the SWF movieclip child what to do, but nothing works. It's a piee of cake into AS2, and I can't seem to get anything of crossover in AS3.

    Here is 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 clips loaded in draw property undefined errors.

    Can someone please tell me what I'm doing wrong? I would be happy to see what Miss me and feel like this should be a piece of cake.

    Thanks for any help!

    You do not add the content of the scene to 0.0, you add it to panel2 to 0,0.  Then you take panel2 and assign to something that probably does not exist at the time wherever you set it.  You must wait until the loader load before trying to do something with its content, otherwise it has no content (null).  Similarly, you can not control anything in the loaded swf file, until it is fully charged.  So to assign an event listener for the property contentLoaderInfo the loader to determine when loading is complete, and have the event handler works deal from interacting 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 swf loaded here

    but you do not want to be assigned to the panel2 object that contains the charger

    }

    With regard to the control of anything anyone inside of the swf you are loading, is an AS1/2 or an AS3 swf?

  • Child of the loaded SWF file

    I read through many of the forum discussions and articles, but I still can not quite understand it. Here's my basic configuration: container > LoadedSWF file > MovieClip. I want to access this clip that is in the swf file loaded into the container.

    Loading code is inside a class that is directly associated with an empty MovieClip on the stage. Here are the relevant parts of the code:

    public var loadDrawing:Loader = new Loader;

    drawLoad = "E002.swf";

    loadDrawing.load (new URLRequest (drawLoad)); I loaded the drawing in loadDrawing

    That's essentially what I want, but it doesn't exactly work like this:

    jumpNumber = "j1". This is the name of the instance of the clip I want control

    loadDrawing.drawLoad.jumpNumber.x = 100;


    That way I can control this MovieClip which is in the swf file, which the magazine is. Also, I have to wait for the video to load completely before I try to access the elements contained in it, right?

    >>

    jumpNumber = "j1". This is the name of the instance of the clip I want control

    loadDrawing.drawLoad.jumpNumber.x = 100;

    If you want to use a string as you show here so you need to use the media access as follows:

    loadDrawing.drawLoad [jumpNumber] .x = 100;

    or else just like:

    loadDrawing.drawLoad.j1.x = 100;

    However, you also need to cast loadDrawing.content to a MovieClip to be able to do... If actual code would be like:

    MovieClip (loadDrawing.content) .drawLoad [jumpNumber] .x = 100;

    or else just like:

    MovieClip (loadDrawing.content).drawLoad.j1.x = 100;

  • control the loaded swf file

    Hi all

    I am loading a swf into another SWF, I want to controll loaded swf such as play and pause the swf. The loaded swf file is an animation file, all animations are kept in a movieclip, then please tell me how I can control the animation.

    In your first assignment, you tell the animation is present in a movieclip.  If this movieclip is in the loaded swf file you will probably need to target this movieclip to tell him to play rather than the SWF itself, as in...

    currentSWF.movieclipName.play ();

    where movieclipName is replaced with the name of the instance of movieclip in the loaded swf file.

  • Calls to functions from loaded SWF files

    I have a Flex application that uses the SWFLoader object to load an external SWF file (which has also been developed in Flex) in a section of the page. The parent SWF file defines several variables and global functions in ActionScript I would use from all SWF files loaded in the SWFLoader. Is it possible in ActionScript to access the functions and variables that are defined in the SWF file the SWF load/child parent? The two SWF files are on the same domain, so there should not be problems of security.

    Peter thank you very much for your answer. I have tried loading in the same ApplicationDomain, but he did not what I expected from him. I, however, found the solution to my problem. I needed to understand how cross-script from a SWF file loaded the loaded SWF file. I discovered how and published a description of my conclusions on another thread that was no longer relevant to my question. The described solution has allowed me to do what I needed without touching the ApplicationDomain.

  • How do I know if a loaded SWF file have the source code?

    Hi!, I need to know if a loaded SWF file have the source code. I develop an application running on iOS and admin can upload SWF files that show in the APP, but I must know before show (mobile Adobe AIR APP) or activate (PHP script server), if this SWF file have the source code for no show or enable him not it.,.

    Thank you!

    I have it!

    Only that we need to do is:

    1. If the first tank is:

    F-the swf is uncompressed

    C - compressed with Deflate

    Z - compressed with LZMA

    2. If it is compressed, uncompress it with the right method

    3. search MainTimeline string, if concluded the SWF actionscript so it is not found, the code is not actionscript.

  • How the get function is available or not on the loaded swf file

    I have 100 swf file in one of my projects. And there is a common feature in some of the SWFs. All these files are loadded in the file main.swf. Here's my Question, "If have the common function is the swf file that is loaded, int how to trigger this funciton of the main.swf.

    Quite simply,.

                if(movieclip.test){
                    movieclip.test();
                }
    

    ('movieclip' is the loaded SWF file and "test()" is the function)

  • How to call the function lavel root & variable external loaded swf file

    I have little problem in as3.  I load 'mainmenu.swf' file "main.swf". through class loader. so now "main.swf" is children of parents 'mainmenu.swf' file how can call "main.swf" variable and function of "mainmenu.swf".

    The parent of the loaded swf file is the charger.  The main SWF is the parent of the charger.  Then to communicate with the main storyline of the loaded file can use:

    MovieClip (parent.parent) .someFunction ();

  • call the parent of a loaded swf file functions?

    Hi all

    I have a main Flash file that load other SWF files using loader objects.  I want to be able to call the methods of this main purpose since then in the loaded SWF files.  For example, I want the file loaded in order to add an event listener on the stage of the main file.  I found this example:

    http://flexcomps.WordPress.com/2008/09/01/AS3-calling-MyFunction-on-main-timeline-from-Loa ded - swf.

    That seems to do what I want, but I can't understand how to implement it in my setup.

    My "main" file that loads other sovereign funds is called "main.swf" and has a main document class.

    My loaded file is called start.swf and has a class of documents 'Start '.

    in my main constructor:

    var ethics_content:Loader = new Loader();

    ethics_content. Load (new URLRequest ('start.swf'));

    in the constructor of my departure:


    If (this.parent.parent! = null) {/ / IF the STATEMENT FAILS}
    var parentObj:Object = this.parent.parent as an object;
    trace ("parentObj has been found.'");
    } else {}
    trace ("this .parent .parent is null.");
    }

    stage.addEventListener (MouseEvent.CLICK, handle_click); GENERATES AN ERROR WHEN IT IS LOADED TO THE HAND. SWF

    trace ("step: ' + Stadium");  RETURNS A [STAGE] OBJECT BY OPERATING BY ITSELF, BUT NULL WHEN IT IS EXECUTED IN THE HAND. SWF
    trace ("root:" + root); RETURNS AN OBJECT [START] WHEN RUN BY ITSELF OR WITHIN THE HAND. SWF
    trace ("parent: ' + parent"); RETURNS A [STAGE] OBJECT BY OPERATING BY ITSELF, BUT NOTHING OF IN THE HAND. SWF
    trace ("this .parent:" + this.parent); RETURNS OBJECT STAGE ITSELF, NOTHING OF IN THE HAND. SWF
    trace ("root.parent:" + root.parent); RETURNS THE SCENE OBJECT BY ITSELF

    How to get to the scene of a loaded SWF file?  Or at least, how can I call a function in my main class from the loaded file start.swf so I can move the functionality I need the main.swf file?

    Any help is greatly appreciated.

    If your main swf loader is not added to the display list when it try {branch} is running, the charger will not have a parent.

  • Problem with playing a loaded "SWF" file in the chronology of the pain

    Hey there. I created a presentation that loads the SWF interactive movies in a clip of 'target' on the main timeline.
    As you progress through the different presentation SWF movies are loaded into the presentation. And this in turn allows me to change the content of the presentations quickly and easily for different customers.
    These sovereign funds use part of the preloaded flash content like the other and drop-down list box objects.
    However, when these sovereign funds are called in the main charge they stop working properly.
    They work fine when tested independently of the main charge.

    Does anyone know how I can be able to get these sovereign funds work properly?

    At soon fofana

    The first thing to do is to check the range of your loaded SWF file. All references to _root, for example, means something different when the SWF is loaded in your film of wrapper.

    In addition, some of the V2 components do not work correctly when the SWF is loaded into another SWF. There is a technical Note and simple workaround here:

    http://www.Adobe.com/go/tn_19278

    Good luck!

  • Determine the Total number of images in a loaded SWF file

    I used the loader class and the load method to load a swf file that has multiple frames.  Does anyone have a suggestion how to determine the total number of frames in the SWF file script after loading?

    AFTER loading is complete (that is to say, use a listener), you can access the content property of the loader (cast as a movielcip):

    MovieClip (yourloader.content) .totalFrames;

  • A3.0 dynamic loading .swf file learn slower and slower after two or three lines.

    IAM 3 SWFs for loop running.

    Problem is after that the compilation of the flash swf file file is getting more slower after two or three loops and stop with content finally.

    I don't know why it's happening that my guess is "because memory increases resulting in a flash file to slower"

    Please can someone help me on this...

    Hi This is the code below I got from the AS3.0 tutorial.

    {com package
    import flash.display.Sprite;
    import flash.display.Loader;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.display.Graphics;
    import flash.events.Event;
    import flash.display.StageScaleMode;
    import flash.utils. *;
    Import fl.transitions.Tween;
    Fl.transitions.easing import. *;

    SerializableAttribute public class MyMovie extends Sprite {}
    declare variables...
    private var myXml:XML;
    private var myXMLURL:URLRequest;
    private var myLoader:URLLoader;
    private var imageList:XMLList;
    private var loader: Loader;
    private var number: number = 0;
    private var currentImage:Loader;
    private var interval: uint = 0;

    definition cunstructor...
    public void MyMovie() {}
    Super();
    var g:Graphics = this.graphics;
    g.Clear ();
    g.beginFill (0 x 000000, 1);
    g.drawRect (0, 0, 768, 1360);
    g.endFill ();

    }
    public void LoadXml(xmlPath:String_=_null):void {}
    var XML_URL:String;
    If (xmlPath == null) {}
    XML_URL = "data.xml".
    } else {}
    XML_URL = xmlPath;
    }
    myXMLURL = new URLRequest (XML_URL);
    myLoader = new URLLoader (myXMLURL);
    myLoader.addEventListener ("complete", xmlLoaded);
    }
    private void xmlLoaded(event:Event):void {}
    myXml = new XML();
    myXml = XML (myLoader.data);
    imageList = new XMLList();
    imageList = myXml.children ();
    loadImage();
    trace (ImageList [No.]. Child ("path"));
    }
    private void loadImage (): void {}
    clearInterval (interval);
    var imagePath:String is imageList [No.] .child ("path");.
    var imageRequest:URLRequest = new URLRequest (imagePath);
    loader = new Loader();
    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, completeHandler);
    Loader.Load (feeder);
    currentImage = loader;
    addChild (loader);
    }
    private void completeHandler(evt:Event):void {}
    clearInterval (interval);
    If (currentImage! = null) {}
    removeChild (currentImage);
    }
    currentImage = loader;
    currentImage.x = (768/2)-(currentImage.width/2);
    currentImage.y = (1360/2)-(currentImage.height/2);
    var myTween:Tween = new Tween (Regular.easeOut, 0, 1, 0.5, currentImage, "alpha", true);
    var myTween1:Tween = new Tween (currentImage, "x", Strong.easeOut, 0, 0, 1, true);
    var myTween:Tween = new Tween (currentImage, "x", Strong.easeOut, 0, 768, 1, true);
    myTween.addEventListener ("motionFinish", TweenFinishedHandler);
    }
    private void TweenFinishedHandler(evt:Event):void {}
    no = no < imageList.length () - 1? No + 1:0;
    range = setInterval (loadImage, 4000);
    }
    }
    }

    Publish the flash by targeting the flash player 10.1.

  • How to add listeners for the external loaded swf files?

    IAM loading external .swf file in the file main.swf.

    IAM dispatchEvent (new Event ("loaded")) of external .swf.

    How to add the listener for the event "loaded"?

    in your swf file main something like below:

    mcExt.addEventListener ("load", onCongratsClose);

    function onCongratsClose(e:Event):void {}
    Your code

    }

  • How to load SWF files?

    I created a flash game which is about 11 MB in size, and I created the progBar in the first frame of the swf file.

    But it only shows the loading process after only a few MB of data loaded... beign that could take some time and that the user to close the tab...

    I don't want to do... How can I tell the user at least that the swf loads without any percentage and all animations...

    As put a < div > tag to the back of the swf file... so up to load swf can be demonstrated the div with the message 'loading... ' I tried this method but it did not work for me and I don't know why.

    I hope masters flash at this forum could help me.

    TQ

    You must use two SWFs - your game and a loader which load the game. The charger would use the Loader class to load the game, and you can use the progress event to display correctly the information loading. The first thing of charger framework has never been a good solution...

Maybe you are looking for

  • Satellite L505-10Z & L505-GS5039 - can connect to the router

    A few days ago that I buy two Toshiba Satellite L505-10Z & L505-GS5039 the two cannot connect WiFi.When I connect with the Ethernet cable it works but WiFi does not work. I use ADSL Linksys router and Access Point for internet access. Laptops are ide

  • ePrint still listed as offline on laptop when you try to print work but printer D110a

    I literally tried everything to resolve the question in the title. I'm fine with the networking. I'll run down the list of things that I tried to solve this problem, or the important factors that someone would need to know to help me: It's my work, l

  • It s possible to create a Java plug-in to use BBM in a WebWork?

    Hello everyone. As the title suggests, "it s possible to create a Java plug-in to use BBM in a WebWork? I mean, the java extension BBM will work in a WebWork? Thank you

  • Going from Vista to XP

    I bought an Acer aspire 5610 some years ago, which ran on XP, with a free upgrade later to Vista. I would now like to go back to XP, is it possible and if so, how?

  • Validate a field with multiple values.

    Hi, I have to limit the decimal values to a text entry field that is "number".When I click SAVE it will say that the decimal values are not allowed.This part is fine. But the problem is that when I record multiple entries (batch record). It validate