Actionscript 3 simple image slider - actionscript

Thanks in advance for any help. I'm a Noob at actionscript 3, and what I'm trying to do is make a image slider. Basically, there would be a movieClip, acting as a container, and a left and right button. when I click left button, the Container slides left and vise versa.
Now I kind of got things working, the problem is when I press say the left button, the Container moves left,and keeps moving left as many times as I click the left button. But I want it to stop, or loop, at the end of the Container, and I'm not quiet sure how to do this.
I searched all over the net but didn't find anything useful, most of what I found is really complex or heavily reliant on external libraries, and I don't want to just copy and paste code snippets that I don't understand. Can anyone please give alittle insight on how this can be accomplished in actionscript 3.
here is a copy of my code so far
Thanks
-Noob
//leftButton and rightButton are movieClips on the stage
leftButton.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft);
rightButton.addEventListener(MouseEvent.MOUSE_DOWN, moveRight);
//NOTE: thumbContainer is a movieClip on the stage
//Make the mask;
var myMask:MovieClip = new MovieClip();
this.addChild(myMask);
myMask.graphics.beginFill(0x000000);
myMask.graphics.drawRect(6,138,534,144);
myMask.graphics.endFill();
thumbContainer.mask = myMask;
//thumbContainer moves left on button press
function moveLeft(evt:Event):void
{
thumbContainer.x -= myMask.width;
}
//thumbContainer moves right on button press
function moveRight(evt:Event):void
{
thumbContainer.x += myMask.width;
}

Now I kind of got things working, the problem is when I press say the left button, the
Container moves left,and keeps moving left as many times as I click the left button. But I
want it to stop, or loop, at the end of the Container, and I'm not quiet sure how to do
this.
What you have mentioned here is not very clear. From what I understand, you have a container myMask which slides off your parent container thumbContainer when you repeatedly press the left (or right) button.
Assuming this is the problem, allow the myMask container to move left or right, but check each time with the screen resolution width (Maybe have a if statement or something). Hence, move left/right only when the condition is satisfied(there is space for moving left/right)
Hope that helps!

Related

How to delete item from Swift UI List in UI Test

Is it possible to delete a Swift UI List item from a UI test?
For the user they can press the edit button which puts the list into edit mode (screenshot 1), then press the red circle with the white line, then press Delete.
Alternatively the user can swipe delete the list item.
Even with the accessibility inspector on I can't see what the icon is (the red circle with the white line). It doesn't show anything when I hover over it. Also the recorder doesn't record anything if I try using that tool.
If I try with .swipeLeft() to try to delete using the swipe gesture instead, it actually "taps" on the list button instead of swiping and just opens the detail view.
Any ideas? What am I missing here? Or is this not actually possible?
Ok I found a way to make it work with the swipe method. It's pretty simple. Just need to let the test know to swipe a bit slower.
app.staticTexts["Test"].swipeLeft(velocity: XCUIGestureVelocity.slow)
Using that I'm able to then tap on the delete button and assert that the item is gone.
I'm not super fussed right now about the other method, as long as there's a way to test deleting (and as long as I'm allowing swipe delete). However would be good to know if someone has the answer.

Home button in PowerPoint to show on mouseover using VBA

I use a home button on most of my slides with a link back to the agenda for quick jumps during my presentation. That way I avoid flipping through the individual slides and get straight back to the overview.
However, I don't want the home button in my lower right corner to show on each page as it spoils the clean look. I tried to use the mouseover event in combination with a macro but can't get it to run. I thought about making the home button completely transparent and on mouseover I would set the transparency to zero so the button shows up. When I click on it, it would follow the link.
Any help to get me there is highly appreciated.
You do know that you can simply press 1 then Enter to return to the first slide in the show, right?
But to follow up on your "I thought about .." idea, why not add a shape on the slide master in a place that won't get covered up by content in any of the slides, then assign it a Go To Slide 1 action setting. After testing to make sure it does what you want, give it any color you like then make it 99% transparent.
As long as you don't forget where to click, you're good to go.

How to use TFramedScrollBox correctly with Touchscrolling, if there are Buttons inside?

I have derived a TFramedScrollBox to implement in my component a class which constructs me on a given dimension (x and y) buttons onto the FramedScrollBox. This works fine. Touchscrolling on this object works fine, if the property Touch.Pan is set to true. Then i even can scroll over the buttons and by "touching" or "tapping" the buttons the click event happens right after the touch. This derived component, my component, is used all over the application, because it need to be.
The Problem(s)
The given app is running in fullscreen mode on win 8 systems which is currently necessary for our business. In the above explained situation is not possible to tap the buttons fast after the others, because some click events don't rises. And the logic behind is not necessary. That is one problem... If I switch the form to none fullscreenmode then a touch on different buttons rises the click event immediatly as wished. Now i have discovered that if the above mentioned property Pan is set to false, then even on fullsceenmode every touch click rises the event but now the scrollbox don't scrolls by touch gesture...
Now comes my question in the title...
Ps. if wished i can send a simple sample...

JQuery sortable (items with various heights) moving to first or last position is troublesome

Problem
I am having problems with my sortable list with several items of various height. The problem occurs when I'm trying to move a larger item to the first or last position (which both have smaller objects). If I succeed currently depends very much on where on the larger item I click and start dragging.
If I want to move the item to the smaller bottom position I must click close to the bottom of the item for it to work, and if I want to drag it to the top position I must click closely to the top. But I want to be able to drag the item by clicking anywhere.
Some additional information
The items cannot be dragged outside the parent and the parent is only as large as it has to be and a scroll appears if it's larger than it's container. So it seems that I cannot drag the larger item past the first(smaller) item if I don't drag it in the top part of the item.
I've been trying to fix this by using cursorAt and using top:0 and another test using bottom:0 But it doesn't seem to make any difference (so I might have misunderstood how to use it). I am currently using tolerance: pointer.
I can bypass the problem of not being able to drag the larger item to the last position by temporary during the sorting increasing the height with the height of the dragged item. But it doesn't always work and its not a very good solution. And the problem of not being able to drag it to the top still appears?
I cannot change the JQuery code as in jquery-sortable-with-containment-parent-and-different-item-heights
Question:
How can I drag a larger item to the top or bottom position while allowing the user to click anywhere on the item?
Thanks for your help!
This might not solve your problem, but I thought I'd share the results of some experimenting I did today. I needed to make a sortable photo gallery with inline-block pictures of varying widths, and found that moving wider photos would be really hard work because the placeholder was smaller than the item I was moving. I ended up using this:
container.sortable({
placeholder: "photo placeholder",
start: function (event, ui) {
ui.placeholder.width(ui.item.width());
}
});
The custom placeholder classes are there to ensure the placeholder isn't hidden by default, and the start event ensures that the placeholder is the same width as the item you're about to move. This worked very well for me, and in your case, substituting height for width might work.
I also tried using containment as you have done, and found that it sometimes makes things much harder depending on the items in the row. Like you have explained, including tolerance: "pointer" helps to alleviate the issues, but if possible, removing containment generally makes the UI more forgiving.

Jquery ui - drop is not working all the times

I have been facing a problem with the Jquery UI drag and drop. Please find out my sample code at,
http://jsbin.com/ojaji4
In above sample, There are two droppables. I have set [tolerance: 'pointer'] for droppables. In the middle, there are draggable elements. Now, start dragging element from the left side BLUE square and try to drop it over right side droppable (OR, start dragging element from the right side BLUE square and try to drop it over left side droppable). Both above scenarios, won't work!
Can anybody please suggest?
Remove the "containment: 'body'" from the draggables, so they can go further then the body.

Resources