A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: Distant buttons

  1. #1
    Junior Member
    Join Date
    Oct 2002
    Location
    Spain
    Posts
    5

    Distant buttons

    This is what I have:
    A movie clip and four buttons that play different parts of it.

    This is what I would like to have:
    The buttons should be placed so far away from the movie that they must (I think) be on a separate file.

    This is what I don't have:
    A way to send GotoAndPlay commands from the "Button movie" to the "Movie movie".

    This is what I need:
    Help.





    Thanks

  2. #2
    Senior Member of Toon Army lucky-black-cat's Avatar
    Join Date
    Aug 2002
    Location
    Benarraba Andalucia Spain
    Posts
    303
    Hi

    The distance of one mc to another physically on the stage doesn't matter at all!

    You need to give your mc's an instance name .. say buttons and movie.
    If you name a mc you can target it (control it)

    On the actions for the buttons you can now have this code

    Code:
    on(release){
         movie.gotoAndPlay(5);
    }
    This will goto frame 5 of the 'movie' mc and play when the button is released.
    http://www.property-in-the-sun.com
    Cheap Holidays in Andalucia Spain for Flash Programmers from 2005!

  3. #3
    Junior Member
    Join Date
    Oct 2002
    Location
    Spain
    Posts
    5
    You mean that everything (including the other stuff) has to be inside then same flash object? I'm not sure if I can fix the *(%·#& page that way.

  4. #4
    Senior Member of Toon Army lucky-black-cat's Avatar
    Join Date
    Aug 2002
    Location
    Benarraba Andalucia Spain
    Posts
    303
    No, they don't need to be in anything ... they are on the 'stage'
    your diagram looks fine.

    Click on the movie, and in the properties box under movieclip (top left) type in an instance name. ie movie

    Now put the code I posted earlier on the actions for your buttons changing the frame number to whatever you wish.
    http://www.property-in-the-sun.com
    Cheap Holidays in Andalucia Spain for Flash Programmers from 2005!

  5. #5
    Junior Member
    Join Date
    Oct 2002
    Location
    Spain
    Posts
    5
    O.K. I think i've got the idea. I'll tell you later.

    Thanks.

  6. #6
    Junior Member
    Join Date
    Oct 2002
    Posts
    20
    how do i give my movies an instance name... ?

    i can't find it :/

    (got mx btw)

  7. #7
    Senior Member of Toon Army lucky-black-cat's Avatar
    Join Date
    Aug 2002
    Location
    Benarraba Andalucia Spain
    Posts
    303
    Hi Shanks,

    After you have created your movie clip (mc) and it is in the library.
    You can create as many 'instances' of the mc as you want.
    You can control these copies of the mc as seperate mc's by giving them an instance name.
    You do this by left clicking on the mc on the stage, look at the Properties box, in the top lefthand corner it should say Movie Clip, under this there is a box to type in your mc's instance name.
    http://www.property-in-the-sun.com
    Cheap Holidays in Andalucia Spain for Flash Programmers from 2005!

  8. #8
    Junior Member
    Join Date
    Oct 2002
    Posts
    20
    aaah.. the problem i had before is that they weren't movice clips :P

    i done that now.. but i have new problem: my animation is 200 keyframes long... i want that as one movie clip. its all in one layer..

    how do i do this please?

  9. #9
    Junior Member
    Join Date
    Oct 2002
    Posts
    20
    ok. IGnore that :P

    I've got my mc (cubes) and i've got my buttons (remote)...

    the code on the button in remote, is:

    on (release) {
    cubes.gotoAndPlay(1);
    }

    .. this should restart the cubes animation.. but it doesn't do any thing
    i tried adding _root. infront of the main line, and no change. >:|

    any ideas?! :/

  10. #10
    Senior Member of Toon Army lucky-black-cat's Avatar
    Join Date
    Aug 2002
    Location
    Benarraba Andalucia Spain
    Posts
    303
    Hi Shanks

    You have created a movie clip called cubes -- yes?
    It's in your library CTRL/L -- yes?
    Click on the instance of the mc cubes on the stage -- done?
    Look at the properties panel top left corner,
    see the box below where it says Movie Clip -- yes?
    type in cubes1 -- this names that copy of cubes 'cubes1'
    Change the line on remote to cubes1.gotoAndPlay(1);

    If you have already done all this and it still doesn't work ... you should have placed remote and cubes on different layers of the timeline? So that they are both on the timeline at the same time. ie remote (layer1) and cubes1(layer2) are both on Frame 1

    It seems complicated ... its easy once you do it.
    You will soon see that there are good reasons for naming mc's
    http://www.property-in-the-sun.com
    Cheap Holidays in Andalucia Spain for Flash Programmers from 2005!

  11. #11
    Junior Member
    Join Date
    Oct 2002
    Posts
    20
    Thanks lucky =))

    The problem was that they were on diff. timelines.. but i put them into the same movie, and now just use _root.cubes. ... and it all works =)

    http://shanks.*****nut.net/test.html for what i got so far :P

    thanks again for it all.


    l8z

  12. #12
    Senior Member of Toon Army lucky-black-cat's Avatar
    Join Date
    Aug 2002
    Location
    Benarraba Andalucia Spain
    Posts
    303
    Hi Shanks,

    Checked out your page .. love the cubes .. really good
    http://www.property-in-the-sun.com
    Cheap Holidays in Andalucia Spain for Flash Programmers from 2005!

  13. #13
    Junior Member
    Join Date
    Oct 2002
    Posts
    20
    thx

    i was wondering (this is a little off topic btw) if you could help me with the next prob...


    for the stop button, i don't want it to simple stop..

    i want it to continue playing the movie until it reaches frame X, and then go to frame Y.
    ....

    It could get more complicated, in the form of disabling the play button unless the movie is on frame Y... but thats a minor point i not worried about atm... :O

    Any ideas?

  14. #14
    Senior Member of Toon Army lucky-black-cat's Avatar
    Join Date
    Aug 2002
    Location
    Benarraba Andalucia Spain
    Posts
    303
    Hi,

    You could have a variable say .. pressed which you set to = false ... and on the button have ..

    Code:
    on(release){
       pressed = true;
    }
    on frame X have ..

    Code:
    if(pressed){
        cubes.gotoAndPlay("Y");
    }
    Disable the play button by creating an instance of it with no on(event) attached to it.
    http://www.property-in-the-sun.com
    Cheap Holidays in Andalucia Spain for Flash Programmers from 2005!

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