A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: If, then statements to reveal boxes

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    4

    If, then statements to reveal boxes

    Help.

    I'm trying to create a series of 3 invisible boxes. Essentially I want them to act like hotspots. I want the first box, when it the mouse rolls over, to reveal the second box. Then the second box will reveal the third when rolled over.

    Is there a way of doing this with if, then statements instead of sending the user to a new frame?

    Thanks for your help.

  2. #2
    Member
    Join Date
    Jan 2003
    Location
    Tokyo
    Posts
    78
    if the boxes were movie clips, and they all had buttons in them, and when you rolled over the button, it would change the alpha of another box? are the boxes that are affected the same ones each time? if so, it should work.

    Say if you had three boxes, and their instance names were boxone etc...
    code:

    on (rollOver){
    _root.boxtwo._alpha=100
    }
    on (rollOut){
    _root.boxtwo._alpha=0
    }



    I'm not sure if that's what you were after... maybe, though.

  3. #3
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi.................
    Here is a fla. demonstrating what assembler has just mentioned....
    Last edited by hum; 10-21-2004 at 11:50 AM.

  4. #4
    Member
    Join Date
    Jan 2003
    Location
    Tokyo
    Posts
    78
    awww shucks...

  5. #5
    Junior Member
    Join Date
    Oct 2004
    Posts
    4

    Thanks to hum and assembler

    Thanks for your help.

    Yet, I think I was asking the wrong question. Here's an attachment of a school project that I working on. In the file, I used a code that tracks and traces the movement of the mouse. If the user "draws" in the center of the field the title "{{{Commercial Wasteland}}}" becomes visible. Moreover, a hidden button is placed on far right bracket. This button leads to the next scene. While this was a simple solution to get to the next scene, I want to make it more rewarding for the user. What I would prefer is the next scene would load after the user uncovers most of the title. I thought that the most simpliest approach would be using several boxes throughout the field. And if the mouse rolls over and activates all the boxes, then it would lead to the next scene.

    So any suggestions? Hopefully this didn't sound to confusing. I tried but I still don't have a handle on script writing. I hope someone can help. Thanks.

  6. #6
    Junior Member
    Join Date
    Oct 2004
    Posts
    4

    File

    Sorry I forgot the attachment.
    Attached Files Attached Files

  7. #7
    Inspector General
    Join Date
    May 2001
    Posts
    493
    i posted the swf for you and others to see: commercial_v2

    there are 6 movieclips set to act like buttons on the stage. they are initiated with a variable beenhit==false;

    if they haven't been hit, they show a rollover, set their beenhit value to true(to prevent another rollover) and they update a counter variable called buttonhit in the main timeline which keeps track of how many buttons have been activated. you can rollover the buttons in any order. also you can shrink them or make them invisible as you like.

    here is the rundown of the code:

    onClipEvent (load) {
    this.beenhit = false;
    }
    on (rollOver) {
    if (this.beenhit == false) {
    trace("you hit me");
    gotoAndStop("highlight");
    _root.buttonhit++;
    this.beenhit=true;
    }
    }
    on (rollOut) {
    if (_root.buttonhit == 6) {
    // goto next scene or load movie or something
    _root.youfoundit._visible = true;
    }
    }

    if you add more buttons you must change the line:
    _root.buttonhit == 6
    to represent the number of buttons you have. this could be done in one step with a function, but i didn't want to make it confusing.


    as a side note: i give you a lot of credit for your creativity. as a small warning it took me awhile to figure out how your movie is supposed to work. you may want to give your users some hints.

    good luck with the project.
    i'll check back in the morning to see if you need any more help.

    carl
    Attached Files Attached Files

  8. #8
    Junior Member
    Join Date
    Oct 2004
    Posts
    4

    Thank you meglomor

    thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you

  9. #9
    Inspector General
    Join Date
    May 2001
    Posts
    493
    glad to 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