Control scrolling in a scrollPane component with AS3 - actionscript-3

Feel like I'm asking easy questions. I'm wanting to control the scrolling of a MC in a scrollPane component without clicking and dragging the scroll button. I want to use tabs located on the main timeline and outside of the scrollPane source, so that when I click on the first tab the MC inside the scrollPane scrolls to a certain spot, etc. I'm also wanting to show the actual scrolling as it's taking place, not just jump to the desired location.
I did this really basic test code which works as far as changing the location of the MC inside the scrollPane. However it doesn't change the scroll button location so I can't manually scroll back up after moving the MC's vertical location because the scroll button is still located at the top. It also doesn't show the MC scrolling (if that's even possible), it just jumps up vertically by 100:
scrollPane.source = movie;
scrollPane.source = new movie;
scrollTest.addEventListener(MouseEvent.CLICK,fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
scrollPane.source.y -= 100;
}

Related

Move mouse out of bounds Actionscript 3

My problem is really simple
I´ve an artifact with a mouse inside. When you use it it simulates moving the mouse cursor indefinitely to the right.
Of course when i run my project at some point the mouse will reach the right side of the movieclip and the Mouse_Move event wont work anymore
I need a way make my actionscript to recongnise mouse movement even if im out of bounds
(It´s a mobile aplication so using full screen wont work)
In other words i need a Mouse-Motion Listener!
Though it is not possible to track mouse movements outside of flash with only ActionScript, you could capture the mouse position with javascript in the browser and pass it to your SWF.
See this blog as an example. http://www.nelsond8.com/?p=515
You cannot track the mouse position or actions when it moves outside of the stage.
You can however track when the mouse actually leaves the stage using Event.MOUSE_LEAVE:
function mouseLeave(e:Event):void
{
trace("Mouse left the stage.");
}
stage.addEventListener(Event.MOUSE_LEAVE, mouseLeave);
From here you can decide what the most appropriate course of action will be for your application - adding some 'pause' functionality is pretty common.
Tip: MouseEvent.MOUSE_MOVE is what you should use to detect when the mouse re-enters the stage.

AS3 Clicking through the hidden Mask area

I am trying to create a Flash Application similar to www.faceinhole.com.
So far I was able to load my photo through Browse functionality.
Display it inside a movie clip.
Mask this movie clip with an oval shape.
Add the transform controls (senocular) to resize and move the image.
The problem:
Whenever I click on the visible part of the Masked Movie Clip, I can successfully drag my photo around. However when I click on the hidden part of the Masked Movie Clip, I cannot drag my photo around.
Question: Is there a way to add mouseEnabled=false to the hidden area of a mask?
Place a invisible (alpha=0) Sprite on top of everything on the stage or visible section, including the picture and mask and have that drag around. Add a callback to it that updates the picture's position underneath the mask based on the drag values. You'll need to reset the invisible sprite so you can keep dragging the picture and also put limits to how far it can be dragged.

flash click and drag sametime doesnt work

I have a seek bar for video player
just like youtube, user can drag the cursor in seekbar or click anywhere on seekbar to jump to the time
I use mouse.down and mouse_up event for dragging the cursor:
mc.cursor.addEventListener(mouse_down)=>mc.cursor.startdrag();
mc.cursor.addEventListener(mouse_up)=>mc.cursor.stopdrag();
and for clicking:
mc.addEventLister(mouseevent.click)=>mouseEvent.target.mouseX
here is my problem:
if I do only clicking or dragging nothing wrong
but when I do both clicking works but dragging isnt
when mc.cursor.mouseEvent up is called mc.mouseEvent click is also called and since mc.cursor is clicked click event got the coordinates wrong
I remove the click event in mouseEvent up function in 1st line and in the last line I add again but it does the samething again
how can I use them in the sametime
thanks
I guess the best way to go here would be to attach the click handler to the bar (you have an horizontal bar BELOW the cursor, right?).
So, it would go something like this:
var timelineBar:Sprite = mc.bar; // This is the clickable horizontal bar below the cursor
var cursor:Sprite = mc.cursor; // This is your current cursor
// Add dragging events to the cursor sprite
cursor.addEventListener( MouseEvent.MOUSE_DOWN); // start drag
cursor.addEventListener(MouseEvent.MOUSE_UP); // stop drag
// Add the CLICK event to the timeline-bar Sprite INSTEAD of to the cursor's parent
timelineBar.addEventLister( MouseEvent.CLICK );

As3: Button only working in certain locations?

I really don't know how to explain this problem. I'm really stumped as to what is causing it.
Here is the code:
var abutton:AButton = new AButton; //Where AButton is a button defined in my library
addChildAt(abutton, numChildren);
abutton.addEventListener(MouseEvent.CLICK, attack);
It doesn't want to work when certain movie clips are underneath it, but I don't want to make it more complicated by switching to another screen. Is it possible to make the button work with movieclips underneath?
What do you mean by "certain movieclips"? What do you mean by not working? The CLICK event isn't firing? Normally if a click isn't working on a button, it means that something else it trapping the mouse click above your button. This can be another Sprite, MovieClip or TextField.
Add a click listener to the stage, and have it print out target and currentTarget. Then, when you button doesn't work, the stage listener will still fire and you'll be able to see the object that's blocking your button.

JInternalFrame makes the parent panel lose track of MouseWheelEvent?

I have a JDesktopPane which default layer is a JPanel rendering custom Java2d by overriding its paint() method. When the user clicks a rendered object, I open a JInternalFrame displaying details. The user can additionnaly pan and zoom with a mouse pointer or mouse wheel change.
The weird thing is that after closing the last JInternalFrame, mouse control changes: mouse pointer can still drag, but mouse wheel does not react anymore. In other words, mouseWheelMoved(MouseWheelEvent e) gets never called, but mouseMoved, mouseClicked, mouseDragged and mouseRelease still get called properly.
The JInternalFrame displays a JTable in a JScrollPane. Would somehow the JScrollPane acquire the wheel?