A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: AS3 + Buttons

  1. #1
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55

    AS3 + Buttons

    I'm trying to do a button within a button for my navbar. For this button, the bottom layer contains a movie clip that fades in when the primary button clip is moused over. Theres also a layer with a movieclip that contains all of the navbars actual buttons on top of the fade in clip, they extend through all 4 stages. I think i'm having a problem with which item is in focus, because either nothing happens when i click on them because the parent button steal the click, or when i bring the button clip out of the main button movie clip, and place it on top, flash focuses on the sub buttons, and fails to animated the bottom layer.

    Is there a way to specify to keep the bottom clip on the _over stage, but still allow buttons which are placed above them to be clickable?

  2. #2
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    You are in the wrong forum buddy, the AS 3.0 forum is right after the next corner. But anyways, if you want to disable the children of a movie clip then you could simply use yourMovieClip.mouseChildren = false; that will prevent the children of the parent from reacting to any mouse events.



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  3. #3
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55
    would that disable MouseEvent.Click ?

    (sorry didnt know if it was an AS3 question or a basic flash index ordering question)

  4. #4
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Well, the thread title says "AS3 + buttons" ... are you using AS 3.0 or 2.0 ? Because you got me confused...



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  5. #5
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55
    AS3 with the nested buttons being activated instance.buttonmode = true;

  6. #6
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Could you maybe post the .fla so I can take a look at it ? It would be much easier because I'm not totally getting your problem... on the other hand, as a friendly advice: DON'T USE BUTTONS !!! USE ONLY MOVIE CLIP !!!

    Button symbols are evil, bad, limited and crap. All that you'll ever need are called Movie Clips, you can do whatever you want with them.



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  7. #7
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55
    Here are the files
    Attached Files Attached Files

  8. #8
    Member
    Join Date
    May 2005
    Location
    San Francisco
    Posts
    55
    wont let me upload the .as file -

    package {

    import flash.display.*;
    import flash.net.*;
    import flash.events.*;
    import flash.text.*;


    public class buttonTest2 extends MovieClip {

    public var sfgovStat:Boolean = false;

    // create a new LocalConnection instance used to send
    // calls to a LocalConnection instance in another movie
    var outgoing_lc:LocalConnection = new LocalConnection();

    public function buttonTest2() {
    btn1.buttonMode = true;
    btn2.buttonMode = true;
    btn3.buttonMode = true;
    bg.buttonMode = true;
    btn1.addEventListener(MouseEvent.CLICK, myTrace);
    btn2.addEventListener(MouseEvent.CLICK, myTrace);
    btn3.addEventListener(MouseEvent.CLICK, myTrace);
    bg.gotoAndStop(1);
    bg.addEventListener(MouseEvent.ROLL_OVER, myPlay);
    bg.addEventListener(MouseEvent.ROLL_OUT, myRewind);



    }

    // event handler when the send button is clicked

    function myTrace(event:MouseEvent):void {
    trace("Home --> Click");
    }
    function myPlay(event:MouseEvent):void {
    if (!sfgovStat) {
    trace("false");
    bg.play();
    sfgovStat = true;
    } else {
    }
    }
    function myRewind(event:MouseEvent):void {
    trace("Mouse Out goto and play 20");
    bg.gotoAndPlay(20);
    sfgovStat = false;
    }
    }
    }

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