Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

flash tutorial gone wrong..

New Here ,
Aug 05, 2009 Aug 05, 2009

Hello

I am trying to create a custom scrollbar for a website... I watched the tutorial>http://www.entheosweb.com/Flash/video_tutorials/custom_scroller.asp

on how to create one. I have the scrollbar working but it won't attach to the text!

Here is the actionscript:

var scrollUpper:Number = 338.2;
var scrollLower:Number = 498.2;

var textLower:Number = 337.0;
var textUpper:Number = 514;

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

function scroll () {
    var moved:Number = scroller_mc._y - scrollUpper;
    var pctMover: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;
}

I have the text in a mc called text_mc and the scrollbar in scroll_mc. There is a mask over the text.

Thank you for your time!

Virginia

TOPICS
ActionScript
597
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 05, 2009 Aug 05, 2009

you have a typo.  use:


var scrollUpper:Number = 338.2;
var scrollLower:Number = 498.2;

var textLower:Number = 337.0;
var textUpper:Number = 514;

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

function scroll () {
    var moved:Number = scroller_mc._y - scrollUpper;
    var pctMover: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;
}


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 05, 2009 Aug 05, 2009

I added the period but it still didn't work.. Here is my new as>

var scrollUpper:Number = 338.2;
var scrollLower:Number = 498.2;

var textLower:Number = 337.0;
var textUpper:Number = 514;

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

function scroll () {
    var moved:Number = scroller_mc._y - scrollUpper;
    var pctMover: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;
}

Any ideas? Thank you so much for your help!

Virginia

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 05, 2009 Aug 05, 2009

you have a 2nd typo:


var scrollUpper:Number = 338.2;
var scrollLower:Number = 498.2;

var textLower:Number = 337.0;
var textUpper:Number = 514;

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;
}

Any ideas? Thank you so much for your help!

Virginia

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 05, 2009 Aug 05, 2009

Yeah!! Thank you ! I knew I needed a second pair of eyes for a minute.

Thank you!

Virginia

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 05, 2009 Aug 05, 2009
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines