A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: using "go to and play expression"?

  1. #1
    Junior Member
    Join Date
    Mar 2000
    Posts
    13

    Question

    i would like to use a variable to set which frame the play goes to. something like:

    set variable: x=3

    then at frame 5 i would put something like:

    go to and play (x * 10)

    in order for it then to jump to frame 30

    but it doesn't seem to work like this.

    could someone give me pointers on how i might do this? basically i would like to do it this way rather than having 30 odd "if x=1 then go to" type statements.

    thanks!

    chundle

  2. #2
    Senior Member
    Join Date
    Feb 2000
    Posts
    195

    Lightbulb

    Sometimes a pic really is worth a thousand words...



    Actually.. that looks like exactly what you have.. but I THINK that should work just fine.. just be sure to select Expression.

    ------------------
    Scott Richards
    http://www.rjscs.com/scotty
    scotty@rjscs.com

    [This message has been edited by scottris (edited 01 March 2000).]

  3. #3
    Junior Member
    Join Date
    Mar 2000
    Posts
    13

    Post

    hi scottris:

    thanks for the drawing... that's exactly what i tried, but it didn't seem to work! i'm not sure what i'm missing, but (i'm a little new to flash) i'm wondering whether the variable doesn't get set because i'm setting it in a previous frame. i can't figure out what's wrong. do you have any suggestions?

    chundle

  4. #4
    Senior Member
    Join Date
    Feb 2000
    Posts
    195

    Post

    Hmm... If that is what you did.. then that should have worked..

    Variables are global.. If you set a variable in frame 1.. then it will still be available in frame 10. Unless you are setting the variable from withing a movie clip. But if you are only working with Action Scripts on the main timeline.. then you should not have any trouble.

    I think it must be something real simple.. those are usually the worst bugs, because they are the hardest to find..

    I do not know what else it could be.. as that really should be working.. but if you would like, you could email me the FLA and I'll see what I can find.

    ------------------
    Scott Richards
    http://www.rjscs.com/scotty
    scotty@rjscs.com

  5. #5
    Senior Moderator
    Defender of the Faith
    Pope de Flash's Avatar
    Join Date
    Feb 2000
    Posts
    3,429

    Wink

    The answer is that the expression is litteral the abc

    eg

    Set Variable: "x" = "3"

    then in frame 5 just put the
    expression

    x*10

    any you will end up at frame 30
    I tested it and it works, If you need the fla just email me and I'll shoot it out to you. Regards, Bill

    ------------------
    Macromedians 1:1

    In the beginning the web was without shape and color, and the hype covered the darkness of the net. Then there was a Flash and life came to the web and vision became reality.

  6. #6
    Junior Member
    Join Date
    Mar 2000
    Posts
    13

    Post

    Thanks guys, your tips really helped.... but only after I'd exported the movie! I had both "buttons enabled" and "frame actions" enabled while I was constructing it, but for some reason the frame action wasn't working correctly making my go to expressions all pop back to frame 1. Is there something else somewhere I should enable to get them to work? (perhaps I should point out I'm working on a mac).

    thanks so much for your help.

    chundle

  7. #7
    Senior Member
    Join Date
    Feb 2000
    Posts
    195

    Post

    Great . I'm glad you found the solution. I should have seen that myself.. but I missed it .

    Just a note, for whatever it's worth.. both

    Set Variable: "x" = 3

    and

    Set Variable: "x" = "3"

    are exactly the same to Flash. True, one is a string, and one is a number, but Flash will automatically convert between variable types, so it does not matter which you use in this case.

    I tested all this myself.. and it failed for me as well when I ran it in the development enviornment. Evidently, some Frame Actions do not function correctly in the dev enviornment, despite having "Enable Frame Actions" on.

    You can, however, use the "Test Movie" command in the "Control" menu to quickly test the movie.. and all the frame actions WILL work correctly there. (Well.. that works for PCs at least).


  8. #8
    Junior Member
    Join Date
    Mar 2000
    Posts
    13

    Post

    i thought this was working but it isn't... i used the "test movie" function and it worked fine, but once i took it into my browser, the function no longer worked. so i checked my plugin and sure enough i had plug in flash v3, where i was using flash v4 to create the movie. so i exported the movie again as a v3 file and this time got this error:

    ----------------------

    WARNING: This movie uses features that are not supported in the Flash 3 player
    Scene=Scene 1, Layer=blue day, Frame=1: Set Variable Action
    Scene=Scene 1, Layer=blue day, Frame=1: Set Variable Action
    Scene=Scene 1, Layer=blue day, Frame=1: Set Variable Action
    Scene=Scene 1, Layer=blue day, Frame=1: Set Variable Action

    --------------------------

    just fyi, the script i have for my blue day buttons is:

    On (Release)
    Set Variable: "leday" = "1"
    Go to and Play ("fadein")
    End on

    does this mean that earlier than flash 4 doesn't allow for setting variables? doesn't seem likely so perhaps i'm misunderstanding something else.... is there another way of doing it??

    thanks so much once, once again, guys for your input on this.

    chundle

  9. #9
    Senior Moderator
    Defender of the Faith
    Pope de Flash's Avatar
    Join Date
    Feb 2000
    Posts
    3,429

    Post

    Flash 4 is the first and only verison to support variables.Sounds like your going have to get an upgrade the plugin. Regards, Bill

    ------------------
    Macromedians 1:1

    In the beginning the web was without shape and color, and the hype covered the darkness of the net. Then there was a Flash and life came to the web and vision became reality.

    [This message has been edited by Pope de Flash (edited 03 March 2000).]

  10. #10
    Senior Member
    Join Date
    Feb 2000
    Posts
    195

    Post

    Hard to imagine a Flash without variables.

  11. #11
    Senior Moderator
    Defender of the Faith
    Pope de Flash's Avatar
    Join Date
    Feb 2000
    Posts
    3,429

    Cool

    The funny thing is when Flash 2 came out and(future splash)pre-macromedia days. All it ever was designed to be was a simple vector animator, which it was, man how thats changed. I cant imagine what flash would be like without the tell target command, and movie clips, and everything else. Flash 2 was great but next to 4 its a yugo. Dont have a clue what will be in 5 but I cant wait. Its gona rock. Regards, Bill

    ------------------
    Macromedians 1:1

    In the beginning the web was without shape and color, and the hype covered the darkness of the net. Then there was a Flash and life came to the web and vision became reality.

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