Accessing events from externally loaded swf file

hello,
I have an swf file developed in flash 8. After loading that
file into SWF Loader control in flex builder 3, how can we access
the controls and events present in that particular file ?

"surya_dhul" <[email protected]> wrote in
message
news:gg84e2$slm$[email protected]..
> hello,
> I have an swf file developed in flash 8. After loading
> that
> file into SWF Loader control in flex builder 3, how can
we access the
> controls
> and events present in that particular file ?
I think you'll need to use localConnection.

Similar Messages

  • Passing events from externally-loaded SWFs

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

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

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

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

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

  • Listening to Events from inside loaded swf

    In Flash Builder 4 I have a swfLoader with which I load swf files. The swf files that get loaded get created in Flash Pro, and I would like to be able to listen for events from the level that they get loaded from. What would I have to specify in the Flash file for the path? Can't seem to be able to specify the right path.
    Thanks a lot for any help!

    I wouldnt say this is elegant but we have been having issues gaining direct access to the SWF's loaded in via OSMF. However I have done setups where I dispatch an event from a SWF and have it bubble up and catch it on the MediaContainer level. Not elegant but works- otherwise may need to make a custom MediaElement and bypass the SWFElement to gain tighter control - seems like there should be a better way, but I havnt found it.

  • Moving the timeline from a loaded swf file

    Hi,
    I have been at this problem for awhile now.
    I have a two swf files, whic are loaded using ths code as an example:
    stop();
    var req:URLRequest = new URLRequest("Enchilada_A.swf");
    var loader:Loader = new Loader();
    function imageLoaded(event:Event):void {
        ldContainerB.addChild(loader);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
    loader.load(req);
    The first one is triggerrd by a MC button that is on the timeline.
    That first swf loads fine.
    At the end of that file(which is short animation)
    I have code that says:
    MovieClip(parent).gotoAndStop("frameThree");
    I have also tried:
    MovieClip(root) and
    if (movie Clip is parent) {
    MovieClip(parent).gotoAndStop("frameThree");
    and/MovieClip(parent).nextFrame();
    I have also tried placing this. or root. into the code.
    I am not talking to the timeline from this swf file.
    Once the timeline moves to the next Frame the new swf file can load.
    My solution was to combine both swf files into one, which loads from the timeline button.
    It works and I can gt by but I really woud like to learn how to load a swf and talk to the timeline fro more flexibilty.
    I'm out of strategies.
    Is my code in the wrong place(at the last frame of the animation?
    Should it be written on the timeline by creating a new var that has a function once the animation is completed.
    Any suggestions and/or commens would be greatly appreciated.
    Thanks.

    Thanks,
    I finally had a chance to get back to this project and used your suggestions, whichare definitiley helpful. I also, created a new and very basic version of the project so I could easily see what was happening.
    This is the code that works:
    stop();
    MovieClip(parent.parent).nextFrame();
    trace(container_mc);
    I'm still trying to understand how the child parent relationship is working but this will get me going in the right direction.

  • 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

  • Using the DateField in an Externally loaded SWF

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

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

  • How to detect the end of a loaded swf file

    Hello Guys
    This is my first time on this forum, come here with a great
    hope
    I have loaded a picture file (jpeg) and a video file (swf)
    into the main flash file using xml
    on frame 3, I load the picture and on frame 7, I load the
    video, there is a stop action on frame 6
    Now when the flash is executed the picture is displayed ( it
    says "Click here to view the video")
    when the user click the picture , the video is loaded and
    starts to play ---- so far everything is working fine
    now what I want to do is, once the video finishes playing (
    not stoped) I want to display the picture again
    can you tell me how to detect the end of an external loaded
    swf files,
    Please help me
    Thanking You
    Shriram

  • Loading swf files from an iPhone Air App

    Although the faq says its possible ( http://bit.ly/gyxmCo  )  I can't seem to load .swf files from my app.
    There's no .AS code in the .swf file I'm trying to load.
    PNG files load with no problems, swf's fail.
    A working example would be appreciated instead of suggestions, I've spent the entire day trying out suggestions
    regards,
    Martijn

    Because I can't see any library assets in an as2.0 file.
    I've discovered that the swf fails to load as soon as you make a symbol 'export for actionscript'
    probably because it will then create a class. So you can only load SWF's as simple pictures or animations, you cant use it as an asset library with multiple animations/images/sounds in it..
    As for you other questions:
    it doesnt matter if the file is local or on the web. same results
    I created the swf file from a fla in CS4,  and I'm compiling my air project that loads the swf  with FlashDevelop.

  • 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

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

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

  • Dynamic Text in Externally Loaded swf

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

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

  • How to create an xml to load swf files in sequence?

    hello everyone
    I'm new in web design... I know how to animate in flash, using timeline, frames, layers, twins and so on... But I want to move forward so I want to create a xml to load swf files in sequence and in loop. Each swf file has 8 seconds.You can see the example here in www.cm-seixal.pt.
    I'm not a programmer but I understand how actionscript works... I hope you can help me
    Cheers!
    Ana

    you can use the urlloader class to load your xml file.  use the loader's complete event and the loader's data property to retrieve the data in your xml file.

  • Loaded swf file alignment

    when i i design something in a file i have it aligned how i
    want it, however when i load the page into another, although the
    loader component is aligned, the content inside the loaded swf file
    is no longer where it should be. why is that? how can i fix this?
    i've just been

    Also, remember that if you load an external SWF into another
    movieClip, then the _root changes. The loaded SWF will no longer be
    considered _root, unless you specify in frame 1:
    this._lockroot = true;
    this would be the issue of your miss-alignment, if you are
    using ActionScript to align objects dynamically.
    If you are not using actionscript for alignment, then
    Mocaloca's suggestion should be the answer.

Maybe you are looking for

  • CL_GUI_FRONTEND_SERVICES, Subscreen not found error

    Hello everyone, We'd like to use the file service methods of class CL_GUI_FRONTEND_SERVICES such as GET_SAPGUI_WORKDIR, GUI_DOWNLOAD and DIRECTORY_LIST_FILES in developing an upload facility that will be accessed via Integrated ITS. However, when we

  • How do I manually change the order of songs in a playlist?

    What am I missing?

  • Flummoxed by Microsoft - advice needed...

    Hi all, I need some help here.  I recently purchased a Lenovo X200 notebook at auction.  As is their want at these places, they removed the hard drive for 'data protection' purposes, so I basically purchased the laptop without a hard drive. "No probl

  • Where should i put oracle logo in my resume ...

    hie everyone ... i just received OCA certification ( 10g DBA ) and SQL Certified Expert ... now where should i put those logos in my resume ... someone mentioned that i can put them in HEADER of my resume ... any other advice ?? thanks in advance for

  • Third party cookie block on Internet Explorer

    I blocked third-party cookie access on IE, now every time I try to open IE, a window pops up asking to allow or block. Regardless which choice I make or how many times, it will not go away. I can not access the tools to change it with the cookie wind