dcsimg
A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: rollover help

  1. #1
    Enter the Flash Dragon Prototype3X's Avatar
    Join Date
    Jul 2002
    Location
    In my Mind
    Posts
    1,107

    rollover help

    I have a button that when I rollover it I want it to play a MC
    "1-mc" and rollout stop anywhere in the MC.

    The MC has a stop() action in the first frame in frame 5 a gotoAndplay (2)

    On the button:

    on(rollOver){
    1-mc.gotoAndPlay(2);
    }
    on(rollOut){
    1-mc.gotoAndStop(3);
    }

    But nothing happens

    Any advice, code examples or tutorial would sure be appreciated!

  2. #2
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    Initially your code looks right, but then: you are calling the same movie clip (mc) in both actions. The first time you call it, you tell it to go to second frame, and PLAY!. Then - if there are only 3 frames (because you call the third afterwards) it'll play past both frame 2, 3 - and then start on frame 1 again.
    On the second event, mouse going away from the button, you tell the mc to go to and stop at frame 3.
    I think something should happen, at least if you've given your mc a correct instance name, but I don't think this is your intended effect

  3. #3
    Junior Member
    Join Date
    Dec 2002
    Location
    St. Louis
    Posts
    27

    ??

    Isnt the name of the clip supposed to come after the gotoAndPlay command?
    Flash is cool.

  4. #4
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    EUREKAAAA!
    It's not allowed to have names starting with numbers in Action Script/javascript!
    Give your instance another name, like mc1, that solves it!

  5. #5
    Enter the Flash Dragon Prototype3X's Avatar
    Join Date
    Jul 2002
    Location
    In my Mind
    Posts
    1,107
    OK But its works with this:

    on (rollOver) {
    tellTarget ("1-mc") {
    gotoAndPlay (2);
    }
    ;
    }
    on (rollOut) {
    tellTarget ("1-mc") {
    gotoAndStop (2);
    }
    ;
    }

    But I want on rollout to stop on a random frame

  6. #6
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    tellTarget? That's Flash 4...

  7. #7
    Enter the Flash Dragon Prototype3X's Avatar
    Join Date
    Jul 2002
    Location
    In my Mind
    Posts
    1,107
    Yeah but its works for MX

  8. #8
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    But didn't you get it to work with correct naming?

  9. #9
    Enter the Flash Dragon Prototype3X's Avatar
    Join Date
    Jul 2002
    Location
    In my Mind
    Posts
    1,107
    I have not tryed it yet, I was just happy I got it to work!!

    But now I want on rollout to stop on a random frame. How can I do this??

  10. #10
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    I've rewritten the on(rollOut)-code for you, so that the movie clip will go to any of 4 frames, and never before frame 1. (There's no such thing as a frame no. zero...
    Code:
     on(rollOut){
     mc1_mc.gotoAndStop(random(4)+1);
    }
    (The reason why I give my mc-s such funny names, with _mc in the end, is that Flash Actionscript window gives me much help while I attach these file name endings. Try with button_btn for buttons, etc. Much for free.)

  11. #11
    Enter the Flash Dragon Prototype3X's Avatar
    Join Date
    Jul 2002
    Location
    In my Mind
    Posts
    1,107
    TheCaramella

    Thanks it works just the way I wanted!!


    Can I ask another question? I have a button inside of a MC, the MC is on the main timeline. Now when I want to put a get url in the button I go in the actions panel but get url is disabled! WHY??

    Is it because the button is in a MC??

  12. #12
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    I'm not sure. Are you certain you are inside the Movie Clip, that you are actually trying to attach code to your button?
    Might be that you are outside the movie clip or the button, trying to attach code on a frame on a layer, instead of to a button object.
    On top of the actions window is a very useful address field. (Took a long time before I discovered it)
    This indicates where you are writing your code, and you can as well find the wanted object in this field. (Does it look like this on Mac? I always get a PC when teaching Flash in mixed classes...)

  13. #13
    Enter the Flash Dragon Prototype3X's Avatar
    Join Date
    Jul 2002
    Location
    In my Mind
    Posts
    1,107
    "Are you certain you are inside the Movie Clip" YES

    I see the button and when I click on it goes:

    Scene 1, controls-mc, quad-mc, quit-button

    But I checked in movie explorer and my quit-button is not under scene 1, it is under symbol definition. Why is this??

  14. #14
    The world goes - hm.. TheCaramella's Avatar
    Join Date
    Dec 2001
    Location
    Second door on the right, next to the ice bear
    Posts
    642
    Your button should be found both under scene 1, if that's your current scene, and under the symbol's definition list.
    It's a symbol, an object, that's why it shows up under there, as the rest of the library does.
    In what mode are you having the Action Script window? I use expert mode, then I create what code I want where I want - but sometimes not in the intended place...

  15. #15
    Enter the Flash Dragon Prototype3X's Avatar
    Join Date
    Jul 2002
    Location
    In my Mind
    Posts
    1,107
    I tryed normal and expert mode but the actions are still disabled

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