Hi,

I am having a problem but after all tries i cannot find out the cause of it. I added a movie clip in a .fla file and in that movie clip i called added an empty movie clip. I called a .swf file in the empty movie clip. Now i want to access a particular frame in .swf file and i have tried using telltarget with gotoandstop("label") to do this but this isn't working.
It only loads the .swf from frame1 at loadmovie().

If i simple add the empty movie to .fla file and call .swf at frame(3) then it works.

I cannot understand the problem???

Regards

Dani AI

Generated

If a loaded SWF always starts on frame 1 and gotoAndStop (or tellTarget) has no effect, the cause is almost always one of two things: the code is running before the external SWF has finished loading/initialised, or the script is targeting the wrong clip (wrong path or the instance does not exist where/when the code runs). resolved the symptom by removing layers and correctly pointed at pathing as a likely concern. The useful next step is to treat this as a timing + targeting problem and verify both.

Quick troubleshooting checklist and safe code patterns (ActionScript 2):

  • Verify the instance exists when the code runs:

    trace(_root.container_mc.empty_mc); // should not be 'undefined'
  • Use MovieClipLoader and its onLoadInit listener so frame labels and the loaded timeline are ready before you call gotoAndStop:

    var mcl:MovieClipLoader = new MovieClipLoader();
    var listener:Object = new Object();
    listener.onLoadInit = function(target_mc:MovieClip) {
    target_mc.gotoAndStop("targetLabel");
    };
    mcl.addListener(listener);
    mcl.loadClip("external.swf", _root.container_mc.empty_mc);
  • If you cannot use MovieClipLoader, poll bytes or use an onEnterFrame guard:

    _root.container_mc.empty_mc.loadMovie("external.swf");
    _root.container_mc.empty_mc.onEnterFrame = function() {
    if (this.getBytesLoaded() == this.getBytesTotal()) {
      delete this.onEnterFrame;
      this.gotoAndStop("targetLabel");
    }
    };

Other checks: confirm the frame label exists and is spelled/cased exactly the same; avoid tellTarget if you can reference the clip directly; ensure there are no duplicate instance names across keyframes or missing instances on the frame where your code runs (timeline structure and layer order can make an instance unavailable at the moment a frame script executes). Use trace() liberally and run in the Debug player to see what exists at runtime.

Recommended Answers

All 3 Replies

Member Avatar for Member #114696

The problem may not be solved by me unles i see the whole fla file. But i suppose that might be due to wrong usage of actionscript. By this i mean the incorrect path for that particular clip.

The problem may not be solved by me unles i see the whole fla file. But i suppose that might be due to wrong usage of actionscript. By this i mean the incorrect path for that particular clip.

Thanks for the reply.

But the problem is solved now. I deleted a few layers and the program started working.

Member Avatar for Member #114696

but i suppose who must try to know why the problem really occured, i mean the reason behind it. 'cause the problem could be solved somehow but what caused that problem, why this didn't happened when the layers were removed must be understood. This is equally important in other languages too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.