How do you reference the main timeline of swf1 from swf2 when swf2 is loaded into swf1?

on this link          http://kb2.adobe.com/community/publishing/918/cpsid_91887.html
I found this script, but I can not use it can anyone help me
// create a variable to reference swf1's main timeline
var swf1Main_mc:MovieClip;  // this assumes that swf1 is a movieclip.
// create your listener to ensure this loaded swf has been added to the display list and can therefore obtain a
// reference to its main timeline (which is always the main timeline of the loading swf).
this.addEventListener(Event.ADDED_TO_STAGE, initF);
function initF(e:Event):void{
    swf1Main_mc = MovieClip(this.root);

You don't make it clear what event finish is for. But let's assume that your MC is being loaded from the clip that you're referring to as root. In the main Document Class of that swf, you'd have
protected var customSwf:CustomSwf;//customSwf is the Class that defines your functionInSwf1protected function someFunction():void {
     var loader:Loader = new loader();
     loader.contentLoaderInfo.addEventListener(Event.COMPLETE onLoaderLoaded);
     //rest of your loader loading code here
protected function onLoaderLoaded(e:Event):void {
      //add to display list (you already know how to do, so I'm not writing the code)
     EventDispatcher(e.target).removeEventListener(Event.Complete, onLoaderLoaded);
     //if you had a legitimate need for path (which you don't) in mcExternal, you'd set it like this:
     this.mcExternal.path = LoaderInfo(e.target).content as MovieClip;
      //this is what you actually need to care about to do this correctly
      customSwf = LoaderInfo(e.target).content as CustomSwf;
Now, the Class that you apply to the library symbol you're using for mcExternal should have code similar to this:
protected function fEvent(e:Event):void {
     dispatchEvent(new Event('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', true));
back in your main document Class:
//should probably call from the constructor or somewhere early in the process
protected function init():void {
     //use your real event name--your code isn't expressive enough I could guess a good name
     addEventListener('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', onEventHappened);
protected function onEventHappened(e:Event):void {
     customSwf.customFunctioninSwf1();
     customSwf.changeVisualState();//let custom swf change alpha and change the frame #
To the untrained I, this looks like about the same amount of code and slightly more trouble, but changing the design like this will make it much more tolerant of the changes that nearly all clients will want after you've built version 1. mcExternal's code doesn't have to change at all if swf1 changes, and your root Class already knows abotu swf1 anyway, since it's doing the loading, so having it work with it a little more doesn't hurt.
Moving the change of visual state into your custom swf means that changes in that swf won't affect your main document Class, though you will probably have to recompile the main document unless you go to using an Interface (a topic for another day).

Similar Messages

  • How can I reference the main timeline on a swf once it was loaded into another?

    I have an swf with some custon animation functions using actionscript 3. I'm refering to the main timeline with Movieclip(root) and it works just fine.
    However, this swf is going to be loaded inside another (a custom player), and when that happends, everything stops working.
    I think it's because the Movieclip(root) is now referencing to the loader swf and not the loaded anymore, but I just can't find any information on how to fix that.

    This is basically what I´m doing here:
    I'm placing this code on frame 1, and calling the function textAnimate() whenever I need to insert some text.
    // This is a variable I created for tracking the timeline
    var base:MovieClip = MovieClip(root);
    function textAnimate(movieName:String, espera:Number):void {
              //var espera:Number = 1; //Waiting time
              var objeto:MovieClip = base[movieName]; //Variable to select the object
              var posFinal:Number = objeto.x; // Object position
              var posEnter:String = "-160"; // Animation start (relative)
              var posExit:String = "+160"; // Animation end (relative)
              // enter animation
              TweenMax.from(objeto, 1, {x:posEnter, alpha:0, blurFilter:{blurX:40}, ease:Back.easeOut});
              //call exitAnimation() after X seconds
              TweenMax.delayedCall(espera,exitAnimation);
              //exit animation
              function exitAnimation() {
                        TweenMax.to(objeto, 1, {x:posExit, alpha:0, blurFilter:{blurX:40}, ease:Back.easeIn});
    The swf works fine, but once it´s loaded into the player, nothing works anymore. Unfortunately, I don't have the code for the player, and can't change anything about it... :/

  • TS3899 In ios7 how do you limit the number of emails downloaded from your ISP server?  Previous version allowed you to limit it to 50, 100, etc.

    In ios7 how do you limit the number of emails downloaded from the ISP server?  Previous version allowed you limit the download to the last 50, 100, etc.

    Hi,
    Unfortunately, this is a feature that Apple have taken away.
    The best way to let them know you want it back is via http://www.apple.com/feedback/
    Regards

  • How do you limit the number of rows return from query?

    How do you limit the number of rows return from query? Do all databases support this kind of feature?

    i think the standard is limit
    to get the top 30
    select * from mytable LIMIT 30;returns the first 30 rows
    also if you want a range
    select * from mytable LIMIT 10,30;returns 30 rows starting from 10
    this last one is useful for displaying ranges... something similar happens in these forums when viewing topics and messages

  • How do you set the "add-on" tool bar to disapear when it's inactive?

    I discovered the bottom of the page "add-on" tool bar.
    I downloaded the progress bar and it's working just great. Exactly as it should be.
    Now, how do you make the bottom "add-on" tool bar disappear when it's "inactive" and become "visible" only when it's "active"?

    Hrm... that may be true and this may be a function of the phone email client that Apple just doesn't do.
    No, I can easily MANUALLY delete the messages. I would prefer if I didn't have to do it twice, tho. Once on the mail server and once on the phone.
    What I think the phone needs to do is, when it checks the POP, anything NOT there should be removed locally. I think you are correct on POP; the phone will poll the mx (mail exchanger) and the mx will pass off the messages to the phone. The phone then keeps ALL of that unitl you manually delete it.
    If, say, I remove a message from the mx, I would like the phone, when next polls, to see that that particular message isn't on the server anymore and remove it locally.
    Perhaps it's just me but if I delete the message on the mx itself, via my ISP's webmail interface, I really don't want to have to remove it again from my phone.
    thxs!
    cheers
    rOot

  • HT4589 How do I change the audio to dual mono from stereo when using Share to DVD in Final Cut 10.1?

    How do I switch the audio to Dual Mono from Stereo when using Share in Final Cut Pro 10.1? Even though the audio is all in dual mono in the timeline, it lists it as stereo in the share box.

    Hi rationale1,
    Welcome to the Support Communities!
    The share to DVD settings in Final Cut Pro X use the Dolby Digital settings which are stereo for DVDs. So this can’t be done directly in Final Cut Pro X.
    The link below will explain the Dolby Digital parameters and options in Compressor 4.   You may need to research a different DVD authoring software to achieve your desired result.
    Dolby Digital - Compressor 4 User Manual
    http://help.apple.com/compressor/mac/4.1/#cpsrb71736a2
    Dolby Digital
    The built-in Dolby Digital settings (in the Create Blu-ray and Create DVD destinations, as well as the built-in AC-3 and EC-3 audio settings) use the Dolby Digital transcoding format. This format encodes Dolby Digital (AC-3) and Dolby Digital Plus (EC-3) audio files that contain multiple audio channels, including 5.1 surround sound. You can also create custom settings that use the Dolby Digital transcoding format. 
    Note:  All files intended for video and audio DVD authoring must have a 48 kHz sample rate as required by the DVD specification.
    DVD Video: Choose this option if you’re encoding for use in a DVD video authoring application.
    DVD Audio: Choose this option if you’re encoding for use in a DVD audio authoring application.
    Tip:  For stereo encoding, rates of 192 kbps and 224 kbps are typical and will produce good results. For Dolby Digital 5.1 encoding, a rate of 384 kbps is recommended. For 5.1 Dolby Digital Plus encoding, a rate of 192 kbps is recommended.
    Cheers,
    Judy

  • How do you change the music for an export from a selection of pictures?

    I have iTunes and know how to change the music for a slideshow but if I select pictures from a folder and export to QuickTime how do I change the music?
    There is an option to "Add currently selected music to movie" but it always plays the same tune. How do I get an option to select an iTunes song like with the Slideshow? Where are the slideshow sample music files stored? There are 11 files in the sample folder but I can't find any of them on my drive.

    Maybe there is some confusion in what I'm telling you. There are two types of slideshows in iPhoto. One creates a special slideshow album that appears in the Source pane on the left side. This is not the one I'm talking about. (You create one of these slideshow albums when you select some photos and click the Slideshow icon (the one with a Plus sign on it) at the bottom of the iPhoto window.
    The other slideshow is done from the main library window or from a regular album (not a slideshow album). You either select some photos (or a roll) from the Library or select an album (with a folder icon). Then click the Play button which is on the bottom right hand side of the iPhoto window.
    If your Play button is on the left side, then you aren't using the correct one. The one that appears on the left side shows when you've selected a Slideshow Album from the source pane. This type of album has an icon that looks like a couple of slides (the kind you put in a projector).
    Does that make a difference?

  • How do you stop the 11.0.44 version from freezing up all the time?

    How do you stop the Itune version 11.0.44 from freezing up all the time. I have two different lap tops with the same version and both do the same thing. The store gives me the most problem.

    Hello rkalanz1,
    The following article should be helpful in stabilizing iTunes on your laptops.
    iTunes for Windows Vista or Windows 7: Troubleshooting unexpected quits, freezes, or launch issues
    http://support.apple.com/kb/TS1717
    Cheers,
    Allen

  • How do you fix the 2 to 3 second voice delay when answering iphone 5 this is with multiple carriers and its unaceptable on a phone that cost almost 700 dollars it did not happen on my cheap prepay samsung

    how do you fix the 2 to 3 second delay on hearing somones voice when answering the iphone 5 this happens on lots of  iphone 5s with differant carriers so its not one carriers problem its probably apples this is unacceptable on such an expensive phone and very irratating. my last cheap samsung t mobile 50 dollar pre pay never did this,im new in my  contract an will take the phone back if i have to put up with this for 2 years.other than that huge problem i love the phone. i dont understand why this did not get covered like the maps problem,cause its a lot of phones and its probably an ios problem.

    Wow!
    I'm not going to be of much use regarding answers but I sure am going to watching this post like a hawk for any replies. My package is a slightly diluted version of this and I do find the BBtalk and data limits hard to make the most of as well.
    If nothing else this totally highlights how complicated BT have managed to make their packages.
    A cynic would assume that they are trying to catch us out at every step and for us to either be overspending or not really getting the moneys worth.

  • How do you change the text color in io7 from white to black?

    How do you change the text color on the home page in iO7 from white to black?  I tried to invert the color but that reverses everything inclufing pictures.

    Yes, you can. If you change your wallpaper to a very light or white color the text turns black.

  • How do you replace the main start up drive?

    My main drive is full and I want to replace it with a larger drive. How do you go about upgrading the hard drive as a start up disk?

    danbfoto wrote:
    My main drive is full and I want to replace it with a larger drive. How do you go about upgrading the hard drive as a start up disk?
    Stick a new drive in a free bay.  Format it with Disk Utility.  And then use a backup utility like Carbon Copy Cloner to copy your current drive to the new drive essentially making them equivalent.  Then change Startup Disk system preferences to use the new drive and reboot (from your new drive) and continue on your merry way.
    Keep the original as a backup.

  • How do you change the main contact in contacts/icloud?

    I've noticed in my contacts list I have one contact that is listed in blue and has a sillouete off to the right.  Also in my icloud contacts that same contacts has "me" on the contact Picture.  How do I change or delete this?

    Go to Settings>iCloud, tap Delete Account and provide the password for your old iCloud ID when prompted.  If you don't know it, or if it isn't accepted, try signing out of either FaceTime (Settings>FaceTime, tap the ID, tap Sign Out) or iMessage (Settings>Messages>Send & Receive, tap the ID, tap Sign Out).  Then sign back in with your current ID.  Then try your current password to turn off Find My iPhone again (even though it still shows your old email address).  If accepted, sign back in with your current iCloud ID and password.

  • How do you establish the main title menu?

    Like other posts I've check here, I can't get the first of my two menus to appear as the main "title" menu when I open the simulator. I've made sure it's listed first in the VTS and I've checked it as the main title menu in the overall DVD inspector window. I don't know what else to do!
    Any suggestions?

    You alsso need to set it as first play (sounds like that is what you mean and not whether it is "Title" in terms of pressing the remote)

  • How do you change the default email client (Mail) to Outlook when sharing?

    In iPhoto I used Outlook as the default email to forward photos to friends.  How do you change it from Mail in Photos to Outlook?

    I am having the same problem.
    Just updated to OS X 10.10.3.
    The new Photos app will not link to Microsoft Outlook.
    Never had this problem with previous versions of iPhoto.
    I have a thread going on this topic:
    The new "Photos" will not link to Outlook email.
    Apple needs to update Photos 1.0.

  • How can I highlight the default data in a numeric control when a VI loads.

    I have a VI that features a string constant that asks for a numeric response via a numeric control, a "next" button that enters the data (controlled by the enter key), and two leds, one that lights if the data entered is correct, and one that lights if the data entered is incorrect.  Is there anyway that I can make sure that when this VI loads, the zero in the numeric control is highlighted?
    Currently the opeator must use the mouse to highlight the zero in the numeric control, type the number and press enter ("next") to advance in the program.  I want the operator to be able to simply type the number after the VI loads and press enter.  This would require the zero to be highlighted when the VI loads.
    Is there anyway that I can format the numeric control to do this?

    If you set the key focus of the control to true (Right click on
    control->Create->Property Node, then on the property node, select
    "Key Focus") before anything else, it should be highlighted when you
    run the program.

Maybe you are looking for

  • Custom calculation Script logic question

    I am trying to create the following logic in my form however cannot get it to work, help! I have two fields:  LocNumber and LocAddress.   If LocNumber=NY001, I want LocAddress to populate with "Times Square", if LocNumber=NY003, LocAddress should pop

  • How can I get back into my email account?

    I hope there is a fairly easy solution to this because I'm not good with computers. I cannot receive any emails on my .mac.com account as the reason states "reason for failure 550.5.1.1 unknown or illegal alias". Also it does not recognize my passwor

  • Hyperlinks don't work in Keynote presentation

    Hi, We have a keynote presentation that contains a hyperlink to a webpage on one slide. However, when playing the presentation the hyperlink is unclickable? The link works fine when we look at the slides in the normal/design view. We've selected the

  • UDF for USER

    Hi, I have created a UDF field named 'Unique Code' and have written an event handler for it. Have few questions 1. In event handlers, how to we get the value of Unique Code?           String uniqueCode = getParamaterValue(parameters, AttributeName.US

  • Tomcat Startup Problem with coyoteconnector

    I am a newbie java person and have installed the tomcat files. When I run startup I get the following error; Classnotfoundexception on the CoyoteConnector. I have the classpath pointing to all and sundry but it still does not see it. c:\jdk;C:\jdk\li