A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: I think I may get fired :|

  1. #1
    Playful :)
    Join Date
    Jul 2007
    Location
    Vancouver
    Posts
    4

    I think I may get fired :|

    My boss is making me do this flash project and I am not a flash expert.

    I have a circle(like a clock) and when you choose a cell it should rotate to the 12 oclock position. I can't get this to work.....arrrg I need a drink .

    Is there any examples here I may look at?

  2. #2
    Member
    Join Date
    Jul 2007
    Posts
    40

    One way

    I'm not sure what you mean by "cell" but one way you could do this is make the "cell" a button. then you the button on handler. click the button and put this code on its action pane:

    Code:
    on(release)
    {
         //code to change the clock positions
         //The way I would do it is just declare the x 
         //position, y position, and rotation angle of 
         //the hands. You could also just have the hands
         //in the beginning position and have the alpha
         //at 100% but also draw hands at the 12 o'clock
         //position but make the alpha of them 0%. On
         //the release of this button, just make the
         //beginning hands' opacity 0% and the 12 o'clock
         //hands' opacity 100%
    }
    If the cell is a text box then the on(release) handler will not be good. You would then have to use a different handler for focus events. I don't remember the exact name of the function but it's something like:

    Code:
    yourTextBox.onGetFocus()=function
    {
          //the same code as in the block above
    }
    Note that this code would go on your main timeline action pane and not the text box's action pane. Remember to find the correct name and syntax for the focus event also because I am a bit rusty on that part.

  3. #3
    Playful :)
    Join Date
    Jul 2007
    Location
    Vancouver
    Posts
    4
    Hi thanks for replying so fast, you area sweet heart

    There are no hands on this thing..here it is www.fourleafer.com/flash.html

    Each section has a box in it and it should rotate to the top once clicked

  4. #4
    Senior Member
    Join Date
    Feb 2006
    Location
    Melbourne, Australia
    Posts
    105
    So the circle spins so that the box you have selected is at the top?
    Natural Cow Design
    Interactive and Digital Multimedia - Identity Development and Branding - Design for Print - Consultation and Stratgegy Development

  5. #5
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    it'll probably be easier to help if you upload your fla.
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  6. #6
    Member
    Join Date
    Jul 2007
    Posts
    40

    Is this what you want?

    If all you have to do is make that spin then you just change the anlge of rotation in the on handler. If you want it to animate and not just appear at the final position you could either have a motion tween set up and play that when something is clicked or you can use the onClipEvent(enterFrame){} function and change the angle by a certain increment in each frame. In case you don't know, you have to put onClipEvent(enterFrame){} in a movie clip's action pane. This function is run every time the frame is entered so if your movie is at 24 fps, then the function is run 24 times each second. An eash way to do this is to define a flag variable such as:

    Code:
    var check:String = "DON'T"
    The button code would be something like:

    Code:
    on(release)
    {
         _root.check = "DO";
    }
    and have the onClipEvent be something like this:

    Code:
    onClipEvent(enterFrame)
    {
         if(_root.check=="DO")
         {
              //change the angle of rotation
              //by a certain increment.
         }
    }
    It would be much easier to just make a motion tween if it works for what you want to do.

  7. #7
    Playful :)
    Join Date
    Jul 2007
    Location
    Vancouver
    Posts
    4
    ok I will play a bit this way...thanks for your time...you rock!!

  8. #8
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi
    Here is one way without using tweens.
    code:
    var sp = 5;
    var dir = 0;
    for (i=1; i<13; i++) {
    _root.circle_mc["m"+i].onPress = function() {
    this.gotoAndStop(2);
    if (_xmouse>Stage.width/2) {
    dir = 1;
    } else if (_xmouse<Stage.width/2) {
    dir = 0;
    }
    moveRotate();
    sp = 5;
    };
    }
    function moveRotate() {
    onEnterFrame = function () {
    if (dir == 1) {
    circle_mc._rotation -= sp;
    } else if (dir == 0) {
    circle_mc._rotation += sp;
    }
    };
    }
    for (i=1; i<13; i++) {
    _root.circle_mc["m"+i].onEnterFrame = function() {
    if (this.hit.hitTest(_root.hotspot)) {
    _root.sp = 0;
    this.gotoAndStop(1);
    }
    };
    }
    stop();



    I've included the fla for anyone whose interested
    which has detailed reference notes to gain an understanding.
    Feel free to use!
    Attached Files Attached Files

  9. #9
    Senior Member
    Join Date
    Apr 2000
    Location
    Northern Ireland
    Posts
    2,146
    hum's solution is okay if you want to run it like an image viewer, but my understanding was that when you click a certain panel it rotated to the top automatically. I (after nearly crippling my poor brain!) came up with a system that does just that - file is attached.

    Hope it's what you were after.
    Attached Files Attached Files
    ----------
    "Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." TERRY PRATCHETT

  10. #10
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hey garbage!

    Huh?
    The fla I sent does exactly that!
    You click on a cell then it will rotate
    the circle until it reaches the 12 o'clock position.

    Can you explain what you mean when you say "run it like an image viewer" ?
    Or maybe you didn't view the fla i sent.
    As it is doing exactly the same as yours!!
    Last edited by hum; 07-26-2007 at 07:38 AM.

  11. #11
    Senior Member
    Join Date
    Apr 2000
    Location
    Northern Ireland
    Posts
    2,146
    hum ... my most sincere apologies! I only have Flash MX, so I couldn't run your FLA, and from the quick glance I gave your code it didn't look like it did what it turns out it does! And much more eloquently than my damned fiddley math-based solution, too!

    I'm gonna modify my footer to warn people I can't view FLAs from anything over version 6

    More haste, less speed ... sorry!
    ----------
    "Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." TERRY PRATCHETT

  12. #12
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hey nay worries! We both found a different way to do the same thing.

  13. #13
    Playful :)
    Join Date
    Jul 2007
    Location
    Vancouver
    Posts
    4
    wow you guys are so good to me hehe

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