Can't target main stage from dynamically loaded swf...

A part of the Flash app. I'm working on right now does the following -
Main stage loads an external swf using the following function:
function loadAsset(evt:String):void{
var assetName:String = evt;
if (assetName != null){
  var assetLdr:Loader = new Loader(); 
  var assetURL:String = assetName; 
  var assetURLReq:URLRequest = new URLRequest(assetURL); 
  assetLdr.load(assetURLReq); 
  assetLdr.contentLoaderInfo.addEventListener( Event.INIT , loaded) 
  assetLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, displayAssetLoaderProgress);  
  function loaded(event:Event):void { 
   var targetLoader:Loader = Loader(event.target.loader); 
   assetWindow.addChild(targetLoader);
The externally loaded swf loads another external swf into itself using the following function:
function loadQuiz(evt:String):void{   
var quizName:String = evt;
if (quizName != null){
  var quizLdr:Loader = new Loader();
  var quizURL:String = quizName;
  var quizURLReq:URLRequest = new URLRequest(quizURL);
  quizLdr.load(quizURLReq);
  quizLdr.contentLoaderInfo.addEventListener( Event.INIT , loaded)       
  quizLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, displayQuizLoaderProgress); 
  function loaded(event:Event):void {
   var targetLoader:Loader = Loader(event.target.loader);
   quizWindow.assetLoader.addChild(targetLoader);     
Everything loads fine, but from the quizWindow.assetLoader.addChild(targetLoader) level, I want to send a message/fill in a dynamic text box on the Main Stage. I have been "parenting" my brains out and I'm not sure how to communicate with that level.
can anyone show me the proper path or method based off the above, or have a suggestion?
Cheers,
~Chipleh

Andrei1,
Thanks again for your help. I was finally able to get the solution you posted below to work for me.
Much appreciation,
~Chipleh
"In your loaded movie write:
function traceMyself(e:MouseEvent):void{
     dispatchEvent(new Event("I_WANT_TEXT"));
function writeText(text:String):void {
     xmlFileName1.text = text;
In the top movie that loads external swfs something like that:
loadedSwf.addEventListener("I_WANT_TEXT", onTextRequest, true);
function onTextRequest(e:Event):void {
     Object(e.target).writeText(tQuizXmlFile1.theQuizXmlFile.text);
This way these two entities are independent and, most importantly, don't care who is the parent or grandparent."

Similar Messages

  • Control the property of an object in main stage from a loaded swf timeline

    please someone help me here, im loosing my mind
    i have a UILoader that loads an image from an xml list when you click its thumbnail ( in its thumbnails mc on mainstage aswell)
    thing is, i have another UILoader on the layer above that loads in a swf ( a slideshow that fades in and out the pictures when they change to the next,
    with all the coding on frame 1, frame 2 only has a stop and some code for when the mouse is idle for 5 secs it goes back to frame 1)
    so when you go to "portraits" it takes you to frame "x" where the slideshow ( loaded external swf ) starts playing automaticly right,
    if i click any thumbnail the slideshow goes to frame 2 ( wich is perfect and the mouse idle thing i wanted works great ) the ONLY THING IS
    after the slideshow runs by default for the first time ( i enter the category portraits )
    and i click any thumbnail ( moving slideshow swf to frame 2 enabling mouse idle event )
    and the mouse is idle ( so it does the event and starts playing the slideshow again ( goes back to frame 1 ) )
    I CANT MAKE THE UILOADER OF THE THUMBS IMAGE TO DISSAPPEAR!!!
    i have tried everything i can think of and everything i have read trying to adapt it with what i know,
    im no guru at this i reeeeally need some help
    THANK YOU  SO VERY MUCH ! 

    and where would i put the remove.simpleScreen ( simpleScreen is the loader i would want to remove )
    would it be on the external swf on frame 1 where the slideshow plays?
    or in the main timeline's category's frame?
    the problem ( that i see ) is that both loaders are on the same frame ( different layers tho )
    so if i put a the remove simplescreen there it wont show me the pictures when i click the thumbs
    or could i make it so that it removes it BECAUSE its playing on frame 1 ?

  • 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

  • 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.

  • Can I Capture Javascript Calls from a Loaded SWF?

    My scenario:
    My main movie (SWF A) loads another movie (SWF B) and plays it.
    SWF B is legacy content - I can't modify it.
    SWF A is AS3. SWF B might be AS2 or AS3
    SWF B makes several calls to a javascript function that would normally reside in the hosting web page.
    The javascript calls might use ExternalInterface, or they might use getURL(javascript: xxx) or they might even use fscommand.
    My questions:
    Is there any way I can intercept the javascript call in movie A? I don't want to have to resort to the browser, so simply using ExternalInterface or similar to pipe the request back into the movie won't work.
    If there is a way, how does it vary across the different versions (ie. what's the difference between the child movie being AS2 or AS3, and what's the difference between the various means of calling js?
    I'm working on a web deployment, using Flex 4.0. I would be interested also in whether this is possible in Air, or Air Mobile.
    Many thanks in advance for any replies.
    JcFx
    http://www.jcfx.eu

    no, not with all those constraints.

  • Access main stage from a symbol timeline?

    Can I access main stage  from a symbol timeline?
    Eg:
    I have a symbol called "ball" and its own time line. There is a close button at the end of ball's timeline,
    When close button pressed, I want to go back to main timeline.
    Thanks
    Phyle

    Thanks Hemanth.  I will try to explain.
    Open Edge animate. On the main stage I added a label called "home".
    I created circle, converted to symbol, renamed to "ball".
    Inside "ball" , I have a animation, at the end there is a button called "closeBt"
    When "closeBt" pressed, I want to go back to main stage "home"

  • How to target a label on the stage from a loaded composition

    from EdgeCommons I'm using EC.loadComposition to load another website into a container within EA.
    Now, from a button inside this loaded composition I would like to call a stop function to target a label on the main stage of the EA file.
    sym.getComposition().getStage().stop("scene4"); does not work.
    It think it has to go outside of sym because the composition container is actually an iframe.
    Thank you

    Hi,
    I think you may have replied to my post accidentally. I had asked a question regarding javascripts that could target the stage from a symbol, not about coloring book apps.  However I have made one in Flash, here is the page I made (don't laugh, I never finished it).
    http://boogerbunch.com/home.html
    Here is a link to the forum I used to get the Info to build it, I would think the process would be very close in edge.
    http://www.kirupa.com/developer/mx2004/coloringbook.htm
    Good luck!
    >>> scottsalter0 <[email protected]> 3/1/2013 10:29 AM >>>
    Adobe Community ( http://forums.adobe.com/index.jspa )
    Re: How to target a label on the stage from a div embedded in a symbol?
    created by scottsalter0 ( http://forums.adobe.com/people/scottsalter0 ) in Edge Animate - View the full discussion ( http://forums.adobe.com/message/5113759#5113759 ) 
    Hi there,
    I noticed your Edge Colouring Page post on the Adobe Forums.
    For my University work, I need to create a colouring page using Adobe Edge Animate. Is it possible if you could post a tutorial or step-by-step guide on how to do this please?
    Many Thanks
    Reply to this message by replying to this email -or- go to the message on Adobe Community ( http://forums.adobe.com/message/5113759#5113759 )
    Start a new discussion in Edge Animate by email ( mailto:[email protected] ) or at Adobe Community ( http://forums.adobe.com/choose-container!input.jspa?contentType=1&containerType=14&contain er=4823 )

  • Accessing buttons on main stage from inside of a movie clip

    Greetings...
          here is the scenario:
                 - I have buttons on main stage, and a swf file which is loaded to scene using a LOADER in AS3
                 - this is a website, so the problem rises when user moves its cursor around the page and now  buttons in main stage,
                    are still active since they are behind the loaded swf file.
                 - i would like to learn, how can i CODE inside the loaded SWF file, to either remove the buttons in main page, or remove
                    the event listeners. not sure if my case has anything to do with .Parent or .roo, (I want to access those main stage
                    buttons from the SWF file which is loaded)
                 - The general case is, i have SWF files loading inside another SWF files, is it possible to access items on each stage from
                    inside of loaded SWF files on that specific stage. Similarly i would be interested to learn about accessing main stage from inside
                    of movieclips running on stage. how can i access something not in present FLA file yet, in FLA file that is loading the page as SWF.
                    Thanks.

    If you load an swf into another using the Loader class, then the Loader itself is the parent of the loaded swf., so MovieClip(parent.parent) might help you to target the timeline that the Loader was born from.  The more proper way to have a loaded file talk to a parent file is thru dispatching events that the parent assigns listeners for after the file has loaded.  Here's a link to a posting that might help explain how to implement this.
    http://forums.adobe.com/thread/470135?tstart=120
    As for the buttons that you want to disable, you could either use the removeEventListener() method to remove the listeners you have assigned, or you could set their mouseEnabled property to false, or you could set their visible property to false.

  • How to access frame lable on main stage from a nested symbol

    All-
    I have two buttons
    btnA on the main stage
    btnB is nested inside btnA
    How do I access a frame lable on the main stage from btnB

    ok i figured this one out.
    i created a button symbol 'BTN-NAV-INTRO' and placed it on the main stage.
    i created a mouse over/out effect on it's timeline with an object on top called 'MC-HIT-AREA' 
    i placed the mouse over graphics inside the button and animated them on their own timelines
    coded the MC-HIT-AREA to play those timelines 'MC-HIT-AREA' is nested inside the button
    then on the main stage (this is what threw me) i set the button ('BTN-NAV-INTRO') to cursor and coded it to call the other button form the main stage.  Nesting it wasn't necessary.  I didn't realize you could have multiple mouse over/out effect below a mouse over effect from the main stage
    Edge rocks when i get it to do my bidding! 

  • Calling a function in a flex app from a loaded SWF

    How can I call a function in a flex application from a loaded
    swf file?

    Two ways:
    Application.application returns a reference to the top-level
    application scope. You can access any public member, var, function,
    component, etc through that reference.
    Dispatch an event event form the loaded swf and use a event
    handler in the main app. All the gurus advise this as best
    practice, to ensure "loose coupling" It is also pretty easy,
    especially if you use a bubbling event.
    Tracy

  • TotalFrames of dynamically loaded swf

    I've been trying for 2 days now to find the total number of frames of a dynamically loaded .swf.
    Here's an example code:
    var loader:Loader = new Loader;
    loader.load(new URLRequest("mop.swf"))
    master_mc.addChild(loader);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, xmlLoadedF);
    function xmlLoadedF(event:Event):void
        trace(loader.content.totalFrames);
    I am truly puzzled.
    Any help would be greatly appreciated.

    I think this might be complicated by loading an AS2 movie into an AS3 document.
    The error message is telling you that there is no totalFrames property and in fact AS2 movies would have a _totalframes property.
    So you could try that.
    Also I'm not sure if event.currentTarget.content returns a MovieClip or a DisplayObject. If it is a DisplayObject (which is most likely) then it too wouldn't have  totalFrames property. So you might need to cast it as a MovieClip. Something like this:
    MovieClip(event.currentTarget.content).totalFrames
    And or it could be some combination of these two above issues? I don't know really, I'm just grasping at straws. But I don't see any way to know when a clip is done playing other than to compare its currentFrame to totalFrames.

  • Referencing a button on main stage from inside a movieclip

    I am banging my head against the wall on this.
    On the main stage I have a button that I have made invisible once the file is loaded.  Inside a movieclip I have on frame 15 the following actionscript 3 code
    button_mc.visible = true;
    I want the button to become visible at the end of this movieclip.  I am not using an external as3 file, I am putting the as3 code in its own layer on the first frame.
    I know it has something to do with the path to the button, but I cannot figure it out.  If there is anyone who can point me in the right direction for referencing instances by instance name that reside on the main satge from inside a movieclip I would be very grateful.
    Thanks
    Thepopguy

    Try:
    MovieClip(this.parent).button_mc.visible = true;

  • Dynamically loaded swf to communicate with MovieClip on the stage

    I have a heck of time here with an issue. I have an xml document that when a certain button on the stage is clicked it loads it's corresponding external swf into an empty movieclip on the stage. This empty movie clip is a holder for all external swfs.
    So what I'm trying to do is when an external swf is loaded that has buttons on it, I need those buttons to communicate with the main timeline and remove a mc that is on the Stage. I need the currently loaded swf(s) to be able to do this. So whatever the currently loaded external swf is that's loaded, I need it to talk to the main timeline. (I have quite a few external swfs that need to do this) So I imagine I need to somehow target the currently loaded external swf to get it to talk to the main timeline.
    The code below in summary doesn't work but it doesn't give errors either. I don't pretend to know what I'm doing and I haven't been successful in searching for a solution to this particular issue. If someone could give me guidance or direct me to a solution. I'd so much appreciate it.
    // main timeline object
    var index:Object=this;
    function loadComplete (e:Event) {
            TweenMax.to(index.mcholder,1, {alpha: .5});
    // add the current module to the mcholder movieclip by using addChild
            index.mcholder.addChild(e.currentTarget.content);
           (e.currentTarget.content as MovieClip).addEventListener("eventTriggered", startListener);
    function startListener(e:Event):void {
    var ext_swf:MovieClip;
    ext_swf = e.currentTarget.content as MovieClip;
    trace("external swf");
    ext_swf.button1.addEventListener(MouseEvent.CLICK, talktomainswf);
    function talktomainswf():void {
    TweenMax.to(index.mc_thatsonthestage, 1, {x:1000});
    // now we have the first load we set firstLoad to false
            index.firstLoad = false;
        function loadError (e:Event) {
            trace("error");

    You can use the event dispatcher to communicate between external swfs and a main timeline,
    like so:
    //in an external swf
    //Once loaded
    function onLoadComplete(event:Event):void
         //dispatch an event in the form of a string
         dispatchEvent(new Event("Talk to Main Timeline")); 
    //On the Main timeline
    //listen for "Talk to Main Timeline"
    stage.addEventListener("Talk to Main Timeline", listenForCallsFromExternalFiles, true);
    //if the event is heard, do this:
    function listenForCallsFromExternalFiles(e:Event):void
         trace("I heard ya, now do stuff...");
    That's the basic idea anyways, I use it all the time.
    hope that helps,
    ~chipleh

  • Can JavaHelp open Main Window from an HTML Topic?

    Hi all,
    I am working on opening the main window from an HTML topic. Is it possible to do? Right now, what I can do is to make a link in the html page open the secondary window with navigation pane.
    Also, can I set different textColor(param name of object tag)beside the one mentions in the JavaHelp System user's guide?
    More question. When I give the textColor as "green" which is the color I can set according to the JavaHelp System user's guide in the object tag, the help system displays different shade of green, lime. I tested this settng in IE/Firefox. It renders a default green which is what I need. How can I make the javahelp renders properly?
    Any help would be appreciated,
    thanks

    Hi Dir-t,
    There's no way to create that behavior directly in Catalyst. However, you can do it with a little HTML hacking. You'll want to use the IFRAME tag: http://www.w3schools.com/TAGS/tag_iframe.asp
    When you publish your project as a SWF, one of the files that is created is an HTML file that wraps your SWF (it's typically called Main.html). You'll want to edit that file.
    -Adam

  • AttachMovie from a loaded SWF

    I'm trying to attach a movie from the library of an SWF I
    loaded... from what I've read on on the forums, this is possible,
    however I can't seem to get it to work. My setup for the test files
    is as follows:
    CONTAINER.SWF (parent file)
    - creates empty_mc to hold child.swf
    - loads child swf into empty_mc
    - when child.swf is loaded, it calls:
    _root.attachMovie("test_mc","myParentTest_mc",50);
    CHILD.SWF (child clip)
    (insde is a clip "test_mc" with a linkID to match)
    Any help on syntax or what I might be doing wrong would be
    appreciated. If this setup won't work, could it work the other way?
    (CHILD.SWF attaches a symbol from the CONTAINER.SWF???)

    Thank-you for the response, I thought of that... In my
    situation, I need to be able to select one of many large files, and
    attach assets from it as needed. In order for me to use attach
    movie, using shared library assets, they first need to be placed on
    the stage before the linkID is properly initialized. If I have to
    do this for each "large file" it causes a jump in memory on file
    startup. See my other post in the Flash General Discussion:
    External
    Assets and Memory Jump

Maybe you are looking for

  • How can i get a print of all my registered apple products?

    How can I get a list of all my registered Apple products so I can print and keep on hand?

  • Where to find deltas in generic extraction

    hi experts, could you please explain me tcodes which are used to find the delta data while we go for generic extraction. Also can anyone explain me the full process of extracting the data using   infoset query and function module. Cheers, Pragya.

  • Best way to derive a "week ending" date using the Derived Column Transformations

    Hi, I have an interesting challenge. I am working on creating a BI DB that contains timesheet data. The data contains a column representing the date "worked"  ([Date]. Nearly all output reporting is based on a timesheeting week that end on a Wednesda

  • RMI server and german umlaute

    My rmi server does not show german umlaute after rebooting the linux box. It is started by a script in init.d/rc5. The script calls a C routine that really starts the server. The crazy thing is that if I remove the script from init.d/rc5 and call it

  • From Family .me to iCloud?

    We have always used a family .me account.  I have an ipad, iphone and mac so I like and use the sync feature.  My wife on the other hand has only and iphone, we have always used the same itunes account.  I like an idiot did changed her .me account to