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

Scroller

Participant ,
May 14, 2018 May 14, 2018

Would anyone like to help me with some things in my scroller.

I use movieclip objects in my but the original uses the graphic shape or draw a rectangle.

I want to use buttons and sliders in Movieclip. The button is a movie clip.

import flash.geom.Rectangle;

As you can see, they use As you can see, they use in the class

dragger.startDrag(false, new Rectangle(dragger.x, 0, 0, slider.height - dragger.height));

How do I do to pull down and up with dragger in the slider.

Can you help me solve it?

I have modified this code in .fla

easingScroll.fla

import ph.Zscrollez;

//-----------------------------------------------

var textoClip:Clip = new Clip();

var eScroll:Zscrollez = new Zscrollez(textoClip, 300);

eScroll.scrollBarProperties(60, 0xFB761E, 0x666666);

eScroll.backGround(0xFFFFFF, 0.5);

eScroll.scrollWheel = true;

eScroll.handCursor = true;

eScroll.x = eScroll.y = 15;

addChild(eScroll);

to

foto111edit.fla

import Zscrolla;

//----------------------------------------------- 

var textoClip:MovieClip = new album1_mc;

var eScroll:Zscrolla = new Zscrolla(textoClip, 100);

//eScroll.scrollBarProperties();

//eScroll.backGround(0xFFFFFF, 0.5);

eScroll.scrollWheel = true;

eScroll.handCursor = true;

eScroll.x = eScroll.y = 0;

addChild(eScroll);

--- In Zscrollez.as

package ph{

//

import flash.display.*;

import flash.events.*;

import flash.geom.Rectangle;

import fl.transitions.Tween;

import fl.transitions.easing.*;

import ph.graphic.RectScuare;

//-----------------------------------------------

public class Zscrollez extends Sprite {

  //

  private var holder       :MovieClip;

  private var clip         :MovieClip;

  private var clipMask     :RectScuare;

  private var dragger      :RectScuare;

  private var slider       :RectScuare;

  private var bGround      :RectScuare;

  private var bgAlpha      :Number;

  private var bgColor      :uint;

  private var hg           :uint;

  private var scrolled     :uint;

  private var friction     :uint;

  private var currentY     :int;

  private var draggerHg    :uint;

  private var draggerColor :uint;

  private var sliderColor  :uint;

  private var fade         :Tween;

  private var fadeAmount   :Number;

  private var wheel        :Boolean;

  //------------------------------------------------------------------------

  public function Zscrollez(_clip:MovieClip, _hg:uint, _friction:uint = 5, _wheel:Boolean = false):void {

   //

   clip       = _clip;

   hg         = _hg;

   friction   = _friction;

   wheel      = _wheel;

   //

   if (clip.height > hg) {

    trace(hg);

    //

    createHolder();

    createMask();

    createSrollBar();

    addListeners();

   }

  }

  //---------------------------------------------------------------------------

  public function set scrollWheel(b:Boolean):void {

   //

   wheel = b;

   addListeners();

  }

  //

  public function set handCursor(h:Boolean):void {

   //

   dragger.buttonMode = h;

  }

  //---------------------------------------------------------------------------

  public function scrollBarProperties(_draggerHg:uint, _draggerC:uint, _sliderC:uint):void {

   //

   draggerHg    = _draggerHg;

   draggerColor = _draggerC;

   sliderColor  = _sliderC;

   //

   createSrollBar(draggerHg, draggerColor, sliderColor);

   addListeners();

  }

  //---------------------------------------------------------------------------

  public function backGround(_bgColor:uint = 0xFFFFFF, _bgAlpha:Number = 1):void {

   //

   bgColor = _bgColor;

   bgAlpha = _bgAlpha;

   //

   bGround = new RectScuare(clip.width, hg, bgColor);

   bGround.x = bGround.y = 0;

   bGround.alpha = bgAlpha;

   holder.addChild(bGround);

   holder.swapChildren(bGround, clip);

  }

  //---------------------------------------------------------------------------

  private function createHolder():void {

   //

   holder = new MovieClip();

   holder.x = clip.x;

   holder.y = clip.y;

   clip.x = clip.y = 0;

   holder.addChild(clip);

   addChild(holder);

  }

  //---------------------------------------------------------------------------

  private function createMask():void {

   //

   clipMask = new RectScuare(clip.width, hg, 0x000000);

   clip.mask = clipMask;

   holder.addChild(clipMask);

  }

  //---------------------------------------------------------------------------

  private function createSrollBar(dH:uint = 30, dC:uint = 0x000000, sC:uint = 0xCCCCCC):void {

   //

   draggerHg    = dH;

   draggerColor = dC;

   sliderColor  = sC;

   //

   slider = new RectScuare(10, hg, sliderColor);

   dragger = new RectScuare(10, dH, draggerColor);

   slider.x = dragger.x = clip.width + 5;

   holder.addChild(slider);

   holder.addChild(dragger);

  }

  //--------------------------------------------------------------------------

  private function dragOn(e:Event):void {

   //

   dragger.startDrag(false, new Rectangle(dragger.x, 0, 0, slider.height - dragger.height));

   dragOnOutSide();

  }

  private function dragOff(e:Event):void {

   //

   dragger.stage.removeEventListener(MouseEvent.MOUSE_UP, dragOff);

   dragger.stopDrag();

  }

  private function dragOnOutSide():void {

   //

   dragger.stage.addEventListener(MouseEvent.MOUSE_UP, dragOff);

  }

  //---------------------------------------------------------------------------

  private function fadeIn(e:Event):void {

   //

   e.type == "rollOver" ? fadeAmount = 0.5 : fadeAmount = 1;

   fade = new Tween(e.target, "alpha", Strong.easeOut, e.target.alpha, fadeAmount, 0.5, true);

  }

  //---------------------------------------------------------------------------

  private function easeIn(e:Event):void {

   //

   friction > 5 ? friction = 5 : null;

   //

   scrolled = dragger.y / (hg - dragger.height) * 100;

   currentY = -(clip.height - hg) * scrolled / 100;

   clip.y += (currentY - clip.y) / friction;

  }

  //---------------------------------------------------------------------------

  private function aplyScrollWheel(e:MouseEvent):void {

   //

   dragger.y += e.delta * -4;

   //

   if (dragger.y < 0) {

    //

    dragger.y = 0;

   } else if (dragger.y > (slider.height - dragger.height)) {

    //

    dragger.y = slider.height - dragger.height;

   }

  }

  //--------------------------------------------------------------------------

  private function addListeners():void {

   //

   dragger.addEventListener(MouseEvent.ROLL_OVER, fadeIn);

   dragger.addEventListener(MouseEvent.ROLL_OUT, fadeIn);

   dragger.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);

   dragger.addEventListener(MouseEvent.MOUSE_UP, dragOff);

   dragger.addEventListener(Event.ENTER_FRAME, easeIn);

   //

   if (wheel == true) {

    clip.addEventListener(MouseEvent.MOUSE_WHEEL, aplyScrollWheel);

   }

  }

  //-------------------------------------------------------------------------

}// class

}// package

--- In RectScuare.as

package ph.graphic{

//

import flash.display.Sprite;

import flash.display.Graphics;

//

public class RectScuare extends Sprite {

  //

  private var _clip    :Sprite;

  private var _wd      :uint;

  private var _hg      :uint;

  private var _bgColor :uint;

  //

  public function RectScuare(wd:uint, hg:uint, bgColor:uint):void {

   //

   _wd      = wd;

   _hg      = hg;

   _bgColor = bgColor;

   //

   drawRectScuare();

  }

  //

  private function drawRectScuare():void {

   //

   _clip = new Sprite();

   _clip.graphics.beginFill(_bgColor);

   _clip.graphics.drawRect(0, 0, _wd, _hg);

   addChild(_clip);

  }

}

}

And I have change this to

--- Zscrolla.as

package {

//

import flash.display.*;

import flash.events.*;

import flash.geom.Rectangle;

import fl.transitions.Tween;

import fl.transitions.easing.*;

//import ph.graphic.RectScuare;

//-----------------------------------------------

public class Zscrolla  extends Sprite {

  //

  private var holder       :MovieClip;

  private var clip         :MovieClip;

  private var clipMask     :MovieClip;

  private var dragger      :MovieClip;

  private var slider       :MovieClip;

  private var bgAlpha      :Number;

  private var bgColor      :uint;

  private var hg           :uint;

  private var scrolled     :uint;

  private var friction     :uint;

  private var currentY     :int;

  private var draggerHg    :uint;

  private var draggerColor :uint;

  private var sliderColor  :uint;

  private var fade         :Tween;

  private var fadeAmount   :Number;

  private var wheel        :Boolean;

  //------------------------------------------------------------------------

  public function Zscrolla(_clip:MovieClip, _hg:uint, _friction:uint = 5, _wheel:Boolean = false):void {

   //

   clip       = _clip;

   hg         = _hg;

   friction   = _friction;

   wheel      = _wheel;

   //

   if (clip.height > hg) {

    //trace(clip.height);

    //

    createHolder();

    createMask();

    createSrollBar();

    addListeners();

   }

  }

  //---------------------------------------------------------------------------

  public function set scrollWheel(b:Boolean):void {

   //

   wheel = b;

   addListeners();

  }

  //

  public function set handCursor(h:Boolean):void {

   //

   dragger.buttonMode = h;

  }

  //---------------------------------------------------------------------------

  /*public function scrollBarProperties():void {

   //

   draggerHg    = dragger.height;

   //

   createSrollBar(draggerHg);

   addListeners();

   trace(draggerHg);

  }*/

  //---------------------------------------------------------------------------

  private function createHolder():void {

   //

   holder = new MovieClip();

   holder.x = clip.x;

   holder.y = clip.y;

   clip.x = clip.y = 0;

   holder.addChild(clip);

   addChild(holder);

  }

  //---------------------------------------------------------------------------

  private function createMask():void {

   //

   clipMask = new mmask();

   clip.mask = clipMask;

   holder.addChild(clipMask);

  }

  //---------------------------------------------------------------------------

  public function createSrollBar():void {

   //

   //

   slider = new trackk();

   dragger = new sliderr();

   slider.x = 900;

   dragger.x = 877;

   holder.addChild(slider);

   holder.addChild(dragger);

  }

  //--------------------------------------------------------------------------

  private function dragOn(e:Event):void {

   //

   dragger.startDrag(false, new Rectangle(dragger.x, 0, 0, slider.height - dragger.height));

   trace(slider.height);

   dragOnOutSide();

  }

  private function dragOff(e:Event):void {

   //

   dragger.stage.removeEventListener(MouseEvent.MOUSE_UP, dragOff);

   dragger.stopDrag();

  }

  private function dragOnOutSide():void {

   //

   dragger.stage.addEventListener(MouseEvent.MOUSE_UP, dragOff);

  }

  //---------------------------------------------------------------------------

  /*private function fadeIn(e:Event):void {

   //

   e.type == "rollOver" ? fadeAmount = 0.5 : fadeAmount = 1;

   fade = new Tween(e.target, "alpha", Strong.easeOut, e.target.alpha, fadeAmount, 0.5, true);

  }*/

  //---------------------------------------------------------------------------

  private function easeIn(e:Event):void {

   //

   friction > 5 ? friction = 5 : null;

   //

   scrolled = dragger.y / (hg - dragger.height) * 100;

   currentY = -(clip.height - hg) * scrolled / 100;

   clip.y += (currentY - clip.y) / friction;

  }

  //---------------------------------------------------------------------------

  private function aplyScrollWheel(e:MouseEvent):void {

   //

   dragger.y += e.delta * -4;

   //

   if (dragger.y < 0) {

    //

    dragger.y = 0;

   } else if (dragger.y > (slider.height - dragger.height)) {

    //

    dragger.y = slider.height - dragger.height;

   }

  }

  //--------------------------------------------------------------------------

  private function addListeners():void {

   //

   //dragger.addEventListener(MouseEvent.ROLL_OVER, fadeIn);

   //dragger.addEventListener(MouseEvent.ROLL_OUT, fadeIn);

   dragger.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);

   dragger.addEventListener(MouseEvent.MOUSE_UP, dragOff);

   dragger.addEventListener(Event.ENTER_FRAME, easeIn);

   //

   if (wheel == true) {

    clip.addEventListener(MouseEvent.MOUSE_WHEEL, aplyScrollWheel);

   }

  }

  //-------------------------------------------------------------------------

}// class

}// package

I have remove RectScuare.as in Zscrolla.as

TOPICS
ActionScript
1.4K
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

correct answers 1 Correct answer

LEGEND , May 15, 2018 May 15, 2018

Per the code you show, they are assigning the event listener to an object named dragger that they create dynamically.  What you need to do is eliminate that object and use your movieclip instead, again, assigning it an instance name of "dragger"

Translate
LEGEND ,
May 15, 2018 May 15, 2018

Your question is not clear to me.  For the line of code you cite...

       new Rectangle(dragger.x, 0, 0, slider.height - dragger.height)

that portion of it is defining the boundaries for dragging the scroller (dragger) handle.  Ideally, one of those sets of points that define the Rectangle should reflect a zero allowance for a change in position.  The other set should define the minimum and maximum.  Based on what you show, the horizontal motion is set to zero, and the vertical motion is limited primaerily by the height of the slider (less the dragger height).

The only thing I can see that might be causing you a problem is if you have not instance named your button as "dragger"... you likely want it to replace....  dragger = new RectScuare(10, dH, draggerColor);

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
Participant ,
May 15, 2018 May 15, 2018

Thanks for you answered.

That might be an unclear explanation that I wrote.

I took this scroller from a Spanish website.

http://www.cristalab.com/tutoriales/crear-scrollbar-con-easing-en-actionscript-3-c64444l/

They use a graphics instead of movie clips.

I only use movieclip and I have modify at the original but it does not work, drag because I can not drag (dragger) it down or up. Nothing happens. Do you know how to do it to work with movieclip items in the library.

I also want to fade in and fade out the drag (dragger) movieclip object while using the mouse.

I hope you understand me.

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
LEGEND ,
May 15, 2018 May 15, 2018

Per the code you show, they are assigning the event listener to an object named dragger that they create dynamically.  What you need to do is eliminate that object and use your movieclip instead, again, assigning it an instance name of "dragger"

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
Participant ,
May 17, 2018 May 17, 2018

Can you show me how I do that with code. I'm not an expert in programming yet. You are really kind if you can help me with that.

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 ,
May 23, 2018 May 23, 2018

do you have an object on stage with instance name dragger?

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
Participant ,
May 23, 2018 May 23, 2018

No, I don't have to dragger this dragger = new sliderr ()

and sliderr are in the library library instance as Movieclip

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 ,
May 23, 2018 May 23, 2018

what's the problem?

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
Participant ,
May 24, 2018 May 24, 2018

I can't grab my scroller and nothing happens.

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 ,
May 24, 2018 May 24, 2018

if you're not seeing any error messages, use the trace function to debug.

start by making sure the scroller listeners are added.

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
Participant ,
May 25, 2018 May 25, 2018

I'm not seeing any error message.

I have use trace() many times in Zscrolla.as file

but I don't see the problem.

What do you mean by this "start by making sure the scroller listeners are added"?

How do I do that?

Do you mean this?

as I have change it public function addListeners():void but in original is it private function addListeners():void

I have changed from private two public in .as file and does it matter or have I wrong.

What does this have for function extends Sprite.

Look through what I've done below

The scroller from original

easingScroll.fla

contains two layers:

as: there is actionscript

textoClip: here background image

import ph.Zscrollez;

//-----------------------------------------------

var textoClip:Clip = new Clip();

var eScroll:Zscrollez = new Zscrollez(textoClip, 300);

eScroll.scrollBarProperties(60, 0xFB761E, 0x666666);

eScroll.backGround(0xFFFFFF, 0.5);

eScroll.scrollWheel = true;

eScroll.handCursor = true;

eScroll.x = eScroll.y = 15;

addChild(eScroll);

in Zscrollez.as

package ph{

//

import flash.display.*;

import flash.events.*;

import flash.geom.Rectangle;

import fl.transitions.Tween;

import fl.transitions.easing.*;

import ph.graphic.RectScuare;

//-----------------------------------------------

public class Zscrollez extends Sprite {

//

private var holder       :MovieClip;

private var clip         :MovieClip;

private var clipMask     :RectScuare;

private var dragger      :RectScuare;

private var slider       :RectScuare;

private var bGround      :RectScuare;

private var bgAlpha      :Number;

private var bgColor      :uint;

private var hg           :uint;

private var scrolled     :uint;

private var friction     :uint;

private var currentY     :int;

private var draggerHg    :uint;

private var draggerColor :uint;

private var sliderColor  :uint;

private var fade         :Tween;

private var fadeAmount   :Number;

private var wheel        :Boolean;

//------------------------------------------------------------------------

public function Zscrollez(_clip:MovieClip, _hg:uint, _friction:uint = 5, _wheel:Boolean = false):void {

//

clip       = _clip;

hg         = _hg;

friction   = _friction;

wheel      = _wheel;

//

if (clip.height > hg) {

trace(hg);

//

createHolder();

createMask();

createSrollBar();

addListeners();

}

}

//---------------------------------------------------------------------------

public function set scrollWheel(b:Boolean):void {

//

wheel = b;

addListeners();

}

//

public function set handCursor(h:Boolean):void {

//

dragger.buttonMode = h;

}

//---------------------------------------------------------------------------

public function scrollBarProperties(_draggerHg:uint, _draggerC:uint, _sliderC:uint):void {

//

draggerHg    = _draggerHg;

draggerColor = _draggerC;

sliderColor  = _sliderC;

//

createSrollBar(draggerHg, draggerColor, sliderColor);

addListeners();

}

//---------------------------------------------------------------------------

public function backGround(_bgColor:uint = 0xFFFFFF, _bgAlpha:Number = 1):void {

//

bgColor = _bgColor;

bgAlpha = _bgAlpha;

//

bGround = new RectScuare(clip.width, hg, bgColor);

bGround.x = bGround.y = 0;

bGround.alpha = bgAlpha;

holder.addChild(bGround);

holder.swapChildren(bGround, clip);

}

//---------------------------------------------------------------------------

private function createHolder():void {

//

holder = new MovieClip();

holder.x = clip.x;

holder.y = clip.y;

clip.x = clip.y = 0;

holder.addChild(clip);

addChild(holder);

}

//---------------------------------------------------------------------------

private function createMask():void {

//

clipMask = new RectScuare(clip.width, hg, 0x000000);

clip.mask = clipMask;

holder.addChild(clipMask);

}

//---------------------------------------------------------------------------

private function createSrollBar(dH:uint = 30, dC:uint = 0x000000, sC:uint = 0xCCCCCC):void {

//

draggerHg    = dH;

draggerColor = dC;

sliderColor  = sC;

//

slider = new RectScuare(10, hg, sliderColor);

dragger = new RectScuare(10, dH, draggerColor);

slider.x = dragger.x = clip.width + 5;

holder.addChild(slider);

holder.addChild(dragger);

}

//--------------------------------------------------------------------------

private function dragOn(e:Event):void {

//

dragger.startDrag(false, new Rectangle(dragger.x, 0, 0, slider.height - dragger.height));

dragOnOutSide();

}

private function dragOff(e:Event):void {

//

dragger.stage.removeEventListener(MouseEvent.MOUSE_UP, dragOff);

dragger.stopDrag();

}

private function dragOnOutSide():void {

//

dragger.stage.addEventListener(MouseEvent.MOUSE_UP, dragOff);

}

//---------------------------------------------------------------------------

private function fadeIn(e:Event):void {

//

e.type == "rollOver" ? fadeAmount = 0.5 : fadeAmount = 1;

fade = new Tween(e.target, "alpha", Strong.easeOut, e.target.alpha, fadeAmount, 0.5, true);

}

//---------------------------------------------------------------------------

private function easeIn(e:Event):void {

//

friction > 5 ? friction = 5 : null;

//

scrolled = dragger.y / (hg - dragger.height) * 100;

currentY = -(clip.height - hg) * scrolled / 100;

clip.y += (currentY - clip.y) / friction;

}

//---------------------------------------------------------------------------

private function aplyScrollWheel(e:MouseEvent):void {

//

dragger.y += e.delta * -4;

//

if (dragger.y < 0) {

//

dragger.y = 0;

} else if (dragger.y > (slider.height - dragger.height)) {

//

dragger.y = slider.height - dragger.height;

}

}

//--------------------------------------------------------------------------

private function addListeners():void {

//

dragger.addEventListener(MouseEvent.ROLL_OVER, fadeIn);

dragger.addEventListener(MouseEvent.ROLL_OUT, fadeIn);

dragger.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);

dragger.addEventListener(MouseEvent.MOUSE_UP, dragOff);

dragger.addEventListener(Event.ENTER_FRAME, easeIn);

//

if (wheel == true) {

clip.addEventListener(MouseEvent.MOUSE_WHEEL, aplyScrollWheel);

}

}

//-------------------------------------------------------------------------

}// class

}// package

and in RectScuare.as

package ph.graphic{

//

import flash.display.Sprite;

import flash.display.Graphics;

//

public class RectScuare extends Sprite {

//

private var _clip    :Sprite;

private var _wd      :uint;

private var _hg      :uint;

private var _bgColor :uint;

//

public function RectScuare(wd:uint, hg:uint, bgColor:uint):void {

//

_wd      = wd;

_hg      = hg;

_bgColor = bgColor;

//

drawRectScuare();

}

//

private function drawRectScuare():void {

//

_clip = new Sprite();

_clip.graphics.beginFill(_bgColor);

_clip.graphics.drawRect(0, 0, _wd, _hg);

addChild(_clip);

}

}

}

I have modify the code in this foto111edit.fla

I have several MovieClip object in foto111edit

But there I have actionscript in MovieClip album1

import Zscrolla;

//-----------------------------------------------

var textoClip:album1_mc = new album1_mc;

var eScroll:Zscrolla = new Zscrolla(textoClip, 300);

//eScroll.scrollBarProperties();

//eScroll.backGround(0xFFFFFF, 0.5);

eScroll.scrollWheel = true;

eScroll.handCursor = true;

eScroll.x = eScroll.y = 0;

addChild(eScroll);

I have remove RectScuare.as and I don't need it because I'm using MovieClip objects

here is Zscrolla.as

package {

//

import flash.display.*;

import flash.events.*;

import flash.geom.Rectangle;

import fl.transitions.Tween;

import fl.transitions.easing.*;

//import ph.graphic.RectScuare;

//-----------------------------------------------

public class Zscrolla extends Sprite {

//

var holder       :MovieClip;

var clip         :MovieClip;

var clipMask     :MovieClip;

var dragger      :MovieClip;

var slider       :MovieClip;

private var bgAlpha      :Number;

private var bgColor      :uint;

var hg           :uint;

var scrolled     :uint;

var friction     :uint;

private var currentY     :int;

private var draggerHg    :uint;

private var draggerColor :uint;

private var sliderColor  :uint;

private var fade         :Tween;

private var fadeAmount   :Number;

private var wheel        :Boolean;

//------------------------------------------------------------------------

public function Zscrolla(_clip:MovieClip, _hg:uint, _friction:uint = 5, _wheel:Boolean = false):void {

//

clip       = _clip;

hg         = _hg;

friction   = _friction;

wheel      = _wheel;

//

if (clip.height > hg) {

trace(clip.height);

//

createHolder();

createMask();

createSrollBar();

addListeners();

}

}

//---------------------------------------------------------------------------

public function set scrollWheel(b:Boolean):void {

//

wheel = b;

addListeners();

}

//

public function set handCursor(h:Boolean):void {

//

dragger.buttonMode = h;

}

//---------------------------------------------------------------------------

public function scrollBarProperties():void {

//

//draggerHg    = dragger.height;

//

createSrollBar();

addListeners();

trace(draggerHg);

}

//---------------------------------------------------------------------------

public function createHolder():void {

//

holder = new MovieClip();

holder.x = clip.x;

holder.y = clip.y;

clip.x = clip.y = 0;

holder.addChild(clip);

addChild(holder);

}

//---------------------------------------------------------------------------

public function createMask():void {

//

clipMask = new mmask();

clip.mask = clipMask;

holder.addChild(clipMask);

}

//---------------------------------------------------------------------------

function createSrollBar():void {

//

//

slider = new trackk();

dragger = new sliderr();

slider.x = 900;

dragger.x = 877;

trace(dragger.height);

addChild(slider);

addChild(dragger);

}

//--------------------------------------------------------------------------

public function dragOn(e:Event):void {

//

dragger.startDrag();

trace(slider.height);

dragOnOutSide();

}

public function dragOff(e:Event):void {

//

dragger.stage.removeEventListener(MouseEvent.MOUSE_UP, dragOff);

dragger.stopDrag();

}

public function dragOnOutSide():void {

//

dragger.stage.addEventListener(MouseEvent.MOUSE_UP, dragOff);

}

//---------------------------------------------------------------------------

/*private function fadeIn(e:Event):void {

//

e.type == "rollOver" ? fadeAmount = 0.5 : fadeAmount = 1;

fade = new Tween(e.target, "alpha", Strong.easeOut, e.target.alpha, fadeAmount, 0.5, true);

}*/

//---------------------------------------------------------------------------

public function easeIn(e:Event):void {

//

friction > 5 ? friction = 5 : null;

//

scrolled = dragger.y / (hg - dragger.height) * 10;

currentY = -(clip.height - hg) * scrolled / 10;

clip.y += (currentY - clip.y) / friction;

}

//---------------------------------------------------------------------------

private function aplyScrollWheel(e:MouseEvent):void {

//

dragger.y += e.delta * -4;

//

if (dragger.y < 0) {

//

dragger.y = 0;

} else if (dragger.y > (slider.height - dragger.height)) {

//

dragger.y = slider.height - dragger.height;

}

}

//--------------------------------------------------------------------------

public function addListeners():void {

//

//dragger.addEventListener(MouseEvent.ROLL_OVER, fadeIn);

//dragger.addEventListener(MouseEvent.ROLL_OUT, fadeIn);

dragger.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);

dragger.addEventListener(MouseEvent.MOUSE_UP, dragOff);

dragger.addEventListener(Event.ENTER_FRAME, easeIn);

//

if (wheel == true) {

clip.addEventListener(MouseEvent.MOUSE_WHEEL, aplyScrollWheel);

}

}

//-------------------------------------------------------------------------

}// class

}// package

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 ,
May 25, 2018 May 25, 2018

insert a trace in addListeners()

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
Participant ,
May 25, 2018 May 25, 2018

I have made trace(addListeners()) but in outdata or message then it says.

Error: Error #1023: Stack overflow occurred.

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

What is the problem then? Would you like to help me solve it?

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 ,
May 25, 2018 May 25, 2018

you should use something like:

public function addListeners():void {

//

trace('listeners added',dragger)

//dragger.addEventListener(MouseEvent.ROLL_OVER, fadeIn);

//dragger.addEventListener(MouseEvent.ROLL_OUT, fadeIn);

dragger.addEventListener(MouseEvent.MOUSE_DOWN, dragOn);

dragger.addEventListener(MouseEvent.MOUSE_UP, dragOff);

dragger.addEventListener(Event.ENTER_FRAME, easeIn);

//

if (wheel == true) {

clip.addEventListener(MouseEvent.MOUSE_WHEEL, aplyScrollWheel);

}

which will clearly work.

then add a trace to dragOn() (but not something will trigger a stack overflow like trace(dragOn()) )

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
Participant ,
May 26, 2018 May 26, 2018

I don't understand what you mean this add a trace to dragOn() would you like to make an explanation for me.

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
Participant ,
May 26, 2018 May 26, 2018

I get the same message as before with trace('listeners added',dragger) as trace(addListeners())

Error: Error #1023: Stack overflow occurred.

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

at Zscrolla/addListeners()

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 ,
May 27, 2018 May 27, 2018

wherever your put function calls (eg, addListeners() ), even in trace functions, that (eg, addListeners ) function will be called.

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
Participant ,
May 27, 2018 May 27, 2018

I modified in this scrollbar from this page Crear ScrollBar con Easing en Actionscript 3

They use graphical form while I use MovieClip in the library. But I can't pull my drag on the slider. Nothing happens but in the original I can scroll down. Do you know which wrong may that be due to or is it impossible.

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 ,
May 28, 2018 May 28, 2018

it's not impossible.

but it is proving difficult to help you via a forum because you're lacking basic coding knowledge.  you either need to be persistent and learn more coding or hire someone to do this for you.

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
Participant ,
May 28, 2018 May 28, 2018

Okay, thank you so much for your help. Then I get learn programming on my own and solve it myself. I'll finish here now with you.

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 ,
May 28, 2018 May 28, 2018
LATEST

you can get more help here but you have to do your part and pinpoint the problems you encounter and then try to learn so you don't keep repeating the same error.

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