Click to See Complete Forum and Search --> : flash scrollbar not working properly


rusty813
12-03-2010, 03:16 PM
I have flash mx version 6.0 and i followed a tutorial online to create a scrollbar, the problem i am experience everytime i drag the scrollbar it scrolls button does not stay on the scrollbar line so i can move where ever i want it to be which is suppose not happen according the video produce by this website:

http://www.entheosweb.com/Flash/video_tutorials/custom_scroller.asp


here is my coding:

var scrollUpper:Number = 17;
var scrollLower:Number = 309.5;

var textLower:Number = 7
var textUpper:Number = -367.4;

var scrollRange:Number = scrollLower - scrollUpper;
var textRange:Number = textLower - textUpper;

function scroll() {
var moved:Number = scroller_mc._y - scrollUpper;
var pctMoved:Number = moved/scrollRange;
var textMove:Number = pctMoved*textRange;
text_mc._y = textLower - textMove;
}

scroller_mc.onPress = function() {
this.startDrag(false,this._x,scrollUpper,this._x,scrollLower);
this.onMouseMove = scroll;
}

scroller_mc.onRelease = scroller_mc.onReleaseOutside = function() {
this.stopDrag();
this.onMouseMove = null;
}

mankis
12-03-2010, 07:35 PM
Try to give mask name maska and use this code. I have also added trace function so we can see is there some problem with connecting function with a movieclip. If the trace don't run when you click scroller_mc than you should check instance name under properties.

var scrollUpper:Number = maska._y;
var scrollLower:Number = maska._y+maska._height;

var textLower:Number = maska._y;
var textUpper:Number = maska._y-maska._height;

var scrollRange:Number = scrollLower-scrollUpper;
var textRange:Number = textLower-textUpper;

function scroll() {
var moved:Number = scroller_mc._y-scrollUpper;
var pctMoved:Number = moved/scrollRange;
var textMove:Number = pctMoved*textRange;
text_mc._y = textLower-textMove;
}

scroller_mc.onPress = function() {
this.startDrag(false,this._x,scrollUpper,this._x,scrollLower);
this.onMouseMove = scroll;
trace("is scrolling");
};

scroller_mc.onRelease = scroller_mc.onReleaseOutside=function () {
this.stopDrag();
this.onMouseMove = null;
};

rusty813
12-04-2010, 01:44 AM
i copy and pasted everything you written, and i got an output message saying "is scrolling" everytime i drag the down the dot, and its still able to move anywhere on the screen...

i tried interpreting the first part of the message, did you want me to create on the mask layer and give it a frame name of maska or what would do you want me to do since i was confuse on that part, right now it has a frame name maska, but i can change its wrong

mankis
12-04-2010, 02:36 AM
You should convert mask into movieclip (if it's not) and name it maska.
Also check your Publish Settings. ActionScript version should be 2.0

mankis
12-04-2010, 02:47 AM
I made mistake with previous code on line 5. But it's not the reason why is not working for you. I would send you my fla file but I have Flash CS3, don't know how you will open it.

var scrollUpper:Number = maska._y;
var scrollLower:Number = maska._y+maska._height;

var textLower:Number = maska._y;
var textUpper:Number = maska._y-text_mc._height;

var scrollRange:Number = scrollLower-scrollUpper;
var textRange:Number = textLower-textUpper;

function scroll() {
var moved:Number = scroller_mc._y-scrollUpper;
var pctMoved:Number = moved/scrollRange;
var textMove:Number = pctMoved*textRange;
text_mc._y = textLower-textMove;
}

scroller_mc.onPress = function() {
this.startDrag(false,this._x,scrollUpper,this._x,scrollLower);
this.onMouseMove = scroll;
trace("is scrolling");
};

scroller_mc.onRelease = scroller_mc.onReleaseOutside=function () {
this.stopDrag();
this.onMouseMove = null;
};

mankis
12-04-2010, 02:53 AM
Here is the fla file if you can somehow open it www.mankis.hr/webdeveloper/scrollbar.zip (http://www.mankis.hr/webdeveloper/scrollbar.zip)

rusty813
12-04-2010, 06:43 PM
thanks alot ...yea i tried what you told me to do and i got unexpected file format, but i tried what told me to do, it did work either, i notice in the tutorial video that the word scroll turned blue after he typed it in and that does it happen in mines it just stays black, so i am guessing thats where is the the problem

mankis
12-04-2010, 07:14 PM
But have you checked Actionscript version. It must be it. To me when I set Publish settings to Actionscript 1.0 I get the same problem you have. but when I set Actionscript 2.0 everything works.
You have to go to File->Publish Settings->click on tab Flash if it's not already open-> Actionscript version choose 2.0

rusty813
12-04-2010, 11:48 PM
yea i dont got actionscript 2.0, just gives flash player 1, 2, 3, 4, 5, 6 and the current one its on right now is flash player 6

http://i52.tinypic.com/swzrxw.jpg

mankis
12-05-2010, 05:45 AM
Your flash version is too old. It seams that it has only Actionscript 1.0, that nobody uses anymore. You have to get new one if you wish to be able to learn and work in Actionscript 2.0 and Actionscript 3.0.

rusty813
12-05-2010, 03:38 PM
how do i update the flash version in flash mx

mankis
12-06-2010, 02:25 AM
I'm not sure, it's very old version. You can always download trial of new version here https://www.adobe.com/cfusion/tdrc/index.cfm?product=master_collection and try to contact adobe support and ask.

criterion9
12-06-2010, 08:58 AM
how do i update the flash version in flash mx

You'll need to purchase a new version of the software from Adobe (CS5 is the current version I think). I haven't seen any MX versions since the Adobe/Macromedia merger many, many, many years ago.