How do I interact with a loaded swf?

Hi,
I have a "lesson" that I'm building that will display a series of "pages" based on an XML file. I have simple navigation buttons that work to page through the XML file. but I'd like to use load an external SWF file with buttons to use as my navigation panel. Everything is AS 3.0. The code to load the navigation movie looks like this:
// load navigator
   navLoader = new Loader;
   navLoader.contentLoaderInfo.addEventListener(Event.INIT, handleInit);
   navLoader.x = 50;
   navLoader.y = 200;
   lessonSprite.addChild(navLoader);
   navLoader.load( new URLRequest("Navigator1.swf"));
The loaded navigation movie has two buttons. How do I add an event listener to those buttons so that they call a function in the parent movie so I can detect when the user clicks on the button named "GoNext" in the loaded movie?  I've tried several ways but I've had no luck. Could someone please point me in the right direction? This navigation panel is only one application of this sort of communication that I'll need in other parts of this type of lesson so I really need to figure out how to detect user interaction interaction with the loaded movie. Guess I need to know how to call a function in the parent movie from the loaded movie.
Thanks,
Peter H.

Hey Pete,
The answer that you seek and the simplest one as well will be from the MouseEvent. that  you will most likely have applied to your loaded swf.
As long as both swfs are in the same domain, you wont have any issues with security and therefor, the MouseEvent. which bubbles up, will be able to reach your swf file which has loaded it.
You can then write your code in your loaded swf to simply listen to the loadedMovieClip  by targeting the contents of navLoader just like this,
navLoader.content.addEventListener(MouseEvent.MOUSE_DOWN,onDown)
protected function onDown(me:MouseEvent){
now providing you have given your two buttons names in your loaded swf, you will be able to perform addition tasks by receiving the name of the target.
protected function onDown(me:MouseEvent){
var btnClip:Movie= me.target as MovieClip
          var btnName=btnClip.name
if(btnName==(button1)){
     //do the following
}else{
       //it was button two
button1 was just a random name in this case .
This will do the trick

Similar Messages

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

  • How does Openscript Interact with web components ?

    I was wondering how does openscript interact with web objects (eg Edit boxes, buttons), is it through some JNI api ? If yes in which package I can find this ?

    I am going to make the assumption from your comments that you are asking about using OpenScript to test applications based on Apple's WebObjects server. If that is a bad assumption let me know ...
    The scripts you build against the application will work in a similar manner to those that are built against other java based application servers in that the tool will be using the various key attributes of the html objects to locate them and replicate actions against them. Typical UI driven scripting ... That said, if your testing brings you down a level from the UI and you are trying to test some of the components of the application server tier specifically, well, then you might have to write your own java code to do it.

  • Controling a loaded swf with another loaded swf

    I have a blank stage with only AS that loads an swf
    addChildAt(0) and a second one addChildAt(1). This works. When the
    user interacts with (1) it calls another addChild (not indexed) and
    possibly that one loads another, depending on the choices made by
    the user. How can I get any of these to control that very first
    child that was loaded at (0)? I have run out of ideas.
    Some of the code:
    (on the main swf, nothing on the stage, only code that loads
    the next two)
    addChildAt(pHolder, 0);
    pLoader.load(pURLReq);
    pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    pLoaded);
    and for the second:
    addChildAt(mHolder, 1);
    mLoader.load(mURLReq);
    mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    mLoaded);
    On the child of childAt(1), I have:
    function replaceSWF(e:MouseEvent):void
    pLoader = new Loader();
    pLoader.load(new URLRequest("p.swf"));
    pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    placeNewClip);
    function placeNewClip(e:Event):void
    removeChildAt(0);
    addChildAt(e.target.content, 0);
    If I use this exact same code from that very first swf, the
    one that loads the first two external swfs, it works, but once I
    put it on one of hte other loadeds and sub loaded swfs, I can't get
    it to work. In the current state (0) it just makes everything on
    the stage disappear, so I figured then using the index of (1) would
    do it, but that or any other number results in absoluly nothing.
    Help! I am really out of ideas here.
    (the stacking looks like this) ---
    sub second loaded SWF <==== needs to tell first loaded SWF
    to unload then load a new swf at same index
    second loaded SWF <==== loads the next one above
    first loaded SWF <=== needs to be removed and another swf
    loaded at the same index
    mainSWF (loads two others) <=== code placed here works for
    first loaded SWF

    Kglad,
    I tried your code and ran into some problems with stopping
    the mc's, as the embedded mc's within the loaded swf need to stop
    as well. I found the attached code to stop the mc's, but now am
    having trouble with the sound objects.
    Here's the issue, I used this:
    this.soundPosition = currentMovie.loop1.position/1000;
    this.currentMovie.loop1.stop();
    ... for the sound object stop commands and listed a new one
    for each loop I was using. On the play button I started them back
    up again. This all works, but when I start them up again they all
    play, not just the one that is currently paused. Do you mind giving
    me some guidance with the for (obj in mc) loop? My loop experience
    is nil. What I want to do is have the code cycle through all of the
    loops to see which one is playing, then store that information in a
    variable, then pause and play the variable. Does that sound right?
    Thanks again for the help!
    -Sandy

  • How can I interact with a Database?

    I've got a project I'm working on in my Java class, and I can't find out how to make the program interact with a database. I was wondering if anybody here could help me out at all? My partners and I have already gotten most of the program figured out (but not programmed), and this is giving us a little bit of trouble. Our books don't have this information, and our teacher told us to check here, so here I am. Any help would be appreciated. Thanks.

    You need to get a jdbc driver for your database. Your vendor should provide you with one. If not then you can try looking for free implementations of that particular database.
    This jdbc driver is used by your program to execute sql statements in the database itself, removing the need for you to handle all the nitty gritty stuff. Kind of like ODBC.
    Like the earlier post pointed out, the tutorials is a good place to look at code samples
    I've got a project I'm working on in my Java class,
    and I can't find out how to make the program interact
    with a database. I was wondering if anybody here
    could help me out at all? My partners and I have
    already gotten most of the program figured out (but
    not programmed), and this is giving us a little bit of
    trouble. Our books don't have this information, and
    our teacher told us to check here, so here I am. Any
    help would be appreciated. Thanks.

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

  • Interact with content loaded in html overlay / acces accelerometer?

    Hi,
    is it in any way possible to interact with html content loaded in the Web Content overlay?
    Or is there a way to acces the accelerometer in indesign?
    greetz
    Mario

    Moved to DPS forum

  • How do modems interact with efax and ccl scripts to receive calls in 10.5?

    I want to do two things:
    1) alter the modem init string used for faxing and receiving calls, and
    2) alter the RING string to detect and respond to other modem responses during the answer process
    The machine in question is a PowerBook G4 with an Apple Internal Modem (V.92) running Leopard 10.5.1.
    In searching, it seems that Leoard is using efax as its base fax app. I have located the efax plist in the LaunchDaemons folder. It sends the 'answer' command via the 'fax' app to the 'efax' app. This command is an argument key in the plist.
    Now, how do I change the modem init string that is used for the purpose of faxing? Also, how do the modem CCL files interact with this whole process - or do they?
    Thanks in advance for any help you can offer. I'm either just googling for the wrong things or there aren't many people looking for this information? Most likely the former...

    Well, I'm starting to feel like I've got a little blog going on here, since I'm only answering myself - but for anyone else who may someday seek this information, here is a little more:
    In Leopard, when you set up the fax in System Preferences/Printers and Fax, it enables an efax plist used by an application called 'launchd'. When your computer boots up, if that plist is indicated as enabled (using a key within the plist), launchd starts up the 'fax' script with parameters matching what is entered in the fax setup in System Preferences. This script starts up the 'efax' application, which runs continuously in the background, waiting for a call to come in.
    The plists involved are:
    Library\Preferences\com.apple.print.FaxPrefs.plist -- which contains the actual fax preferences, like phone number and number of rings for example, that are ultimately provided to efax.
    System\Library\LaunchDaemons\com.apple.efax.plist -- which is the one used by launchd to start the fax script, and which contains the arguments and path to that script.
    efax does not use the CCL scripts; instead, those seem to be used by the Internet Connection modem selection, as I mentioned previously.
    efax runs in the background constantly. If it were to crash for some reason, launchd would automatically start it up again - unless the fax functionality is turned off in System Preferences, in which case the efax application would be 'turned off', and would no longer run in the background.
    There is a 'lock' feature in efax, which is supposed to temporarily suspend efax while other apps use the modem. So, my next question is whether I can somehow leave the Internet Connect functionality running, exiting when I get the result I want, which would then allow efax to come on up and answer the phone.
    Alright, I'm going to admit it - I'm trying to find a way to make Distinctive Ring work with efax. The PowerBook G4 internal modem can sense Distinctive Ring with a +VDR=n,n value added to the initialization string. Once this is added to the init string, the modem will return the amount of time the ringer is on or off, with values like DRON=8 and DROF=40, as well as the normal RING. Using a CCL script, I can look for those values coming in from the modem instead of the usual RING value. (As far as I can tell, I cannot do this with efax directly without changing the actual source code. The RING value it looks for is hard-coded.) So, the question becomes how to transfer control from the Internet Connect to efax, and can I do so soon enough for it to be able to answer the phone before my AT&T CallNotes does?
    More to come (if someone else doesn't answer my question before I do

  • How should devs interact with the db?

    Good day. For some time my organization has worked as most small shops do: web and software developers log into the database and create their own views, procs, etc. However we have grown to a much larger staff and have begun the process of transitioning into a more "professional" shop.
    In your experience, how should web/software developers (and their products) interact with the production database? In other words, should they send their views to the DBA who will create said views? Or should they not be connecting to views at all? Should they have their own schema on the production database (and this will be the one which holds their views)?
    If you say that the developers should have absolutely no access to the production db at all, then how should their products interact with the database?
    I appreciate any links, advice, etc.
    Thank you.
    EDIT: the developers products are about 75% read-only search/reporting apps and 25% data entry.
    Edited by: 893968 on Oct 12, 2012 8:39 AM

    893968 wrote:
    Good day. For some time my organization has worked as most small shops do: web and software developers log into the database and create their own views, procs, etc. However we have grown to a much larger staff and have begun the process of transitioning into a more "professional" shop.
    In your experience, how should web/software developers (and their products) interact with the production database? In other words, should they send their views to the DBA who will create said views? Or should they not be connecting to views at all? Should they have their own schema on the production database (and this will be the one which holds their views)?
    If you say that the developers should have absolutely no access to the production db at all, then how should their products interact with the database?
    I appreciate any links, advice, etc.
    Thank you.
    EDIT: the developers products are about 75% read-only search/reporting apps and 25% data entry.
    Edited by: 893968 on Oct 12, 2012 8:39 AMThink about this. The earlier in the process that the DBA becomes a reviewer/gatekeeper, the earlier in the process you can eliminate bad design decisions. Bad design decisions can be any of the following and more:
    wrong data types
    badly normalized tables
    use of reserved or key words for object/table/column names
    reinventing wheel (especially common when needing a sequence number)
    object names that make no sense and fit no pattern.
    I'm sure others will chime in with more.
    The point being, if you allow developers the 'create' privilege at any level, they will create things that will become a headache for you further down the road. Let them write queries and procedures ... that's their job. But not tables, indexes, sequences, etc.
    And don't fall for "it's just dev, we can clean it up when we move to QA". No, they won't. At the time it moves to QA it will be "we've got too much invested in this, we can't afford to make those changes now." And regardless of what was agreed to six months earlier, management will side with the developers because they really can't afford to pay for the re-work that would have been avoided in the first place with proper division of responsibility.
    It will be a painful process to bring about. Someone will have to stand firm. And there will always be low-level complaints, but it still comes back to 'if you don't have time to do it right the first time, when will you find time to fix it later?" It's part of the DBA's job to make sure it gets done right the first time, and he will need management support to maintain it.

  • How do I....  - Loading swfs for music festival - some repeat, some don't

    I apologize for the lack of actionscripting knowledge, but
    I'm in a rush to complete something that is beyond my skill and
    hope that you Flash gurus out there can help me.
    Here's the idea...
    I'm creating a sort of movie slideshow to play at a music
    festival which will include several swfs of varying lengths of
    edited video clips embedded into Flash with text animation added
    ---> these I want to load into a main swf with scrolling text
    along the bottom (which I've already created). They can play
    sequentially if necessary and must repeat. In addition to this,
    there will be trivia question swfs that need to also load into this
    movie throughout the festival but they cannot repeat and it would
    be nice if they could be randomly placed amongst the video swfs.
    How do I make this happen and make sure that after each swf has
    ended the next one loads?
    Thanks for any help - I'm on a tight deadline!!

    Swipe right to left on the music list.

  • How to use symbols in a loaded swf

    I want to load a swf file in flex as application with embed
    tag and then create instance of its class. I want to use symbols
    within this swf i.e. to load dynamically those symbols when needed
    and play with it. is it possible in flex builder 3? If yes then how
    and if not then how can it be done? Any suggestion is
    appriciated.

    Hello,
    using that page as guide:
    http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/events/Uncau ghtErrorEvent.html#includeExamplesSummary
    (last sample on where to insert handlers) what about:
    <s:SWFLoader id="swfLoader" init="swfLoaderInitHandler(event)" source="B.swf"/>
    and:
    protected function swfLoaderInitHandler(event:Event):void
         if(!swfLoader.content) return;
         swfLoader.content.loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAU GHT_ERROR,
              uncaughtErrorHandler);
    protected function uncaughtErrorHandler(errorEvent:UncaughtErrorEvent):void
         if(errorEvent.error is Error)
              var e:Error = errorEvent.error as Error;
              // my error is 1009 - it is expected here
              const NULL_ERROR:uint = 1009;
              if(e.errorID == NULL_ERROR)
                   errorEvent.preventDefault();
                   Alert.show(e.errorID+" "+e.message);
              // else fall through
         // else fall through
    B is supposed to fail:
    private var emptyObject:Object = null;
    public function B()
         flash.utils.setTimeout(throwErrorNow, 100);
    protected function throwErrorNow():void
         emptyObject.numericValue();
    regards,
    Peter

  • How to do it with SQL Loader

    All,
    I have two tables HEADER_TABLE and LINE_TABLE. Each header record can have multiple line records. I have to load data from a flat file to these tables.Flat file can have two types of records. H-Header, L-Line. It looks as follows.. Each H record can have multiple corresponding L records
    H..........
    L.......
    L......
    L......
    H.........
    L.......
    L......
    L......
    I have HEADER_ID column in HEADER_TABLE and HEADER_ID, LINE_ID columns in the LINE_TABLE.
    While loading data using SQL Loader, I need to generate HEADER_ID and LINE_ID values as follows and load them.
    H..........<HEADER_ID = 1>
    L....... <HEADER_ID = 1><LINE_ID = 1>
    L...... <HEADER_ID = 1><LINE_ID = 2>
    L...... <HEADER_ID = 1><LINE_ID = 3>
    H......... <HEADER_ID = 2>
    L....... <HEADER_ID = 2><LINE_ID = 4>
    L...... <HEADER_ID = 2><LINE_ID = 5>
    L...... <HEADER_ID = 2><LINE_ID = 6>
    Is it possible to do this with SQL LODER?
    I tried to do this with sequences. But it loaded the tables as follows.
    H..........<HEADER_ID = 1>
    L....... <HEADER_ID = 1><LINE_ID = 1>
    L...... <HEADER_ID = 1><LINE_ID = 2>
    L...... <HEADER_ID = 1><LINE_ID = 3>
    H......... <HEADER_ID = 2>
    L....... <HEADER_ID = 1><LINE_ID = 4>
    L...... <HEADER_ID = 1><LINE_ID = 5>
    L...... <HEADER_ID = 1><LINE_ID = 6>
    Thanks
    Ketha

    Morgan,
    Examples given in the link are quite generic and I have tried them. But my requirement is focused on generating header_id and line_id values as i have described. It seems that SQLLDR scans all records for a particular WHEN clause and insert them into the specified table. I think that if SQLLDR is made to read recod in the data file sequentially, this can be done.
    ANy idea of how to make SQLLDR read the records from the file sequentially?
    Thanks
    Ketha

  • How to play Animation with site loading in background to reveal website?

    So I know there are pre loaders and you can make that with edge... But they are so small and just a little circle moving around or something... I more mean a full page pre-loader then I guess...
    I have created an animation of a M with marquee lights going around and slowly zooming in... Then I have the M fade out and I have a black solid layer move up and another black solid layer move down to reveal the blank stage below...
    What I want to happen is maybe with some java script but to have the solids move out of the way to reveal my site bellow... Anyone know how to accomplish this?
    Thanks so much! I think being able to do things like this in native html and css and java will be huge for giving websites a "Font Door" or Opening Title like we have in movies... Thanks so much!

    first I recommend that you use mouseenter and mouseleave instead.
    second: if you have a symbol that has let's say one animation you can do
    on mouse enter
    sym.getSymbol('symbolname').play();
    on mouseleave:
    sym.getSymbol('symbolname').playReverse();
    you may have to add
    sym.getComposition().getStage().getSymbol('symbolname').play();
    sym.getComposition().getStage().getSymbol('symbolname').playReverse();
    or you can put the event in stage/compositionreday
    sym.getSymbol('symbolname').mouseenter(function(){
    sym.getSymbol('symbolname').play();
    sym.getSymbol('symbolname').mouseleave(function(){
    sym.getSymbol('symbolname').play();

  • How does airplay interact with Time Machine?

    I just purchased a MacBook Pro, but the 256GB of flash storage is not going to be enough for my projects and media.  My iTunes library has become pretty extensive, so I'm wondering if I'll be able to stream to my TV the content in my iTunes using Time Machine in combination with Apple TV?  Anyone have this set up?

    Time Machine is software that backs up the contents of your Mac.  You will not be able to use those backups for everyday use to stream media over your network.
    Suggest that you add another external hard drive and move your iTunes library to that drive.
    Then Time Machine will backup both your Mac and the contents of the external drive. So, you have "originals" on one drive and "backups" on another. If one drive fails, then you at least have a copy on the other drive.

  • How can i interact with the ALV if i am using the lvc_ and call method?

    i want to hide the last entry of a line when i click on the checbox of my ALV

    u want to hide or delete?
    instead of using check box, u can use a button to display there.
    it can be achived like below.
    data: ls_lvclayout type lvc_s_layo.
    LS_LVCLAYOUT-SEL_MODE = 'D'.
    now in set_table for_first_diaplay
    CALL METHOD GO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
          <b>  IS_LAYOUT            = LS_LVCLAYOUT</b>
    do like above.
    then u click on the row, and the row will be selected.
    now using the method GET_SELECTED_ROWS, u can get the data of the selected row and u can now manipulate what ever u needed.
    data:
    SEL_ROW TYPE LVC_S_ROID,
    SEL_T_ROW TYPE LVC_T_ROID.
    CALL METHOD GO_GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_ROW_NO = SEL_T_ROW.
    LOOP AT SEL_T_ROW INTO SEL_ROW.
              read table <itab> index SEL_ROW-ROW_ID.
              check sy-subrc = 0.
    < now write the logic  like making the field blank and modify the itab>.       
            ENDLOOP.

Maybe you are looking for

  • SQL Trace in SAP Manufacturing Execution Logging Configuration disappear

    Dears, We set it to trace the sql log, but it often disappear suddently. The log may as below for your referenct. Thanks! #2.0 #2011 04 01 16:15:13:836#+0800#Info#com.sap.me.trace# ##sap.com/meear#68B5996B863C332900000000000010A8#1859650000000004#sap

  • "Select" Physical table as LTS for a Fact table

    Hi, I am very new to OBIEE, still in the learning phase. Scenario 1: I have a "Select" Physical table which is joined (inner join) to a Fact table in the Physical layer. I have other dimensions joined to this fact table. In BMM, I created a logical t

  • DMS Errors in PLM Web UI

    Hi Folks, I am running into errors when trying to edit an original and add an original to a DIR using the PLM Web UI (everything works fine in SAPGUI). Upon opening the DIR (which as created in SAPGUI) I get the warning "No entry for the document mai

  • Issue in Maintenance View

    Hi All -   I have added new field in existing Maintenance view and I have regenerated the table maintenece generated. The view had APPLK (Application area) application filed earlier which was showing field value, but after i re generated the view its

  • Upgrade to 3.1.1 broke drag and drop form items

    after upgrading to 3.1.1 when I click the drag and drop icon in items on a form i can then move the fields around and when I hit next the page shows no fields, if I then click apply and look at the form the fields have not moved..