A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: 6 Buttons, 6 Lights how do I make it work

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    6

    6 Buttons, 6 Lights how do I make it work

    I am trying to make a light comparison chart where the lights can be turned on inividually by the user and one can be compared to another depending on which of the 6 lights you want to view.
    So far i have managed to make this work with 5 lights over 33 layers and diffferent buttons and different handlers for each of the buttons on each layer but as soon as the 4 and 5 light come into play everything slows down struggles and sometimes gives up.
    Is there a simple way of doing this which i am unaware of.
    I am currently using the gotoandstop comand to go to a specific frame based on the button press.

  2. #2
    Senior Member
    Join Date
    May 2008
    Posts
    332
    Sounds like there must be some type of looping going on that eventually consumes all the cpu resources and slows it to a crawl. So it's like juggling 2 or 3 balls. Easy, any 2 or 3 can be handled, but when you ask the machine to keep juggling those 3 and then add 1, 2, 3, more it's too much.
    So I'm guessing that the code is making constant evaluations or running something over and over and then you add a new task and then another until the machine can't keep up.
    If it's just a few lights I don't see why the looping or evaluations would be necessary.
    Best wishes,
    Eye for Video
    www.cidigitalmedia.com

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    6
    Hi Eye for Video,
    Thank you for your response i am very new to flash and have only just learnt how to make a button goto a frame.
    I am not intentionally looping i am using:-

    btn193_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler193);
    function mouseDownHandler193(event:MouseEvent):void {
    gotoAndStop(145);
    }

    and repeating this command for each button on each layer.
    I am creating new layers and button because i figure in each posible combination will lead to the buttons having to do a different thing.

    Exactly like you have said with 3 lights no problem but as soon as i added the fourth in the problems started.

    Is it possible to have the light turn on by splitting the screen in 6 and having a simple check box for which lights i want on at any one time?

    I can send you the flash movie in its current format so you can see what i am trying to do if you like.

    I have attached a screen shot but the fla file is too big to attach.
    Cheers

    DavidSolar
    Attached Images Attached Images

  4. #4
    Senior Member
    Join Date
    May 2008
    Posts
    332
    Is there more to this than just the buttons turning the lights on and off? Is the display animated in some way.. flickering lights, etc? Is the lighted area an image or is it a dynamic illustration, using masking and gradients? Why so many frames, are there lots of tween?
    Seems like a lot of frames for a fairly simple display. What do you mean by
    I am creating new layers and button because i figure in each posible combination will lead to the buttons having to do a different thing.
    Any other details about stuff besides the buttons?
    Eye for Video

  5. #5
    Junior Member
    Join Date
    Feb 2010
    Posts
    6
    Hi,

    No it is simply turning the lights on and off - the only complication is i want to be able to do any combination of on and offs so any selection of 1, 2, 3, 4, 5 or 6 lights on.
    No animation required just whichever lights the user wishes to select can be selected and turn on and off as they choose.
    Am i missing something very straight forward?

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Posts
    6
    Sorry - the lighted areas are individual images for each light, i have not used any masking or gradients.
    I used the attached button example to get me started and just tried to replicate it with more buttons and a background.
    i am creating the buttons on different layers as i when they were on the same layer i could not get it to stop it would just run through like a movie.
    Attached Images Attached Images

  7. #7
    Senior Member
    Join Date
    May 2008
    Posts
    332
    Have you considered using a movie clip to hold each light?
    So light1_mc could be a 2 frame movie clip. Frame 1, on, frame 2 off.
    One mc for each light.
    Then in one frame on main timeline, 7 layers. An actions layer and one layer for each light.
    All actions in main timeline, light1_mc, on/off, click to go to frame 2 (light is on), click again, go to frame 1, light is off.
    Repeat for other lights.
    Start simple, just get that first light to work that way and the rest would be a piece of cake.
    Best wishes,
    Eye for Video
    www.cidigitalmedia.com

  8. #8
    Junior Member
    Join Date
    Feb 2010
    Posts
    6
    I will give this ago and post my results.
    Thank you ever so much for taking the time to help me.
    DavidSolar

  9. #9
    Junior Member
    Join Date
    Feb 2010
    Posts
    6
    Thank you Eye for Video,

    I got it working i did need to do the lights as movie clips but made it work by putting the actions in a different layer within the movie clip. i could not work out how to do it in the main time frame but the end result is what i wanted so thankyou ever so much once again.

    DavidSolar

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