Accessing children on frames after gotoAndStop

Hi
I have an SWF file where I want to access symbol instances on
frame 2.
I have noticed that after I call gotoAndStop(2); it takes a
little while before the symbol instances are instantiated.
I get null ref exceptions if I immediately access the
children on a frame after calling gotoAndStop, but if I wait a bit
it works, because it seems as if the children have had time to be
instantiated, see examples below.
I prefer not to rely on delaying my code, but would rather
prefer to listen for an event that could notify me when a frame is
properly "initialised", that is, when all symbol instances have
been instantiated. Is there such an event and if not, is there
another solution ?
Examples:
mc2 is a movieclip.
1) This gives null exceptions because the child of frame 2 is
null when accessed.
mc2.gotoAndStop(2);
for(var i:int = 0; i < mc2.numChildren; ++i)
var child:DisplayObject = mc2.getChildAt(i)
trace(child.name);
trace("done");
But it works if I wait a bit, because apparently I have
waited enough to allow the child to become instantiated:
mc2.gotoAndStop(2);
var intervalId:int = setInterval(callback,100);
function callback():void
clearInterval(intervalId);
for(var i:int = 0; i < mc2.numChildren; ++i)
var child:DisplayObject = mc2.getChildAt(i)
trace(child.name);
trace("callback done");
trace("done");
Is there an event that can be used instead of relying on some
delay ?
Best regards Stig Nielsson

My guess is that you are waiting for the timeline to advance
to frame 2, which doesn't happen instantly, it follows the frames
per second rate you establish for the file. If the frame 2 clips
don't exist in frame 1 but that's where your code (which does act
instantly) starts looking for them, then it was probably looking at
frame 1 when it ran the code.

Similar Messages

  • [AS3.0] MovieClip.Children not found after gotoAndStop()

    is there anyone met this problem before?
    I have a MovieClip with linkageName
    MyClip
    this MovieClip
    contain 3 frames
    each frame contain 2 child MovieClip name
    childA, childB
    in AS2 i can create the MovieClip on the fly and control it
    with code below
    var mc =
    this.attachMovie("MyClip", "newClip", 0);
    mc.gotoAndStop(3)
    mc.childA.gotoAndStop(2)
    mc.childB.gotoAndStop(1)
    AS3.0 in FlashCS3 I set the linkage properties
    Class: MyClip
    Base class: flash.display.MovieClip
    import
    flash.display.MovieClip;
    public dynamic class MyClip extends MovieClip{
    public function MyClip(){
    this.gotoAndStop(3);
    this.childA.gotoAndStop(2);
    this.childB.gotoAndStop(1);
    // create clip somewhere
    var mc:MyClip = new MyClip();// error
    it raise error, because of cant found the childA and childB
    even if i have not create the MyClip.as, use Flash default
    generated class
    var mc = new
    MyClip();
    mc.gotoAndStop(2);
    mc.childA.gotoAndStop(2);// raise error also
    the error::
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    it work if i set a timer and call to mc.childA later few
    ENTER_FRAME later
    var mc = new
    MyClip();
    // set time out here and do later
    mc.childA.gotoAndStop(2);// it work!
    is there any idea to solve this problem without setting a
    "timer callback" and do after.
    i want to access the "children" immediately once the
    MovieClip created and the frame changed by gotoAndStop(#) call
    thankyou

    childA and childB won't exist until that frame is rendered.
    to remedy, use the RENDER property of the event class to
    determine when you can access childA and childB

  • How to set textfield.text on frame after goto

    This seems a little ridiculous to be asking this question coz
    it seems like it should be so simple but here goes anyway.
    STEPS TO RECREATE:
    Step 1 - create a class called simpleButt(see attached)
    Step 2 - create a MovieClip with two frame labels on
    different keyframes- ROLLOVER and ROLLOUT. on these different
    keyframes place a dynamic textfield with instance name -
    'buttonTitle'. give it different styling attributes on the ROLLOVER
    frame such as text colour, bold or even a glow filter.
    Step 3 - In the movie clip's linkage properties, give it the
    'simpleButt' class.
    Step 4 - With nothing on the stage, add the following two
    lines to frame actions:
    var newButt:simpleButt=new simpleButt("hello");
    this.addChild(newButt);
    Step 5 - compile!
    this should add a simple button to the stage and set the
    button's textfield's text property.
    However, after going to another frame on rollover, we lose
    the dynamic text - i assume because we have another instance of the
    textfield on a different keyframe because it has new styling
    properties on rollover. but if i try to set the text after going to
    the new frame, it doesn't seem to recognise the textfield yet.
    (uncomment lines in simpleButt to see what i mean)
    through trial and error i've found that if i wait two
    ENTERFRAMEs, the textfield object becomes available, but by this
    time the textfield flickers. is there an event i'm missing or
    function i could override where i could set the properties of an
    object on a frame after a gotoAndStop before it is rendered?
    cheers
    Craig

    STEP 2(where the textfield was created) is all done manually
    within the authoring environment - no actionscript. This is usually
    done by the design team here so to save time i'm trying to avoid
    replicating every style change they've made in code.

  • Can only access emails through OWA after migration from exchange 2007 to 2013

    can only access emails through OWA after migration from exchange 2007 to 2013, in other words unable to access mails through outlook or from other Applications services.
    needed RCA ... plz help..

    Hi,
    From your description, you can send and receive messages only when you use OWA after migration from Exchange 2007 to Exchange 2013. If I have misunderstood your concern, please let me know.
    In your case, I recommend you create a new test mailbox in your Exchange 2013 and check if you can send and receive messages on Outlook. If yes, it is recommended to create a new profile to solve this issue.
    Hope this can be helpful to you.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Why can't I access my Gmail account after upgrading to YOSEMITE

    Why can't I access my Gmail account after upgrading to Yosemite

    Clear the cache and cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
    It is possible that the <i>cookies.sqlite</i> file that stores the cookies is corrupted if clearing cookies doesn't work.
    Rename (or delete) <b>cookies.sqlite</b> (cookies.sqlite.old) and delete other present cookies files like <b>cookies.sqlite-journal</b> in the Firefox profile folder in case the file cookies.sqlite got corrupted.
    *http://kb.mozillazine.org/Cookies
    *https://support.mozilla.org/kb/Deleting+cookies

  • How do I go frame to frame after a few seconds?

    Hello,
    I'm new here so forgive any mistakes or lack of knowledge.
    (Brief history: I have programmed in Pascal before, currently learning Java and Flash)
    So my question is i want to be able to move from frame to frame after X amount of seconds. I have searched online for coding on how to do this with the action script and managed to get the first frame working. The problem occurs with my 5th frame as frame 1 goes to frame 5 in 5 seconds but when i want frame 5 to go to frame 10 in 10 seconds it decides not to work.
    Below is the code i used in order to accomplish the first frame:
    stop();
    var myTimer:Timer = new Timer(5000, 1);
              myTimer.start();
        myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:TimerEvent)
            play();
    If there is a problem with the code or if there is an alternative way for better practice please do let me know.
    My 5th frame code:
    stop();
    var myTimer2:Timer = new Timer(5000, 1);
      myTimer2.start();
        myTimer2.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:TimerEvent)
            play();
    Thanks in advance. If anyone is struggling to understand my question, apologies because i am really bad when it comes to structuring sentences.

    You should not have to create more than one timer for this.  Also, you should not be building the event handler function into the listener, keep it as a separate function.
    In frame 1 you could have...
         stop();
         var myTimer:Timer = new Timer(5000, 1);
         myTimer.start();
         myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, moveOn);
         function moveOn(e:TimerEvent):void {
               play();
    and all you would need in frame 5 would be....
         stop();
         myTimer.start();

  • Can't access my video meetings after Lion install Flashplayer will not let me accept or deny

    I can't access my online meetings after installing lion.  Flashplayer will not let me accept or deny.

    Yes I have tried everything.  Talked with support on the phone and all they could say was it is adobe Flash players fault.  They had no idea how to fix it.

  • I have problem with Access Connections on L412 after that utilyty upgrade

    I have problem with Access Connections on L412 after that utilyty upgrade in early August. Windows 7 Ultimate/x64.
    It stops connecting to WPA2 Enterprise (AES-CCMP), Microsoft PEAP, no server cert, with any credentials I try to use. The same account(s) works with native Intel manager on other notebooks and on mobile devices. I lost the wireless connectivity to enterprise WiFi network.
    And, after deinstallation of Access Connections, the inability to connect keeped intact with native Win7 WiFi management.
    I think, something was broken in Access Connections 5.83 Build 83C753WW and some registry settings/ dll modules were altered but not returned to normal after deinstall.

    Access Connections is definitely broken for WPA encryption.  Both versions 5.02 and 5.84 fail for me.  If I use the Windows XP wireless configuration instead of Access Connections, everything works.
    Does anyone know how to report this to Lenovo?  I chased links around the web site but couldn't find a place.

  • HT204074 I have iPad 3 16 giga I have a problem in access or activate iPad after the update to the iPad ois7.1.2  And asks to activate .

    I have iPad 3 16 giga I have a problem in access or activate iPad after the update to the iPad ois7.1.2  And asks to activate .
    what is the solution

    Did you update via settings>general>Software update? Via iTunes?
    Is the iPod connected to the internet via wifi?
    Try connecting it to your computer and then try restoring
    Is it asking for Apple ID and password?

  • Why can't I access my iPhoto library after an OS upgrade to Yosemite?

    Why can't I access my iPhoto library after an os upgrade to Yosemite?

    Which version of PSE are you using?
    Thanks,
    Anwesha

  • How to access the Text Frame, when we use scrollable frame,

    Hi Friends,
    How to access the Text Frame, when we use scrollable frame,
    Thank you,
    [ Nav ]

    That's the same question:
    how can I access something (a page item) on a page…
    Answer: you need something unique in that object you can get a handle on.
    Or you use the selection a user of your script is doing and work with that selection…
    A "scrollable frame" is nothing special. What it makes it a "scrollable frame" is the DPS software.
    So you have to look for attached labels on the object, that identify the object for the PDS plug-in "Overlay Creator" as a "scrollable frame". That's possible with the "extractLabel("KeyString")" function. But you need to know the appropriate key-string in advance.
    In another of your thread in the DPS forum, I basically answered the question how to obtain those key-strings.
    When knowing the key-string you could loop through all your page items (you can skip all text frames) in the allPageItems-collection, to identify the "scrollable frame" by extracting the right label.
    If you have more than one "scollable frames" you need a second unique identifier for the particular object.
    That could be nearly any property.
    Keep in mind, there is no "scrollableFrames" collection in the DOM !
    Uwe

  • Strange Problem- Timeline plays empty frames after last keyframe?

    Once again, thank you all for being so supportive for this newbie!
    So I have this weird problem going on. Why is it that on my timeline (and in preview), my animation still plays after my last keyframe?
    In other words, my animation ends at frame 410 and there is nothing after that, but for some reason it still continues playing up to almost from 695?
    This causes my image to disappear in the frames after 410 when I intended for it to stay still after that (with no looping).
    How can I accomplish just making it stay still after frame 410? Basically it is just 3 roses blooming. I just want it to bloom when the viewer enters the webpage and stop after that. The last frame will make the image stay still (with the roses fully bloomed). Looping the bloom would be tacky and highly unnecessary.
    Thanks!

    I figured it out.
    Turns out it was a BUG.
    So I noticed that when I click one of the folders I put my layers in, it shows that it is 695 frames long. So weird because there is absolutely nothing after frame 410 when I check the layers in the folder individually.
    So what I did was I deleted one of the layers in the folder to see if that would remove the 695 frames. I just deleted it and then undid the delete. And VOILA! It became 410 frames and works fine now. It was definitely a bug as I did not do any other editing to fix it. Just temporarily deleted it and putting that layer back by undoing the delete.

  • Pixelated frames after preview render

    Hello -
    In Premiere Pro CS6 I’m encountering a problem after rendering preview files from H.264 source footage: every 25 frames or so becomes very pixelated in PrPro. The source footage plays fine in QuickTime. At first I thought it might be caused by the way PrPro is interpreting the frame rate; it insists that it is at 25 fps, but the footage is actually 23.97 fps. I thought I could solve this by selecting the clip and going into “Modify Clip” >  “Interpret Footage” > “Assume this frame rate: 23.97 fps”. I also changed the Sequence Settings to match the Clip Settings when prompted to do so, but after completing another render, the pixelation still shows up. I’m on a 15” MacBook Pro Retina, Mavericks, OS X 10.9.5.
    Any help would be much appreciated.
    The image appears steady before pixelation pops into the next couple of frames, then goes
    steady again. The pattern repeats every 25 frames or so.
    My Sequence Settings.

    Okay, I think I have things figured out. Just to give a little background of the process, my original source media is in .mkv format, which I’ve discovered doesn’t work in Premiere Pro, so I converted that media to H.264 and tried to edit with that. Well, after doing a little research, I’ve discovered that sometimes H.264 is not the ideal format in which to edit, and maybe this is why I’ve experienced bad frames after performing preview renders?
    Anyway, the solution that works for me is to just transcode all my original .mkv files into Avid DNxHD files. I tried MPEG Streamclip to convert, but with 98 minutes of 1920 x 1080p footage, it proved to be excruciatingly slow on my MacBook Pro, especially while trying to maintain 100% quality. I also tried VLC, but it doesn’t seem to support the DNxHD codec (unless I’ve overlooked something). The software I ended up using was Wondershare Video Converter Ultimate. Sure, I had to plunk down $59, but so far it has been money well-spent! Super-fast conversions, and it really helps that it can make use of the CUDA GPU
    For all you seasoned video editors reading and laughing, forgive my novice discoveries in all this - video editing is still new for me.

  • Resize of Frame after frame is created

    Hi,
    I have a tabbed pane inside a Frame. When I press one of the tabs I want to resize the Frame.
    Since the tabbed pane is inside the frame I use the following code:
    this.getParent().setSize(640,480); // This does not resize the frame
    this.getParent().resize(640,480); // This does not resize the frame
    I am using Swing.
    What could be wrong or how do I resize the frame after the frame has been created?
    Thanks.

    Hi,
    I guees I might have not told every detail.
    I have a class called TabbedPane that extends JPanel.
    This class then contains a JTabbedPane.
    I then have a JMainFrame that extends Frame that in turn creates a TabbedPane.
    Inside my TabbedPane class I listen to which Tab the user has selected, depending on which Tab I have to resize the Frame. Here is where I can't get it to work.
    if(index == 1) {
    Dimension d = new Dimension(640,480);
    setPreferredSize(d);
    updateUI(); // DOES not work.                              
    } else {
    Dimension d = new Dimension(400,400);
    setPreferredSize(d);
    updateUI();
    Please help :)
    Thanks

  • Can not access on line banking after password

    can not access on line banking after password

    No change to password. Bank directed me to apple for possible problem. It happen after installing 'Yosemite'

Maybe you are looking for

  • I have suddenly lost all content in my emails on my iPad.  Any thoughts anyone?

    I have an original ipad, which has suddenly ( a week ago) lost all content in the emails.  I can see who the email is from and the first couple of lines of content, but when opened the content box is empty.  Nothing has changed in the settings, or at

  • Creating my own GUI

    I want to create a GUI out of graphic that the graphic designer in my company has made. How do I connect the image to the source code? I don't want to create a JApplet or JFrame because I only want to see the graphic, not a window around it.

  • PO value should not increase from PR value

    Hi I hv a PR for an matl with the value specified in valuation tab at PR level. Am creating PO with respect to the above PR and if i exceed the PR value in the PO.. I need a warning or error at this time. How this can be done? Vijay

  • Mac Mini Boots to Unix command line

    I've used my Mac Mini for almost two years with no problem. Normally I can figure out what I've done wrong...but not this time. I need some help from the OS X community. This morning when I toggled to my Mac Mini from Windows (via a KVM switch - not

  • Cannot get iTunes Match to work on my i-Phone. Says I am not "subscribed?"

    Anyone know how to turn on iTunes Match on an iPhone 4? Keep getting an error message that I am not "subscribed." Thanks!