A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8] variable.gotoAndStop()

  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    83

    [F8] variable.gotoAndStop()

    I have one button on _root and an invisible movieClip on _root. I would like to have button goto another movie clip's second frame when the movieClip's _y is changed. Heres the button's code:

    PHP Code:
    on (press) {
        
    _root.starting "yes";
        if (
    _root.starting == "yes") {
            var 
    new_empty_mc:MovieClip this.createEmptyMovieClip("empty_mc" _root.number_root.number);
            
    _root.new_empty_mc._x 35.8;
            
    _root.new_empty_mc._y 12;
            
    _root.new_empty_mc.attachMovie("uc_id""uc_mc"1);
            
    _root.selectedNote "empty_mc" _root.number ".uc_mc";
            
    trace("_root.selectedNote = " _root.selectedNote);
            
    startDrag(new_empty_mc,true);
            
    _root.number _root.number 1;
        }


    And here's the invisible movie's code:

    PHP Code:
    onClipEvent (enterFrame) {
        if (
    _root.empty_mc1._y >= 50) {
            
    _root.selectedNote.gotoAndStop(1);
        }
        else if (
    _root.empty_mc1._y <= 50) {
            
    _root.selectedNote.gotoAndStop (2);
        }


    It doesn't go to the second frame. Can anyone help me?


    *edit: added tags
    gparis
    Last edited by gparis; 11-08-2007 at 05:49 PM.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Please use PHP tags when posting code samples.

    Does it stop on frame1?

    gotoAndStop(2) -> no space before the parens. If not that, try and use trace() see if the condition returns true.

    gparis

  3. #3
    Member
    Join Date
    Nov 2007
    Posts
    83

    _root["secilenNota"].gotoAndStop(2);

    I tried that. I also tried
    Code:
    _root["selectedNote"].gotoAndStop(2);
    And this
    Code:
    trace(_root[selectedNote]._target);
    It says undefined.

    None of them could be successful.

    But still thanks.
    Last edited by onurcan1977; 11-09-2007 at 01:59 PM.

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    trace(_root.selectedNote);

    just that, and use the debug, see what vars come in.

    gparis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center