A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: if/else/tell target

  1. #1
    Junior Member
    Join Date
    May 2001
    Posts
    8

    Lightbulb

    hello,
    ive got the following problem.
    there is a kind of menubar in the main scene. each button that is clicked tells a different movieclip (also in the main scene) to play. the problem is that every menubutton should check if another window is already open and if its so first close this (play a certain frame in the movieclip).
    if tried this by setting variables like this.

    in the menubar :

    on (release) {
    tellTarget ("../facts") {
    out = "1";
    }
    }

    and in the first keyframe of the other movieclip :

    if (disco == 1) {
    tellTarget ("../disco") {
    gotoAndPlay (21); (++ move backward ++)
    }
    } else {
    play ();
    }
    play ();


    what is wrong....
    perhaps someone could help me
    thank you

    racka

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    116
    Well, you variable names dont seem to match up but that may be just me. In the main timeline you reference out=1, but in your MC timeline, you dont use out at all, so did you forget to inlcude that or does that go elsewhere?

    But I do see one thing that might cause a problem. In your if() statement you say disco==1. If your wanting to know the current frame the MC disco is on, you have to say disco._currentframe, otherwise flash treats disco as a variable and just evaluates it to whatever value it has at the moment. You might also consider learning dot syntax, cause then what you wrote there become

    _root.disco.play(21)

    Hope that helps some...

  3. #3
    Junior Member
    Join Date
    May 2001
    Posts
    8

    thank you, still one little question

    now everthing is working fine i`ve used the following syntax

    if (_root.disco._currentframe=20) {
    _root.disco.gotoandplay(25);
    }

    but i need the flash4-compatible syntax (tell target didnt work when i tried it)

    thanks a lot

  4. #4
    Senior Member
    Join Date
    Apr 2001
    Posts
    116
    Ahh, well, Im not very familiar with flash 4 syntax. I like version 5 better because it actually has some structure to it like C++ or Perl. One thing though.. in your if() be sure to use == or it wont work right. Not sure if that was a mistype or not...

  5. #5
    Welcome to flavour country
    Join Date
    Sep 2000
    Posts
    662
    I believe this is the Flash 4 syntax

    If(GetProperty("../disco",_currentframe)=20
    BeginTellTarget("../disco")
    gotoAndPlay(25)
    EndTellTarget
    EndIf

  6. #6
    Junior Member
    Join Date
    May 2001
    Posts
    8

    not working

    this is not working, perhaps my fault?

  7. #7
    Senior Member
    Join Date
    Apr 2001
    Posts
    116
    I dont remember correctly, but did flash 4 equate "is equal to" as eq or ==? if you copy what thewiz line for line wont that just set currentframe=20 every time?

  8. #8
    Welcome to flavour country
    Join Date
    Sep 2000
    Posts
    662
    Sorry, I though your button was in an mc.

    I tested this and it works.

    Code:
    on (release){
    if (getProperty ("/disco",_currentframe)==20){
    tellTarget ("/disco") {
    play ();
    }
    }
    }
    This is Flash 5 code that is publishable for Flash 4.

  9. #9
    Junior Member
    Join Date
    May 2001
    Posts
    8

    everything is fine

    thank you very much for your quick help

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