Reference to main.swf from nested swf

Hi,
I have main.swf that loads page.swf . I want to have a button
inside page.swf that tells main.swf to do something.
How do I refernce the timeline of Mian.swf
I use mx2004
Thanks,
Robert

See:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=194&threadid=1173850&en terthread=y
If you target what you want to do just like if it was in the
same swf. The mc you want to load won't work correctly until it's
tested in the movie your loading into. Like my code. _root with dot
in between each nested element. My code has the an empty mc called
'empty' that MARK_EXPAND is loaded into. And 'empty' is nested in
'InterfaceYO' which is nested in HEADERfadeout which in turn is
(obviously) in the _root, which is the source.

Similar Messages

  • How to access symbol on main timeline from nested symbol

    I did read the the edge JSAPI but still no way to make it work.
    Very simple use: you click on a button, a window appears. the button that makes the window appear is supposed to hide some elements which it does. HOWEVER when I want to use a close button within the symbol (window) to make these symbols appear again, it doesnt work.
    From inside the symbol I tried:
    sym.getComposition().getStage().getSymbol("openTabButtBlack").show();
    Doesnt work.

    sym.getComposition().getStage().$("openTabButtBlack").show();

  • Going Back to the main frame, from inside a movie clip time line.

    In flash CS5 I want to go back to the main time line, from inside a movie clip button, so when i click the the movie clip it goes to another frame on the main time line..
    Can anyone help me?
    Thanks
    Daniel Derrick

    your can use _root to reference the main timeline from anywhere though that can lead to problems if your swf is loaded by another swf.  because of that eventuality, it would be better to use a relative path back to the main timeline.
    so, from a movieclip's timeline (when the movieclip is on the main timeline), you can use _parent to reference the main timeline.
    but even better would be to use no code on that movieclip's timeline and keep all your code on one timeline (the main one).

  • Accessing variable in main mxml from component

    I have the following problem, i have a main mxml and
    component mxml which i import in my main file. I need to access
    variable in main mxml file from that component but i don't know how
    to reference my main mxml from component? Can someone please help
    me with this?
    thanks in advance

    Try this
    this.parentApplication.main_mxml.variableID = 34;
    Rgds
    JFB
    "msabljic" <[email protected]> wrote in
    message
    news:fd2u5k$a17$[email protected]..
    >I have the following problem, i have a main mxml and
    component mxml which i
    > import in my main file. I need to access variable in
    main mxml file from
    > that
    > component but i don't know how to reference my main mxml
    from component?
    > Can
    > someone please help me with this?
    >
    > thanks in advance
    >

  • 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

  • Button from External SWF to Play Movie in Main SWF

    Hi Guys,
    Ok I'm working in Flash 8, Action Script 2;
    I'm building a website, in which the 'Gallery Page' has a link to an external swf file, which is a scrolling clip of thumbnails.
    What I want to do, is create each thumbnail into a button, which will then play a Movie Clip from a frame located in the Main swf file.
    (So basically, each thumbnail button is a small photo, will play that photo in a large scale as a movie)
    eg.
    thumbnail1_btn  needs to go to main swf and play movieclip1.mc, frame 1
    thumbnail2_btn nends to go to main swf and play movieclip1.mc, frame 2
    I'm unsure of the code for this? Or if I've built this up wrong?
    If someone could help me out, that would be great!

    If you haven't set _lockroot on the loaded SWF, than a simple _root call from the loaded SWF will talk to the main SWF.
    IE:
    on(release){
    _root.gotoAndPlay(1);
    If you did set the lockroot, then call the level directly, via:
    on(release){
    _level0.gotoAndPlay(1);
    Once on the root level, you can access a movie clip as normal.
    So:
    on(release){
    _level0.movieClip1.gotoAndPlay(1);
    will call the movie clip "movieClip1" which resides on the timeline of _level0 (which is main.swf in your instance), and tell it to jump to the first frame and start playing.

  • Calling a function in the main movie from a loaded swf

    I realize this is probably a very basic question, but I have
    loaded a SWF file into another movie. I now want to call a function
    in the main SWF. Is there a way to do that? Alternatively, I have a
    custom class where I could put the function, but I haven't been
    able to figure out how to call it from the loaded SWF either. Do I
    somehow need to associate the class with the main movie,
    or...?

    Never mind - I was doing something very stupid and wasn't
    calling the function as a method of a movie clip. I was simply
    calling checkTarget(event) rather than
    event.currentTarget.checkTarget(event); which seems to work.

  • Imported swfs getting data from main swf

    Hi everybody,
    I'm struggling shaking my old school AS2 mindset here. I've got a main swf which loads a bunch of subordinate swfs. I need my loaded swfs to see some variables in the main. For instance (example simplified for conversational purposes), let's say I've got a swf loading (we'll say littleSwf), which needs to set its rotation based on a variable (we'll say swfRotation) in the main. The rotation code is inside of the little swf. How does that little swf get told / find out what its rotation number is?
    How would I do that? I've tried everything I can think of and done some digging, but apparently not in the right places.
    Any input appreciated.
    Dan P.

    If you are loading the swf into another, chances are you are using a Loader.  So the Loader becomes the parent of the loaded swf.  And the main swf is the parent of the Loader.  So using the more common AS2 mindset, you would want to get any variable in the main swf by targetng the parent.parent... which in AS3 can be done using... MovieClip(parent.parent).
    A more OOP correct way of getting the rotation value to the child is to assign it to it from the main swf after it has completed loading the child.  To do this you assign a listener to the Loader to determine when the file has been loaded, and then you have the main file target the child thru Loader.content property.  You could then have some function in the child that the main calls and passes the rotation value to as an argument, or just have the main file perform the operation on the child using the rotation value if that is suitable.

  • Control main timeline from loaded swf.

    Hi,
    I'm using a textfield for debug information.
    I'm loading an swf on the main timeline and I'm showing the status in the debug textfield.
    function swfLoaderCompleteHandler(event:Event)
         Debug.text +=  "Swf loaded.";
    That works.
    But,
    I'm loading a png file in the loaded swf. , I'm trying to show the status of the png file as I showed the status of the swf.
    function pngLoaderCompleteHandler(event:Event)
         MovieClip(parent).Debug.text += "Png loaded.";
    I can't control the main swf from inside the loaded swf. Even gotoAndStop or calling a function doesn't work.
    Do I need to add something when I load the swf, saying it's a MovieClip or something?
    Here's a fla too. http://flashfocus.nl/forum/attachment.php?attachmentid=9885&d=1282509233

    Thank you! you're brilliant!
    For people with the same problem:
    If you use CS5 and you have a TLF text on the stage, it doesnt work... I think it's a bug. But when I converted my TLF textfield to classic and everything works fine!

  • GotoAndPlay specific frame in external swf from main swf

    I have a main swf that loads 2 external swfs.
    I click on button to see content of external swf #1 and see stuff. I do something that causes external swf to show other stuff (i.e. not at beginning state)
    In the main swf I click on button to see content of external swf #2. External swf #1 content is made invisible and I see content of external swf stuff.
    NOW, if I click on button to take me back to see external swf #1, I see it's content in current state. I want to force it to start over again at frame #1 which will reset content.
    However, no matter what I try, I can't seem to control which frame to go to in external swf using gotoAndplay.
    Here is code in frame #1 of main swf to load external swfs:
    //load academic movie
    var swfLoader1:Loader = new Loader();
    container1.addChild(swfLoader1);
    var url1:URLRequest = new URLRequest("academic.swf");
    swfLoader1.load(url1);
    //load wisdom movie
    var swfLoader3:Loader = new Loader();
    container3.addChild(swfLoader3);
    var url3:URLRequest = new URLRequest("wisdom.swf");
    swfLoader3.load(url3);
    Here is code in frame 2 of main swf that checks button to see where to go in external swf:
    //academic button clicked
    function academicClick(event:MouseEvent){
       container3.alpha = 0;
       container3.visible = false;
       container1.visible = true;
       container1.gotoAndPlay(1); //this is where I am trying to force it to start at frame 1
       container1.alpha = 1;
    I don't want to reload the external movie to force it to start over.
    Any help would be much appreciated.

    You can easily control this by making the external swf to load with your movieclip, The below is the code snippet that clear on accessing the specific frame on external swf.
    //Loading clips content
    var ldr:Loader;
    var mcExt:MovieClip;
    //Loading
    loadswf("external.swf");
    function loadswf(tmp:String):void{
        unloadSwf();
        ldr= new Loader();
        ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressListener);
        ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
        ldr.load(new URLRequest(tmp));
        function progressListener (e:ProgressEvent):void{
            ploader.visible=true;
        function swfLoaded(e:Event):void {
            mcExt = e.target.content as MovieClip;
            ldr.contentLoaderInfo.removeEventListener(Event.COMPLETE, swfLoaded);
            mcExt.addEventListener(Event.ENTER_FRAME,onEnterfn);
            ploader.visible=false;
            addChild(mcExt);
    //UnLoading
    function unloadSwf():void{
        if (ldr!=null){
            ldr.unloadAndStop();
            removeChild(mcExt);
            mcExt=null;
    //Intervals (The part you work on the specific frame within the external swf
    function onEnterfn(e:Event):void{
        var num:int=mcExt.currentFrame;
        if (num==1) mcExt.play();
        if (num==9) {
                mcExt.skipmc.addEventListener(MouseEvent.CLICK,skipfn);
                function skipfn(e:MouseEvent):void{
                    mcExt.stop();
                    mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
                    gotoAndStop("help");
        if (num==mcExt.totalFrames){
            mcExt.removeEventListener(Event.ENTER_FRAME,onEnterfn);
            gotoAndStop("help");
    hope it solve

  • Hello please, somebody knows how to unload a movie clip recently loaded and back to the main SWF?

    Good night guys!
    I come humbly ask for your help ...
    I have an extensive animation .. A kind of map of Brazil with 33 stores in 4 states distributed .. Clicking on the desired state, it expands and appear their stores. Only the animation and the first store were enough to generate a SWF comporting 3 megabytes .. So I decided to use an external SWF to every single stores, otherwise would be too heavy ..
    My goal is: Every shop clicked, loads a new external SWF which occupies the entire screen .. So if I wanted to return to the main SWF with button, how should I proceed?
    I have found an article that shows communication between two SWF, however, some steps did not work and I want it to button.
    Please, if you know, needs to be in ActionScript 3.
    Can somebody help me?
    Thanks, I hope to answer

    Olá Felipe, tudo bem com você?
    In order to unload content loaded into a Loader object you can use either the unload() method or the unloadAndStop() method. The difference between them is that unloadAndStop() will unload the loaded SWF and try to stop executing any code that it was running including animations, sound and event listeners.
    If you wanto to call the unload() or unloadAndStop() methods from the loaded SWF you can use its loaderInfo.loader property to reference the Loader object that loaded it.
    It could be someting like this:
    this.closeButton.addEventListener(MouseEvent.CLICK, this.handleClose);
    protected function handleClose(event:MoueEvent):void {
         this.loaderInfo.loader.unloadAndStop();
    You can pass a Boolean parameter to unloadAndStop() to indicate if Flash's garbage collector should be run ont the unloaded SWF in order to free up memory. Considering the size of your SWFs, this could be a good option. The downside is that there is a performance penalty and in my professional experience, CPU is still a resource that is more scarce than memory, so use with care.
    Hope this helps.
    Abraço,
    Rui

  • How to pass a "Button" reference in one swf to anthor swf file?

    Dear all:
    Please let me describe my problem first.
    In my application, there are two swf files:"sender.swf" and
    "receiver.swf"
    A button named "re_Button" is in "receive.swf", and now i
    wanna operate the "re_Button" through the "sender.swf".
    How to do this?
    Can I access the "re_Button" reference through another swf
    application??
    And I've tried the "locaconnection" class, but it doesn't
    help.
    AnyOne helps me?
    Thanks in advance -_-

    I tried the localconnection class:
    1).Sender.as:
    private var send_tf:TextField;
    private function sendMessage(event:MouseEvent):void {
    conn.send("myConnection", "lcHandler",send_tf); // to send
    the "send_tf" reference to the "Receiver"
    2). Receiver.as
    public function lcHandler(tf:Object):void {
    tf as TextField ==null // here, i find that the "send_tf" is
    not a "TextField" any more!!!!!!!!!!!!!!!!
    I wanna operate one instance reference in one swf from
    another swf.
    Is it possiable??
    Thanks in advance.

  • Need help embedding photo gallery swf into main swf...

    So I am attempting to create a website in flash and have the
    main swf created for that. However, I've also created a photo
    gallery in a separate swf which I want to embed into one of the
    scenes in the main swf. I tried importing directly to stage, but
    quickly realized that the timeline from the photo swf would not get
    carried over. Basically, I know that it has to be accomplished
    using AS, but don't know what that script would be. Any help would
    be appreciated!

    OK, well, that wasn't really a tutorial as much as it was
    just a huge section of code I couldn't make sense of. Anyways,
    instead of loading the gallery externally now I decided to just
    make it in the actual main swf. So, basically, in the section of
    the main swf reserved for the gallery I created an empty movie
    clip, went inside the clip, created layers for script, thumbs and
    photos. The photos themselves were in a movieclip of their own.
    Each photo has a small fade in accomplished by staggering the
    keyframes for each photo with a stop(); action on the last frame of
    each photo where it comes to full opacity. The thumbnails are back
    in the main movieclip where each button has code telling it to go
    to the beginning of each photos transition and play. It is supposed
    to play until it hits that stop action, but it won't play at all.
    Suggestions?

  • Download SWFs to cell, run in main SWF

    Hey there people!
    We've got a tricky one for you guys, really hope you can help
    us out.
    We're developing a Flash Lite 2.1 application mainly for cell
    phones, and to start off we're testing on a Nokia N73.
    The application needs to be able to load SWFs which has been
    downloaded alternatively pushed to the phone and saved locally on
    the phone.
    There seems to be a number of challenges:
    1) How can we address a separate SWF locally from a main SWF
    on a cell phone?
    2) Any suggestions on how to distribute the separate SWFs to
    the phone? Push of some sort? Install SIS-file that places the
    separate SWFs in correct folder that main SWF can read from?
    3) Is it possible to write to an XML file locally on a cell
    phone?
    4) The application needs to list the separate SWF-files, how
    can this be done?
    As I mentioned, hope you guys can help us out!
    Thanks, Andreas

    ciao,
    1. you can use loadMovie function to load movies localy. but
    you should be using relative paths i.e. more_swfs/new.swf
    2. yes, you can make update SIS files with new/updated
    content, and install in same folder as the previous install. for
    more on update SIS, read the makesis help in the Nokia S60 SDK
    3. yes, but using a third-party .exe helper program. but i
    would suggest using shareobeject to save your data. SO can save
    native AS objects string/number/xml
    4. you can do it in two ways, 1) put a list.txt in your sis,
    and update sis files with updated list.txt 2) you can create a
    sequential loading loop, ie loadVariables("content_" add counter
    add ".txt") and check if the content_n.txt loads its data, if
    there's no data in last loaded text file, it means that file
    doesn't exist. so you should not loadmovie content_n.swf and break
    the loop
    note: this will show user an error message "unable to load
    data", and use can abort/exit the app at this point... so, i will
    recomend the 1st one ;)
    best regards,
    // chall3ng3r //

  • Help a Newbie - Need to Embed swfs into main swf

    I have made a MAIN SWF in which if you click one button, it
    loads one SWF, if you click another button, it loads another SWF.
    The file works perfectly when I test the MAIN SWF...until I
    relocate that MAIN SWF to another file, then it doesn't load the
    internal SWFS. How do I publish the MAIN SWF with the other two
    SWFS embedded? So that my client only has to upload one single SWF
    file and not host the internal ones somewhere?
    Hope this makes sense...Flash is completely foreign to me, so
    be gentle. Thanks!

    Treat Flash as any other content and place it within its own
    containing div. Position the div in the normal flow of the document
    allowing the div to 'stack' with the other divs above and below it.
    If you want to place the Flash such that it 'covers' existing
    content you can use CSS positioning techniques. Options include
    absolute positioning the containing div with the Flash swf within
    it (this removes the div from the normal flow of the document) and
    placing it over the existing content. Us position: absolute; and
    top and left, with px values to place the div where you need it.
    You can find tutorials on absolute positioning in the developer
    center or www.communitymx.com
    You can use the float property and negative margins to pull
    containing divs (or other elements) around the document, too.
    Experimenting with floats can be fun but you need to read up on
    their specific behavior as you can end up pulling your hair out.
    Again, there are plenty of CSS tutorials on positioning and a
    Google search should throw-up some options.
    Outside of CSS you can use DOM Scripting and JavaScript to
    also position and hide various content depending on your
    requirements. If you get stuck come back on this forum and ask for
    more help but provide specific code to help us.

Maybe you are looking for