A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Wheel of fortune spinner - need help, please!

Hybrid View

  1. #1
    Member
    Join Date
    Jul 2008
    Location
    Čakovec, Croatia
    Posts
    34

    Unhappy Wheel of fortune spinner - need help, please!

    Recently I've found Spinner_v3.fla created by the member Nig 13 and I've changed it to the purpose of the new math game I'm creating... Since I've done the rotation within onEnterFrame function - the spinner itself is the event handler - I have no idea how to detect the chosen number: meaning on which number is the spinner stopped after each rotation - in other words: which part of the spinner is under the pointer...

    I thought to create a separate mc for each slice of the spinner (inside spinner) and somehow to "read" above which slice of the spinner (number) is the pointer after each rotation ...??? But I don't have the slightest idea how to achieve that...

    I really really hope that someone will be able to help me and thank you very much in advance!

    P.S. I previously posted this question in the "Newbies & General flash questions" category by accident ... Sorry for the inconvenience!

    Alex
    Attached Files Attached Files
    Last edited by avukovi4; 05-12-2013 at 02:55 PM.

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    _root.spinner.onEnterFrame = function() {
                    if (running == true) {
                            this._rotation -= speed;
                            if (speed <= 10) {
                                    if (speed <= 0) {
                                            speed = 0;
                                            blur_speed = 0;
                                            running = false;
                                            this.enabled = true;
                                            delete this.onEnterFrame;
                                            var num = this._rotation;
                                            num = (num > 0) ? 360 - num : Math.abs(num);
                                            num = Math.round((num * 10) / 360);
                                            num = (num < 10) ? num : 0;
                                            trace(num);
                                    } else {
                                            speed -= 0.1;
                                            blur_speed -= 0.04;
                                    }
                            } else {
                                    speed -= 0.5;
                                    blur_speed -= 0.2;
                            }
                            var myBlurFilter = new BlurFilter(blur_speed, blur_speed, 3);
                            this.filters = [myBlurFilter];
                    }
            };

  3. #3
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    damn, dawsonk beat me to it. how do you delete posts here?
    who is this? a word of friendly advice: FFS stop using AS2

  4. #4
    Member
    Join Date
    Jul 2008
    Location
    Čakovec, Croatia
    Posts
    34
    To dawsonk:
    Thank you million times!!!!!!! I did it rather primitive - I've checked manually which rotation interval will result with a certain number... Although I understand mathematical aspect of your solution, but I'm not that skillful with AS nor that much familiar with ?: operator, so I would appreciate if you could spend a few more minutes and explain a little bit the procedure behind the part of your code regarding reading the "num" variable... Thanks in advance!

    Best regards

    Alex

Tags for this Thread

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