Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5973607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:49:25+00:00 2026-05-22T20:49:25+00:00

I am using the following code… I want to run the function Food_scroll_ratio() only

  • 0

I am using the following code… I want to run the function Food_scroll_ratio() only when the draggable movieclip is being moved and not while it is just pressed but can’t work out how to do it.

onClipEvent (load) {
    Symptoms_sliders = new Array(this._parent.slider1.slider, this._parent.slider2.slider, this._parent.slider3.slider, this._parent.slider4.slider, this._parent.slider5.slider);
    Food_sliders = new Array(this._parent.slider6.slider, this._parent.slider7.slider, this._parent.slider8.slider, this._parent.slider9.slider);
    for (i=0; i<Food_sliders.length; i++) {
        Food_sliders[i]._y = 75;
    }
    is_scrolling = 0;
    function Food_scroll_ratio() {
        init_scroll_diff = init_scroll_num-init_scroll._y;
        Slider_ratio = new Array();
        totalLeft = 100-(100-init_scroll._y);
        for (i=0; i<Food_sliders.length; i++) {
            if (Food_sliders[i] != init_scroll) {
                slider_pos = Food_sliders[i]._y;
                percentageOf = (init_slider_pos[i]/totalLeft)*100;
                percentageMultiplier = 100/percentageOf;
                scroll_change = Math.abs(init_scroll_diff)/percentageMultiplier;
                trace(scroll_change);
                if (init_scroll_diff>0) {
                    Food_sliders[i]._y = slider_pos+scroll_change;
                }
                if (init_scroll_diff<0) {
                    Food_sliders[i]._y = slider_pos-scroll_change;
                }

            }
        }
    }
}
onClipEvent (enterFrame) {
    for (i=0; i<Food_sliders.length; i++) {
        Food_sliders[i].onMouseDown = function() {


        };
        Food_sliders[i].onPress = function() {
            startDrag(this, false, 0, 100, 0, 0);
            init_scroll_num = this._y;
            init_scroll = this;
            is_scrolling = 1;
            init_slider_pos = new Array();
            init_slider_pos.push(100-Food_sliders[0]._y);
            init_slider_pos.push(100-Food_sliders[1]._y);
            init_slider_pos.push(100-Food_sliders[2]._y);
            init_slider_pos.push(100-Food_sliders[3]._y);
        };
        Food_sliders[i].onRelease = Food_sliders[i].onReleaseOutside=function () {
            stopDrag();
            is_scrolling = 0;
        };

    }
    if (is_scrolling == 1) {
        Food_scroll_ratio();
    }
}

Help appreciated cheers

Solved

Thanks I used a combination onMouseMove on the clip event and a while loop as shown below:

while (_global.init_moved != init_scroll._y) {
            for (i=0; i<Food_sliders.length; i++) {
                if (Food_sliders[i] != init_scroll) {
                    slider_pos = Food_sliders[i]._y;
                    percentageOf = ((100-init_slider_pos[i])/totalLeft)*100;
                    percentageMultiplier = 100/percentageOf;
                    trace(percentageMultiplier);
                    if (init_scroll_num == 0) {
                        scroll_change = Math.round(Math.abs(init_scroll_diff/3));
                    } else {
                        scroll_change = Math.round(Math.abs(init_scroll_diff)/percentageMultiplier);
                    }
                    if (percentageOf == Infinity) {
                        Food_sliders[i]._y = 100;
                    } else if (init_scroll_diff>0) {
                        Food_sliders[i]._y = init_slider_pos[i]+scroll_change;
                    } else if (init_scroll_diff<0) {
                        Food_sliders[i]._y = init_slider_pos[i]-scroll_change;
                    }

                }
            }
            _global.init_moved = init_scroll._y;

        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:49:26+00:00Added an answer on May 22, 2026 at 8:49 pm

    You should use onMouseMove instead of onEnterFrame for dragging or it will become choppy! That will also solve your problem, if you check for onMouseMove + onMouseDown. Or alternatively you can use the built in onDrag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
I open a pop-up window using following code in main.html function openwindow(url) { window.open(url,
i m using following code to populate dropdownlist dynamically... i want that value should
I am using following code to populate DropDown: $(document).ready(function(){ $('#inDistrict').sSelect(); $(#inDistrict).change(function(){ $.getJSON(filldistricts.php,{id: $(this).val(), ajax:
I am using following code UiApplication.getUiApplication().invokeLater(new Runnable(){ public void run(){ // your code here
I am using following code and want to know whether we require to set
i am using following code to get GPS location. now i want to get
I am using following code, but my progress bar is not displaying in the
I am using following code in CSS to render fonts, but it is not
I am using following code to animate in Jquery. I want step2 to occur

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.