A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Button / movie control hassle, solution needed!

  1. #1
    Junior Member
    Join Date
    Sep 2003
    Location
    Berkshire, England
    Posts
    9

    Button / movie control hassle, solution needed!

    Hi folks,

    I’m having big time trouble with something that should be simple and it’s
    driving me nuts!

    Please refer to attached file test2.fla)

    Ok, I have a button (instance name: quizbutton) inside a movie (movie name: button movie).

    The root timeline has two frames and on preview the timeline is to stop at frame 2 (which it does).

    ‘quizbutton’ is inside ‘button movie’ on frame 2 of the timeline, when I
    click ‘quizbutton’ I want the root timeline to go to frame 1 of the timeline
    and then I want the movie (instance name: movie) on frame one of 'movie' to stop at frame 2, which on preview SHOULD be indicated by a purple square with the numer ‘2’ on it

    It should be simple but it just won’t work! It only works if I turn ‘button movie’ on the root timeline into a graphic (via the properties drop-down).

    Trouble is, this can’t be a graphic because it’s part of a more complex file.
    The ActionScript I’m using on ‘quizbutton’ is:

    on (release) {
    _root.gotoAndStop(1);
    _root.movie.gotoAndStop(2);
    }


    Should be simple eh!!

    If anyone can help be out here it would be very much appreciated, thanks very much in advance ! big, big thanks .… I’m in a desperate hurry with it

    Email: kitachi@f2s.com if anyone can sort the file

    AD
    Attached Files Attached Files
    Kind Regards

    Adrian Kitachi

  2. #2
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Hey there,

    Ok I want to start of by saying that your method of organization was pretty bad. I think you complicated things by having seperate frames and uneeded movieclips for the button.

    Of course that was only a test file, so I cant really know for sure if thats the best way of going about your project.


    Anyways, enough of my rants. I fixed your problem. I did a few things that Ill explain here.

    1) First of all the problem was this. When you clicked your button, it sent the root movie to go to frame 1. It also told the movie movieclip to go to frame 2 which contained the purple colouring.
    This didnt work because the button was contained on frame 2 whereas the movieclip was contained on frame1. You could have fixed this by placing the button on the first frame.
    But since I assumed you wanted to keep things the way they were, I fixed it leaving everything in place.

    2) On frame 2 that contains the button movieclip, I gave it an instance name. The instance name I gave it was buttonMovie

    3) I then deleted all the code of the quizbutton

    4) Finally, if you click on frame 1 and hit F9 to open the Actions Panel, you will see that I placed that following code:

    code:

    onEnterFrame = function () {
    _root.buttonMovie.quizButton.onRelease = function() {
    _root.gotoAndStop(1);
    _root.movie.gotoAndStop(2);
    };
    };



    This works because like I stated before, the button needs to be contained on the same frame. But since its on frame 2, I comprimised and instead put the code on the first frame.

    You will notice it looks almost similar in that it tells the root to go to frame 1 and the movieclip to go to frame 2. The only difference is that its contained in an enterFrame handler. What this handler does is constantly checks if the button is being clicked, and if so, execute what it has contained in it.

    Well thats pretty much it, ill attach the file here as well as email it to you just in case you get it first there.

    Enjoy, and good luck
    Last edited by Osteel; 05-01-2009 at 02:38 AM.

  3. #3
    Junior Member
    Join Date
    Sep 2003
    Location
    Berkshire, England
    Posts
    9
    Hey Buddy,

    Thanks so much for your help there buddy, you got me out of a sticky situation; you don’t know how much I appreciate it.

    Sorry for the slow response but I’m in England and I was up all night trying to get that working, It’s amazing how the hours fly by; I woke up today at 4pm, yikes!

    I’ve got it working now in the dummy and I’ve just got the migrate it over into the actual E-Learning
    application I’m building.

    www.kitachi.info/expand/expand.htm

    The function you helped me with will prove really handy in the future, I really need to brush up on my AS, I’m predominately a designer hence I’m learning coding pretty slowly :P

    It’s really reassuring that there are guys like you around….. If I can ever offer any help graphics-wise Please don’t hesitate to give me a holla.

    Well gotta go, I’m preparing for a design job interview tomorrow in London…

    Take it easy Buddy

    Adrian
    Kind Regards

    Adrian Kitachi

  4. #4
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Hey Adrian,

    No problem, glad I was able to help. I guess switching over to the main part is going to be the tricky part, finding where to place everything to make it work. But hey, thats what these Forums are for.

    Anyways, if you need anymore help, just post back here in Flashkit and someone will come to your aid

    Good job and good luck on your interview!

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