| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Neuer User Registriert seit: Nov 2003 Ort: Köln, Freiburg
Beiträge: 22
|
hallo zusammen, ich habe eine textbox, die den text extern einläd. da der text austauschabr ist, wird auch die textbox je nach inhalt unterschiedlich groß. nun soll sich der balken natürlich der box anpassen. ich habe bereits einen, der nur dies allerdings nicht tut. wenn das hilft, poste ich hier mal das as rein, was dahinter liegt. es dankt nochmal: candida ![]() onClipEvent (load) { // --------------------------------------------------------------------------------------- // --initialze variables numLines = 20; // guesstimate of number of visible lines in text area tolerance = 1; // controls how close the scroll bar can get before snapping to target speed = 5; // controls re-size and re-position animation speed origHeight = scrollbar._height; origX = (scrollbar._x+1); text = ""; // --------------------------------------------------------------------------------------- // --resizes scrollbar according to content length function scrollResize() { lastHeight = scrollbar._yscale; totalLines = (text.maxscroll-1)+numLines; newHeight = 100*(numLines)/totalLines; scaleDiff = Math.abs(newHeight-lastHeight); currentPosition = scrollbar._y; pixelDiff = currentPosition-(arrowUp._height-1); } // --------------------------------------------------------------------------------------- // --positions scrollbar when text is scrolled function scrollPosition() { scrollbar._y = (lineHeight*(text.scroll-1))+(arrowUp._height-1); } } // ------------------------------------------------------------------------------------------- onClipEvent (enterFrame) { scrollResize(); // --------------------------------------------------------------------------------------- // --animate the scale and position of scrollbar if resize is required if (lastHeight<>newHeight) { if (scaleDiff<tolerance && scaleDiff>(0-tolerance)) { scrollbar._yscale = newHeight; heightDiff = origHeight-scrollbar._height; lineHeight = HeightDiff/(text.maxscroll-1); rePosition = false; text.scroll = 1; scrollPosition(); } else { if (newHeight<lastHeight) { scrollbar._yscale = scrollbar._yscale-(scaleDiff/speed); } else if (newHeight>lastHeight) { scrollbar._yscale = scrollbar._yscale+(scaleDiff/speed); } } } if (rePosition == true) { currentPosition = currentPosition-(pixelDiff/speed); scrollbar._y = currentPosition; pixelDiff = pixelDiff-(pixelDiff/speed); if (currentPosition == (arrowUp._height-1)) { rePosition = false; } } // --------------------------------------------------------------------------------------- // --scrolling when arrows are pressed if (startScroll == true) { if (scroll == "up" && text.scroll>1) { text.scroll--; scrollPosition(); } if (scroll == "down" && text.scroll<text.maxscroll) { text.scroll++; scrollPosition(); } } // --------------------------------------------------------------------------------------- // --page text if mouse is clicked within the scrollarea if (paging == true) { if (hitLocation<scrollbar._y) { text.scroll -= numLines; scrollPosition(); if (hitLocation>=scrollbar._y && hitLocation<=(scrollbar._y+scrollbar._height)) { paging = false; } } else { text.scroll += numLines; scrollPosition(); if (hitLocation>=scrollbar._y && hitLocation<=(scrollbar._y+scrollbar._height)) { paging = false; } } } // test = (arrowDown._y - arrownDown._height) - scrollbar._height; } // -------------------------------------------------------------------------------------------- onClipEvent (mouseDown) { // --detect if mouse click is in scrollarea but not on scrollbar if (scrollArea.hitTest(_root._xmouse, _root._ymouse) and not scrollbar.hitTest(_root._xmouse, _root._ymouse)) { hitLocation = this._ymouse; paging = true; resize = false; } // --detect if mouse click is on up arrow button if (arrowUp.hitTest(_root._xmouse, _root._ymouse)) { scroll = "up"; startScroll = true; arrowUp.gotoAndPlay(2); resize = false; } // --detect if mouse click is on down arrow button if (arrowDown.hitTest(_root._xmouse, _root._ymouse)) { scroll = "down"; startScroll = true; arrowDown.gotoAndPlay(2); resize = false; } // --detect if mouse click is on scrollbar if (scrollbar.hitTest(_root._xmouse, _root._ymouse)) { startDrag(scrollbar, false, origX, arrowUp._height-1, origX, heightDiff+(arrowUp._height-1)); scroll = "scrollbar"; scrollbar.gotoAndPlay(2); resize = false; } } // -------------------------------------------------------------------------------------------- // --reset scroll properties when mouse button is released onClipEvent (mouseUp) { scroll = ""; startScroll = false; paging = false; stopDrag(); resize = true; scrollbar.gotoAndStop(1); arrowUp.gotoAndStop(1); arrowDown.gotoAndStop(1); } // -------------------------------------------------------------------------------------------- // -adjust text when scroll bar is dragged onClipEvent (mouseMove) { if (scroll == "scrollbar") { text.scroll = Math.round((scrollbar._y-arrowUp._height)/lineHeight+1); // --test for scrollbar position to correct errors created by numLines guesstimate if (scrollbar._y == Math.ceil(arrowDown._y-(arrowDown._height-1)-scrollbar._height)) { text.scroll = text.maxscroll; } } updateAfterEvent(); } // -------------------------------------------------------------------------------------------- // --detects when content is text box is changed...reset scroll property and resize scroll bar onClipEvent (data) { rePosition = true; scrollResize(); text.scroll = 1; } |
| | |
| | #2 (permalink) |
| 42! Registriert seit: Nov 2003
Beiträge: 538
|
hey wenn du lust hast kannst du mir mal die fla datei schicken...ich versuch so etwas auch gerade und schaff es einfach nicht...bin nichmtla so weit gekommen wie du...wäre suppa wenn du mir die fla datei mal zuschicken könntest info@johz-design.de |
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |