ActionScript 3.0 :: Reset UIScrollBar Using VerticalScrollPosition?
Sep 15, 2009
I have a website with a dynamic text box on the stage. The three nav buttons each load in a .TXT file to the text box on mouse click. I am using the UIScrollBar component for scrolling the text that is dynamically loaded.
My problem is, when I scroll down in the text box, then click one of the nav buttons, the scroll bar doesn't reset to the top when the new text loads. I've done some research and it seems like I need to reset the verticalScrollPosition property to zero, but I can't figure out how to implement this. Flash states that it is an undefined property when I've put this line of code in to my script: myScrollBar.verticalScrollPosition = 0; I've also tried this, with no apparent effect: event.target.verticalScrollPosition = 0;
View 1 Replies
Similar Posts:
Jan 7, 2010
I have a VBox that I am populating programatically, After a particular event (dragDrop) I do some calculations, reorder some variables, then re-build the VBox. This all works great, but I want the VBox to scroll back to the correct verticalScrollPosition. I tried even the simplest thing: myVBox.verticalScrollPosition = 200But I just can't get it to set the scroll position after it's rebuilt.
Edit: per Franky's response I realized that my dragDrop function was calling the rebuilder function then the position setter function back to back, which means it wasn't done being built when it was trying to set. Now I'm passing the position I want the box set to to the rebuilder function which sets the scroll position at the end of building the VBox and everything works out great.
View 1 Replies
Mar 17, 2011
I have a weird problem with verticalScrollPosition in Flex.I have a content Canvas and a wrapper Canvas. The content is large (5000px X 5000px), the wrapper is 800px X 800px.
public var wrapper:Canvas = new Canvas();
public var content:Canvas = new Canvas();
wrapper.addChild(content);
application.addChild(wrapper);
I would like to set the wrapper's scrollbar position dynamically anytime. I can do it by calling its properties:
wrapper.verticalScrollPosition = A;
wrapper.horizontalScrollPosition = B;
This is working fine. But! If I set a default scrollbar position when the Canvas is complete:
wrapper.addEventListener(FlexEvent.CREATION_COMPLETE, function(e:FlexEvent):void{
wrapper.verticalScrollPosition = DEFAULT_A;
wrapper.horizontalScrollPosition = DEFAULT_B;
});
I can't set the verticalScrollPosition anymore:
wrapper.verticalScrollPosition = C;
trace(wrapper.verticalScrollPosition); // Outputs: DEFAULT_A
So the problem only exist if I set a default position using 'FlexEvent.CREATION_COMPLETE'.
View 2 Replies
Jul 13, 2010
Just new in forum and just new in as3 programming. All i want to do is to make some physics simulations (i'm physics teacher...). So i made my first sim with the following code, just to simulate a simple motion with constant velocity. It works ok, except the part i need to reset the display by the means to start the motion all over again (reset button). Then the motion starts but the traces of the previous motion remains on stage. I tried the null command (sp=null) but the sim could not start again because the sp nedded to be non-null...
[CODE]...
View 2 Replies
Apr 13, 2011
I have an issue with adding a reset button to my drag and drop movie clips.The problem is, if a student drags a movie clip to a wrong location on the SWF file I want them to be able to hit a reset button that would take them the same SWF that they opened and what would showup would a clear page for them to restart their drag and drop exercise.I know how to make the button for this just want the proper action script to be able for user to start over with no movie clip symbols on the page.
View 3 Replies
Dec 28, 2010
reset in google yields only its use for timers.However I have code bg.reset() which I suppose puts the background back to the beginning of its timeline.
View 3 Replies
Nov 25, 2009
With out getting into a ton of background I am wondering if there is a command that will reset all the variables in a swf at once with out having to do them individually?
I've googled and searched my books and can't find anything. Another option I could see is having the current flash reload, that would set everything back to the start but I couldn't find how to do that either.
Anyone know?
View 2 Replies
Jun 3, 2009
I have a dynamic text field that I create and populate with code, and a UIScrollBar that goes along with it.works correctly, the scroll-bar appears no problem.The issue comes in when I load the SWF into another project.I have a SWF interface that loads other pages (SWF, FLV, etc) When the SWF with the scrollbar is loaded into the interface, the scrollbar does not display at all.Here is the code for the scrollbar SWF, if:
import fl.controls.UIScrollBar;
var myTxt:TextField = new TextField();
myTxt.border = false;
[code].....
View 4 Replies
Mar 11, 2010
Is it possible to change the look on the UIScrollBar in flash cs4 using AS2 ?? ive tried almost everything now without success,.
View 1 Replies
Dec 10, 2009
I have a TextArea for a Chat. When I write a lot, the UIScrollBar remains on the top of my TextArea.I'd like my UIScrollBar is located at the bottom of TextArea..
View 7 Replies
Mar 12, 2010
It seems the simplest way is to use the UIScrollBar, but it will not work in my Flash file.I create the dynamic text box and drop the UIScrollBar on it from the components panel, the scroll bar attaches but only shows up as a white rectangle with no arrows. When I test it it stays the same. I don't think it's just the color because when I hover over or click where arrows should be nothing happens, the text will not scroll. I can click and highlight the text to make it scroll, so I know the additional text that isn't showing up is there, I just can't scroll down to see it.The weird thing is in another flash website I have the UIScrollBar does work. I can drag the problem one from the first file into the second and suddenly the arrows appear. I even tried creating a new text box with the UIScrollBar in the working file then dragging it over to the problem one, but the arrows disappear and the bar turns into a white rectangle again.
View 4 Replies
Mar 1, 2010
i added this code (from another post on this forum) to a project i'm working on but can't seem to make it work. i am using a normal textarea, with the uiscrollbar. the text load from an XML file, all working fine. i'm trying to hide the UIscrollbar when it is not required, where textA is the instance name of my textarea.
[Code]...
View 1 Replies
Mar 27, 2009
make a text scrollbar NOT using the UIScrollbar! I have been trying to figure this out for a while.very tutorial I have used has had something wrong in the directions or something I am not looking to do. Just let me know which ActionScript to use 2 or 3.
View 2 Replies
Oct 15, 2007
I created a UIScrollBar and linked it to a dynamic textfield. It works OK, but if I publish it and view it in the generated HTML file
(with flash player 9) it is not visible. If I view it in the standalone flash player it is fine.
View 7 Replies
Jun 7, 2009
The component itself works perfectly. I can create a scrollbox and the scrollbar and everything works perfectly..except that it somehow partially disables my other codes. I'm trying to create a small database in flash where I can store stuff and to quickly find what I'm looking for I made a Input Text field and added a code so that you could search for a keyframe label and then it would jump to that keyframe.The scrollbox disables the search function, although only partially! The button with the search code looks like this:[code]which means the scrollbar component somehow disables the Enter button! Weird. I know I should be content with at least the clicking working, but I'd really love to have a search where you can just simply press Enter for it to go to that keyframe.
Well, the problem didn't end there.When I try to delete the scrollbar and everything that made the search stop working, the enter button still won't work, even when I deleted all the faulty keyframes where I added the scrollbars! So I have to begin again from scratch to make it work.A scrollbox would really help me get more text into a keyframe, so I'd love to have it there. If someone can help me get this work, I'd be happy.I tried creating my own scrollbar. It works great, too, and it doesn't disable the search code. The problem is, that I made the scrollbox into a movie clip, and I need many scrollboxes with different texts, and I'd really hate to create a new scrollbox from scratch each time I need one with different text. Plus, I'll probably need 100+ scrollboxes so it'd take a while to make that many.Anyone know how you can duplicate a movie clip and then edit the duplicate without the original being edited? That annoys the hell out of me and I'd really love to be able to just duplicate my self-made scrollbox and edit the text on each one, because right now when I edit the text on the duplicate box it also edits it on the original one :/
View 1 Replies
Jul 12, 2010
I want to control 2 Dynamic Text boxes with the same scroll bar component? I want them to scroll simultaneously with the user only needing to use the one component.
View 2 Replies
Apr 3, 2011
I need to add a scroll bar to a textFlow and I was wondering if it's possible to use the UIscrollbar component to do this.Here is my code:
Code:
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
[code].....
View 1 Replies
May 23, 2009
I have a website I created in Flash (CS4 AS2), and on one page, I have a UIScrollBar component. It is linked to a text box, which loads text from an external .txt file. The page has a short pre-loader that plays while the page is loading; the page is not supposed to be shown until it's 100% loaded.
My problem is that when the page loads, the text is there, and there is a box where the scroll bar should go, but no scroll bar. The mouse wheel makes the page scroll as it should, but the bar itself is not visible or functional. If I navagate away and then return to the page, or reload the page, the bar displays as it should.
View 4 Replies
Mar 2, 2010
I want to add a horizontal scrollbar to a textfield that shows the text in HTML format.When I try that in other documents without scrollbar I get it to work.In the code bellow, which I mainly took from the Actionscript Reference, the code works when I use text (like in the Actionscript Reference).But when I change it to htmlText to get it HTML formatted (and get rid of the HTML codes) the textField doen't show anything.
The code:
import fl.controls.ScrollBarDirection;
import fl.controls.UIScrollBar;
[code]......
View 2 Replies
Oct 5, 2010
The UIScrollBar in the code below doesn't appear and i don'tknow why
[Code]...
View 3 Replies
Dec 14, 2010
i have done a project and i found out that i could'nt see the top part of my project as it is too long. So i was thinking of using UIScrollBar to enable me to scroll to the top. But the problem is how do i use UIScrollBar?
View 4 Replies
Feb 18, 2010
Are you able to customize the UIScrollbar component in Flash CS4?
View 2 Replies
May 1, 2009
I am attempting to use the mouse wheel with the UIScrollBar as3 component. I know the MOUSE_WHEEL event does not work on a MAC, only PC. I would like the user to be able to scroll using the mousewheel and the content as well as the Scrollbar updates (on a PC). The main issue that I can't figure out is how to update the scrollbar.
Code:
Select all//mcBorder is the visible content area
//mcContainer is the content that should scroll
var sb:ScrollBar = new ScrollBar();
addChild(sb);
setScrollBar();
addEventListener(MouseEvent.MOUSE_WHEEL, wheel_event);
[Code] .....
View 4 Replies
Aug 14, 2007
I'm attempting to get my UIscrollBar to reposition the scroller to the top every time there's new text loaded into the textfield. I have tried scroll and scrollPostion=0 and every other keyword in the livedocs. I have even tried creating at runtime and thought that it being remade every time would reposition it but apparently not
Code:
destroyObject("mcArticle.uiscroll");
mcArticle.createClassObject(mx.controls.UIScrollBar, "uiscroll", mcArticle.getNextHighestDepth());
mcArticle.uiscroll.setScrollTarget(mcArticle.stupidBox);
mcArticle.uiscroll.setSize(16,mcArticle.stupidBox._height);
mcArticle.uiscroll.move(mcArticle.stupidBox._x+mcArticle.stupidBox._width,mcArticle.stupidBox._y);
When I do it that way, it also creates a white rectangle on stage.
View 1 Replies
May 2, 2008
In as2 we had :
scrollbar._visible = (textfield.maxscroll > 1);
textfield.onChanged = function() {
scrollbar._visible = (this.maxscroll > 1);
};
know of a similar way to do this in as 3?
View 3 Replies
May 13, 2008
I'm controlling a video with FLV playback custom UI components (example of what I mean can be found here - [URL]
I'm using a play button, pause button, and a seek bar. All works fine and dandy until I add a UIScrollBar to a text field that's also on screen.... for some reason this really messes with the seekbar; if you start playing the video and drag the seek bar handle all the way back to the start of the video it doesn't start playing again, and if you then move the seekbar forward a bit the video starts but skips all over the place! It's really weird and the problem completely disappears as soon as i remove the UIScrollBar component from the library.
View 1 Replies
Jun 30, 2008
Does anyone know if you can customise the colors of the UIScrollbar in Flash 8?
View 12 Replies
Apr 2, 2011
I need to add a scroll bar to a textFlow and I was wondering if it's possible to use the UIscrollbar component to do this.
Here is my code:
Code:
import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.SpanElement;
import flashx.textLayout.elements.LinkElement;
[Code].....
View 1 Replies
Aug 17, 2010
I am using Flash CS3 and Action Script 2.0 I have created a test file. See Attached
I am looking for AS to control a scrollbar with a button. Jump to headline location.
First, I have 3 buttons. Red, Blue and Yellow. Second, I have a scrollbar window with text in it. The scrollbar moves to any part of the text. The first paragraph is for the Red text, the second for the Blue text and third is Yellow text.
When you click on the "Red" button the scrollbar should move to the RED TEXT headline. When you click on the "Blue" button it should move to the BLUE TEXT headline. And the same for the Yellow.
View 2 Replies
Nov 26, 2008
Before I instantise a class that uses a UIScrollBar component, I am using an invalidate() call as I am trying to get an Event.RENDER off a display object and it stops the UIScrollBar from displaying and when it does due to a Stage listener event it is barely functional.
I do remember that the UIScrollBar handles its display update in a weird fashion and wonder if there maybe a conflict of events here? Does the UIScrollbar component use RENDER events that this preceding call may break?. I have tried with and without the update() method in the scroller class.
Note: it works fine if don't call the invalidate() method.
I seem to be getting this error, I am assuming that this is an event handler on the component:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at fl.controls::ScrollBar/thumbReleaseHandler()
View 2 Replies