movieclip.gotoAndPlay () does not work

Hi, I hope someone can help me, as I am unable to see a problem in my code.
It is a simple command, creating a bar of charge for a child of swf loaded into a movieclip into a parent swf file. The load bar works fine, but when the swf file is fully loaded, I want to tell him to go to play a specific image. I'm using the code mov_site.gotoAndPlay("start") where mov_site is the empty clip and start the framework that I want to play.

However, for some reason, it will the frame label "start" but acts as if there is a command to stop on this label of image... it simply will play no more than the film loaded. I can certainly say that there is clearly not a stop on this frame command, I used this before encoding without problem and the question now is really starting to bug me... something so simple that I don't see a problem. If I remove the line mov_site.gotoAndPlay ("start"); then it loads the movie very well and he just plays early.

My code for the load bar is less... can anyone help?

Thank you very much!


Stop();
mov_site.loadMovie ("cliffhousecontent.swf");
img_mask.onEnterFrame = function() {}
var l = mov_site.getBytesLoaded ();
var t = mov_site.getBytesTotal ();
% var = Math.round(l/t*100);
img_mask._y = 450-(percent*3);
If (l == t) {}
mov_site.gotoAndPlay ("Start");
}

Hi, thanks a lot for your help. I've never really used the moviecliploader before, but I looked and produces the following code which worked well! I guess that it is technically the correct way to do it?

Stop();
var loader: MovieClipLoader = new MovieClipLoader();
loader.addListener (this);
function onLoadInit(mov_site:MovieClip) {}
mov_site.gotoAndPlay ("Start");
};
function onLoadProgress (_mc:MovieClip, loaded: number, total: number) {}
img_mask._y = 450-((loaded / total * 100) * 3);
};
loader.loadClip ("cliffhousecontent.swf", mov_site);

In any case, thanks for your help!

Tags: Adobe Animate

Similar Questions

  • MovieClip (root) does not work inside a function

    Hey everybody,

    I'm having this problem.

    When I publish my FLA with reader 9, in fact, there is no prob.

    When I publish with player 10 selection, there is this problem.

    I paste my code:

    var leng:int = MovieClip(root).program.websiteXML.pages.titlePage.length();
    trace ("leng"+leng);
         
    setInterval(function () : void {
    
              if (MovieClip(root).program.autoCh==true){
                           
               trace("CHANGE");
                                
              
              MovieClip(root).allContent.controllMenu2['itemButton_' + MovieClip(root).program.linkPic].gotoAndPlay("s4");
              
              if (MovieClip(root).program.linkPic < int(leng-1)){
                        MovieClip(root).program.linkPic++;
                           }else{
                               //MovieClip(root).allContent.play ();
                             MovieClip(root).program.autoCh=false;
                             MovieClip(root).program.linkPic=1;
                             }
                           
                   
                             MovieClip(root).allContent.controllMenu2['itemButton_' + MovieClip(root).program.linkPic].gotoAndPlay("s4");
                             
    
                             
                             
                             for (var z:uint=1; z<(MovieClip(root).program.linkPic+1); z++) {
                                  var tempMC:MovieClip = MovieClip(MovieClip(root).allContent.controllMenu2)["itemButton_"+z];
                                  Tweener.addTween(tempMC, { x:(z-1)*(45+1)-353, time:1} );     
                                  
                             }
                             
                             for (var j:uint=(MovieClip(root).program.linkPic+1); j<7; j++) {
                                  var tempMC2:MovieClip = MovieClip(MovieClip(root).allContent.controllMenu2)["itemButton_"+j];
                                  Tweener.addTween(tempMC2, { x:(j-1)*(45+1)+352, time:1} );     
                                  
                             }
                             
                             MovieClip(root).allContent.controllMenu2['itemButton_' + MovieClip(root).program.linkPic].gotoAndPlay("s3");
                             
                        
    
                       }}, 4000);
    

    For variable coz, there is no problem, the value is retrieved.

    But it is inside SetIntervall, to

    MovieClip(root).program.autoCh

    He tells me that:

    TypeError: Error #1009: cannot access a property or method of an object reference zero.
    function / < anonymous > () [main6_cs3_fla._00button_136::frame1:32]
    service / http://adobe.com/AS3/2006/builtin: applies ()
    to SetIntervalTimer / onTimer)
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

    And if I put the value outside the function:

    var autoChtest = MovieClip(root).program.autoCh;

    And use:

    if (autoChtest==true)

    There are no errors, but my function does not work properly, as native can be 'false' in another action.

    Well, I hope that will not scare you, and someone will try to help me, please.

    If anyone knows anything on this topic post or having the same problem please tell me.

    Thank you!

    Try:

    :

    var leng:int = MovieClip(root).program.websiteXML.pages.titlePage.length();
    trace ("leng"+leng);
    
    var rootVar:MovieClip=MovieClip(root); 
    setInterval(function () : void {
    
              if (rootVar.program.autoCh==true){
    
               trace("CHANGE");
    
             rootVar.allContent.controllMenu2['itemButton_' + rootVar.program.linkPic].gotoAndPlay("s4");
    
              if (rootVar.program.linkPic < int(leng-1)){
                       rootVar.program.linkPic++;
                           }else{
                               //MovieClip(root).allContent.play ();
                             rootVar.program.autoCh=false;
                             rootVar.program.linkPic=1;
                             }
    
                            rootVar.allContent.controllMenu2['itemButton_' + rootVar.program.linkPic].gotoAndPlay("s4");
    
                             for (var z:uint=1; z<(MovieClip(root).program.linkPic+1); z++) {
                                  var tempMC:MovieClip = rootVar.allContent.controllMenu2)["itemButton_"+z];
                                  Tweener.addTween(tempMC, { x:(z-1)*(45+1)-353, time:1} );     
    
                             }
    
                             for (var j:uint=rootVar.program.linkPic+1; j<7; j++) {
                                  var tempMC2:MovieClip = rootVar.allContent.controllMenu2)["itemButton_"+j];
                                  Tweener.addTween(tempMC2, { x:(j-1)*(45+1)+352, time:1} );     
    
                             }
    
                            rootVar.allContent.controllMenu2['itemButton_' + rootVar.program.linkPic].gotoAndPlay("s3");
    
                       }}, 4000);
    
    
  • gotoAndPlay does not work in IE 6

    I use the same Flash movie twice in an advertisement, unless I want to only one instance to start at a different point on the timeline. So I used gotoAndPlay(). Works fine in Firefox and Safari. However, two instances in Internet Explorer 6 always start at frame 1. Any ideas?

    It is likely that the framework you marked is not yet loaded. You
    must ensure that the images you need are loaded before trying to go to them

    NOTE: That the rate and timing of loading etc. is different for firefox vs ie
    and for different platforms etc. You can not count on the calendar. You really
    should always use the preloader as controls so that you go NOT jump
    everything in a film so that all the necessary frameworks are already loaded!
    --
    Jeckyl

  • gotoAndPlay does not

    Hey guys, I have a problem here. I have 2 buttons called start and settings, and the two buttons with change the next scenes after the film ends.

    Here is an example of the code

    Start button:

    on (release)
    {
      var o:Number = 1;
      gotoAndPlay (40);
    }
    

    Settings button:

    on (release)
    {
      var o:Number = 2;
      gotoAndPlay (40);
    }
    
    

    In the actual animation, after I click on 1 of the buttons, the animation will slowly white and in the final, to do this, copy the following code:

    trace(o);
    if (o == 1)
              {
                        gotoAndPlay ("Selections");
              }
              else if (o == 2)
              {
                        gotoAndPlay ("Settings");
              }
    
    

    But the "gotoAndPlay" does not work. I applied this code on another scene and doesn't work too. Is there something wrong with my code?

    you precede the 'o' local to your scope-button when you var in these methods of one (release).  In addition, no code should be attached to objects.  Fix code on a calendar.

    That is to say, name your buttons (by example btn1, btn2), remove the code, you have now attached to these buttons and use:

    var o: Number;

    {btn1.onRelease = Function ()}

    o = 1;

    gotoAndPlay (40);

    }

    {btn2.onRelease = Function ()}

    o = 2;

    gotoAndPlay (40);

    }

  • Form does not work when it s poses in a movieclip


    I've isolated the problem and it s seems to be concentrated in the path "mcForm.skickat eq 'Yes' below: (the serverside script is done in Php).

    I t looks like that the form does not work when it s respondent in a movie clip called mcForm with a button send simply called 'send '.
    I have to place the form in a movieclip, because the shape is a good interpolation made by Laco interpolation method.

    Everything works fine if ["BOLD"] I have no place [/ bold] form in a movieclip.

    Here´s a part of the actionscript in the script main navigation.swf:

    If (mcForm.skickat eq 'Yes') {}
    gotoAndStop ("labelFinished");
    }

    Here´s actionscript code on the button 'Send' in mcForm in navigation.swf:
    on (release) {}
    loadVariables (" http://www.homesit.se/phpmail.php", "", "GET");
    _parent. Play (); This statement is not the problem.
    }

    The chronology in navigations.swf never reaches the label "finished."

    It works fine if I do not place shape to a movieclip in navigation.swf timeline:

    If (mcForm.skickat eq 'Yes') {//this path is the problem
    gotoAndStop ("labelFinished");
    }

    Here´s in php serverscript:
    (I have no problem here)

    <?
    $headline = "mail from your Homesite.
    $text = "$name sent email you from your homesite.
    It wrote:

    $message
    ";
    mail ($mymail, $headline, $text,
    "To: $email. (' \nReply-to:".$email);
    ECHO ("Send = Yes");
    ? >

    What could possible be wrong

    I appreciate every response.


    The root of the problem (look at the code you posted), it's that there is no event that determines what should happen when your data comes back from PHP. When you use loadvariables, you need an event for mcForm, like our:

    {mcForm.onData = function ()}
    do something
    }

    The problem according to what I see is that on your main timeline code checks the value of mcForm.skickat, but you do not seem to define this variable anywhere. The php script returns a variable named 'send', but I do not see anywhere skickat. If it is not set, its value will be always "not defined".

    To make things more efficient, you should really use loadVars and a reponsed instead of loadVariables Manager. When you use loadVariables, all variables in the clip are sent to your php script that transfer really just data loss. Using loadVars, you specify what vars to send, making the process more efficient. See the docs... everything is in there (with examples).

    BTW... This is the Flash Media Server forum. In the future, you might want to ask questions like this in the general flash or actionscript forum, you will get more answers (more people read on these forums)

  • The tab does not work inside the Scrollpane (AS3)

    Hello

    I have a movieclip with some input text fields. It's like a form. I need to use scrollpane due to its size. If I join this movieclip in the scrollpane component, the tab does not work between these text fields. When I press the tab, the focus moves to the scrollpane himself.

    I tried to set the tabIndex to the textfields. tabChildren and tabEnabled to true for the ScrollPane, but nothing seems to work.

    Please help if anyone has a solution for this.

    Finally found answer on another post. Add the following line of code solved my problem.

    sp.focusManager.deactivate ();

  • Debugging does not work in the second project

    Hello world

    I did a project (a small space shooter) and now I'm doing a new.

    I started to do a program and cs6 white flash professional project in flash builder 4.7.

    In the first project everything worked well.

    But now, the second project, I have a big problem: the AS3-files are not recognized... or are they? Debugging does not work, the program starts, but she holds on a single break point.

    It's the same thing in Flash Pro itself. So it's not a problem of Flash Builder...

    I just checked and discovered that my first project runs with the same properties, but debugging works fine.

    Here is a small screenshot

    problem.jpg

    Doesn't anyone have an idea how to make this work? The class 'Boat.as' is a MovieClip with a small triangle. It does nothing...

    Thanks for helping everyone!

    Greetings

    Mischaaal

    1. the packaging is almost certainly incorrect, that's why that is not used.  to confirm, which is the document class in the properties of your fla Panel?

    2. you have a stray line of no code in your constructor.

  • Clip from movie running does not work

    Hello

    I'm new to actionscript 3.0. I created a flash movie that contains a simple clip (clip_mc) and a button (btnGo). Depending on the number of clicks of button clip_mc stop and play. It works very well with the 'Test Scene'. But when I run the SWF file separately, the action script does not work.

    Here is the code:

    import flash.display.MovieClip;

    var count: int = 0;

    btnGo.addEventListener (MouseEvent.CLICK, fl_MouseClickHandler);

    function fl_MouseClickHandler(event:MouseEvent):void

    {

    If (ExternalInterface.available)

    {

    var val: Boolean = counter ++ % 2 == 0;

    trace ("calling function fromJS with value:" + val);

    If (Val)

    {

    clip_mc. Stop();

    trace ("Stop");

    }

    on the other

    {

    clip_mc. Play();

    trace ("Play");

    }

    }

    }

    I tried to export as Movie Clip and run, it still does not work. Can someone please help me understand this.

    My guess would be that the Actionscript code works, just not in a way that you expect.  If you test the swf file alone, then chances are that ExternalInterface.available turns to the top of the 'false' because there is no html page to confirm availability.

    You will not see traces when you run a swf by itself if that's what you expect to see.  You must instead use textfields in these circumstances.

    Try to see what this value ExternalInterface.available ahead test phrases to see what value there... use a textfield, rather than by the trace.

    In addition, having Flash publish an html page and test the page html instead of just the swf file on its own.

  • _root in as2 code does not work when, inside a symbol?

    Hi I am currently using as2 on this project, I work with. I am a beginner in as2. Apparently, my problem is that _root is not working when placed inside a symbol. Is it possible to make it work?

    I tried that when he is not within a clip, it works. But I really need to be within a clip. Any way to make this work?

    It's my current setup

    I have a clip named mc01 and then mc01 includes an another movieclip named mc01in (with an instance name of mc01instance) and a button named buttonmc01. I placed the code in buttonmc01

    on {(press)

    _root.mc01instance.gotoAndStop (3);

    }

    But it does not work. I think there may be a solution for this, but since I'm just a beginner in flash, I hope you can enlighten me if it is possible to make it work like that?

    MC01 (root movieclip)-> mc01instance & buttonmc01

    You ' r to access the mc01instance of your buttonmc01 then it should be

    on {(press)

    _root. MC01.mc01instance.gotoAndStop (3);

    }

    or

    on {(press)


    mc01instance.gotoAndStop (3);


    }

  • Stop or play on the image with the video tag does not work?

    I have a video in a setting that corresponds with the label 'eight ';  I have a button on the timeline with the following code.  I have tried to Stop both gotoAndPlay and it does not work.  Thanks in advance for your suggestions.

    on {(press)

    gotoAndStop (eight);

    }

    use:

    on {(press)

    gotoAndStop ("eight");

    }

  • hitTest on an object array - use removeEvent and now the code does not work

    I used hitTest to see what sunny (mc) would hit one of five objects in a table.

    BUT I had to use removeEventListener otherwise she'd keep ancestral. But now I can't "beat" the next object. Why the addeventListener method does not work yet?

    stage.addEventListener (MouseEvent.CLICK, myClickReaction);
    speeds the LONG NYPOTENUSE
    var v: Number = 5;
    var varObject:String;
    var i: Number;
    var arrayObjects:Array;

    complete table and initialize the variables i and varObject
    arrayObjects is ['chocolate', 'ice', 'pizza', 'Burger', 'sandwich', 'egg'];.
    i = 1;
    varObject = arrayObjects [i-1];
    trace (varObject);


    mouse click point
    var clickPoint:Point = new focus();
    function myClickReaction(e:MouseEvent):void {}
    clickPoint.x = mouseX;
    clickPoint.y = mouseY;
    addEventListener (Event.ENTER_FRAME, onEnterFrame);
    }
    function onEnterFrame(event:Event):void {}
    var xDistance:Number = clickPoint.x - sunny.x;
    var yDistance:Number = clickPoint.y - sunny.y;
    var angle: Number = Math.atan2 (yDistance, xDistance);
    Sunny.x += v * Math.cos (angle);
    Sunny.y += v * Math.sin (angle);
    If (clickPoint.x > = sunny.x) {}
    sunny.gotoAndPlay ("walk straight");
    trace (Math.ABS (xDistance));
    }
    If (sunny.x > = clickPoint.x) {}
    sunny.gotoAndPlay ("left foot").
    trace (Math.ABS (xDistance));
    }
    If (Math.abs (xDistance) < = 10) {}
    trace ("Works");
    sunny.gotoAndPlay ("static");
    removeEventListener (Event.ENTER_FRAME, onEnterFrame);
    }
    }
    addEventListener (Event.ENTER_FRAME, enterFrameHandler);
    function enterFrameHandler(e:Event):void {}
    If (sunny.hitTestObject (hotspot_pizza)) {}
    If (sunny.hitTestObject (varObject)) {}
    If (sunny.hitTestObject (this [varObject])) {}
    i = i + 1; / / ie: he comes to the table object and NOT the string.
    trace (varObject);
    removeEventListener (Event.ENTER_FRAME, enterFrameHandler);
    }
    }

    because you stop your loop when the first object has a positive hittest.

    What do you do?

  • _visible does not work but the fact of _alpha

    Hello

    I use AS2 (Flash 8), and I created a subclass of MovieClip - card and attached an instance to the stage using attachMovie. However, I can't make invisible using _visible. In aid of _alpha works, however, but I would use _visible place. Any ideas what the problem may be? Here is the code:

    display_card = attachMovie("card",_"displaycard",_99999,_{_x:0,__y:0}).init ("display", "card_nasty_bug.jpg");
    display_card._xscale = display_card._yscale = 60;
    display_card._visible = false;     does not work
    display_card._alpha = 50;          works

    Here's the function init for my card class:

    function init (type: String, pic: String) {}
    type = type;
    PEAK = pic;
    this.loadMovie (pic);

    This ._xscale is this ._yscale = scale;.
    Back to this;
    }

    One last thing, what are the events when the mouse pointer enters or leaves a MovieClip? I tried onRollOver and onRollOut, but those who are apparently not the correct events...

    Thank you.

    My guess is that it actually works. However when you loadMovie some things will be reset to zero when the content finishes loading.

    You should probably do is add a line like this in your classroom:

    function init (type: String, pic: String) {}

    var artwork:MovieClip = this.createEmptyMovieClip ("artwork", 1000);
    type = type;
    PEAK = pic;
    artwork.loadMovie (pic);
    Back to this;
    }

    That way your content will be loaded into the child movieclip, but you can control visibility and event managers (which you do not have good also) tying them to the parent. Event handlers are too deleted when loading content.

    BTW, you should generally not use loadMovie as it lacks the easy ways to know when it's done or to track its progress. You should look into the MovieClipLoader class, because it provides nice events for these important things

  • Help! Drag / move does NOT work!

    Hello - I'm using a simple drag and drop quiz, but it does NOT work correctly .  When I play the movie, the mouse takes the movieclips but never falls, even when they are in a target area.  Help, please!  I have attached my FLA - any help would be much appreciated!

    Thank you.

    Just for starters, you change startDrag line to be: event.target.startDrag (false);

    Then see what's left more questions.  While I had other changes at different times, changing only one line was let down when I let go.

  • Delivery does not work on the image...

    Hello

    I'm having a problem when you try to add a delivery Manager to a JPG that is loaded into a movieclip.
    Delivery does not work.

    ActionScript code:

    for (i = 0; i < ecards.length; i ++) {}
    var mc:MovieClip = attachMovie ("recipient", "recipient" + I, i);
    mc.loadMovie("images/button.jpg");
    mc.onPress = function() {}
    trace (this._name);
    }

    }

    "beneficiary" is a rectangle of 100 x 75 (same size as JPG).
    If I comment the line "mc.loadMovie("images/button.jpg"); ' it displays only the original mc and traces the name property, but when I insert the image in it, there is not trace it more.

    Any help would be appreciated.
    Thanks in advance!

    I got a solution of Ali Inhan at Actionscript.org:

    for (i = 0; i< ecards.length;="" i++)="">
    var mcl:MovieClipLoader = new MovieClipLoader();
    var listener: Object = new Object();
    mcl.addListener (listener);
    listener.onLoadInit = {function (m:MovieClip)}
    m.onPress = function() {}
    trace (this._name);
    }
    }
    var mc:MovieClip = attachMovie ("recipient", "recipient" + I, i); mcl.loadClip ("images/button.jpg", mc);
    }

  • Safari does not work after installing macOS Sierra

    Safari and apple store does not work after installing macOS Sierra

    Alas, my crystal ball is in the shop for cleaning, so you will need to provide more details on what "doesn't work" and above all error messages. First of all, let's start the App Store. Provide as much information as possible for those of us who do not sit on your shoulder.

Maybe you are looking for