Flash AS3 Looping Gallery - actionscript

How to make the gallery looping.when last image in the gallery finished i want to show from the beginning.(horizontal auto scrolling the images from right to left).Please help!
Here the code below for scrolling but i want to scroll continuously when last image over
addEventListener(Event.ENTER_FRAME, leftSideScrolling);
private function leftSideScrolling(e) {
galleryWidth = rootClip.imageContainer.width;
speed = -(0.02 * (980 - 620));
rootClip.imageContainer.x+=-2;
if (rootClip.imageContainer.x>0)
{
rootClip.imageContainer.x= (-galleryWidth/2);
}
if (rootClip.imageContainer.x<(-galleryWidth/2))
{
rootClip.imageContainer.x=0;
}
}

Instead of scrolling the container, scroll the images inside the container.Assuming you're scrolling from right to left, when an image x is inferior to its width , meaning that the image is out of view , add it to the end of the image container, which would be the total width of the container minus the width of the image you're moving. that should do it!

Maybe you need to have progressive loading if you have many images in order to load certain amount at the time, but if you wish to go with what you have, then throw a loading flash movie when loading an image, limit loading amount of images, once user start to scroll, hide off screen images and load next x amount of images. As PatrickS mentioned, scroll images (flash movie clips) instead of container. All images should be located under a movie_clip to apply effects, all movie clips should be located under container to have scrollbars and move positions with AS1/2/3.

Related

UIImage - Infinite Scrolling Background

Does anyone know how to do something like that?
I would like to get a continuous scrolling of the image.
Example: https://vimeo.com/262632459
Here is a simple way of doing it.
Set it up
Create the image you want to scroll in the background. You need to make it minimum as wide as the widest screen you want to support.
Place two instances of the image you created next to each other inside a regular UIView.
Place the view on the screen with the x position at 0.
Animate
Animate the view repeatedly forever, moving the x position from 0 to -width. The width is the width of your image (just the width of one instance). Note that since you want to pull the view left, you must pull x in the negative direction.
The image will now slide left until the second instance x is at 0. At this position the animation will start over, moving the view one whole image size to the left. This movement will not be noticeable since you use two identical images.
You need to use scrollview or subclass of scrollview and in that scrollview add your image you want to scroll.
override scrollViewDidScroll delegate method of scrollview, here you can control the animation (how much user can scroll or other behaviours)
https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll?language=objc
And if you want circular image(when image reach to last start again) add two copy of same image, One at zero position, before your acutal image and one at last position after actual image and as soon as image reaches to last remove the font image and add in the last, and if user scrolling in right direction remove the last image and add in front.
In scrollview add three imageview and keep adding and removing from the front and last based on the scroll direction. In scrollViewDidScroll you will get direction of scoll based on change in x value

Not resizing downloaded images correctly

I have added a table view, and I am display image in the cells. I have also added this code:
So that the cells resize depending on the image.
When I launch my app though, I get this :
[![enter image description here][1]]
And the images do not load untill I start scrolling...If I scroll down half the page then go back to the top, I get this: Which is correct
[![enter image description here][2]][2]
Any ideas? I have researched on google and tried the odd solution for the older versions of Xcode, But nothing seems to work!
If the image is already downloaded and resident in your cache when you pass the post to the cell them the image view will have an image and therefore an intrinsic content size. This all allows the table view to calculate the required layout.
If the image needs to be downloaded then the image view won't have an image and will size to zero because there is no intrinsic content size other than that.
If your images are all the same size then you can supply a placeholder image while waiting for the download and the cell will size appropriately.
Note also that you aren't updating the cell when the image has downloaded. When you do this you do need to check that the cell hasn't been reused (or you'll be showing the wrong image). If you don't have a placeholder or can't guarantee the image size then you will also need to ask the table view to update.
Maybe your post.downloadImage() and post.fetchLikes() should callback, and in callback, should reload cell in mainThread. hope it help.

iOS 7 App Terminated due to Memory Pressure

I have a two views of an ipad App which utilizes large UIScrollowView's, which appears to be leading to memory issues. I get my first memory warning when memory hits about 250MB. When using Apple Instruments, here are the largest of the All Heap:
VM: ImageIO_JPEG_Data, size 32.13MB
VM: CoreAnimation, size 32.13MB
VM: ImageIO_JPEG_Data, size 26.64MB
...
I have many images within the scrollview - which are all loaded into the storyboard, and I'm wondering if I reduce the size or resolution of the images it will fix the issue?
You could set up a system to delete/load certain images at certain points in the scrollview, so the app only has them in memory when the user is about to see them.
Because you said it's rather large, in the scrollview's scroll method, set variables to know what position the scrollview is in (eg: half way down, 10% scrolled, etc). If the user is sitting at the end of the scrollview (ie: unable to scroll down anymore (100%)) then they're not exactly looking at the images at the top of the view. You could then nil these images so that the app can re-use that memory. When the user is scrolling and the scrollview is near a certain percentage, you can then load those images that the user is about to see and nil the images that the user is far away from (this might cause a few seconds of 'whitespace' when the user is scrolling madly through your app, but that's okay because it won't take more than a few seconds for the images to all load).
Because these images are loaded into storyboard, I'm assuming you're loading them via UIImageView's. Simply give each one an outlet (hold control + click and drag it to your class's .h file and create an IBOutlet), then when you have the percentage of how far the user is down your scrollview you can know 'okay, the user is at 50% so I can get rid of the images from 0-20% and 80-100% of the scrollview',
you do this by:
//^Get scrollview scrolled percentage
//^find out where the user is, get a list of UIImageViews that are not visible on the screen
_yourUIImageView.image = nil //get rid of the image, clear memory up
//then when you need to add it again, assign an image to the UIImageview
Hope I helped.
Maximum do not load images in Storyboard,
rather you can do it through coding,like below
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
NSString *pathForImageFile1 = [resourcePath stringByAppendingPathComponent:#"filename.png"];
UIImage * image = [[UIImage alloc] initWithContentsOfFile:pathForImageFile1];
imageView.image = image;
image = nil;
Hope it helps!

how to overlap image on another images while dragging it in iOS?

I have created JIGSAW game. In that I've split image into 3X3 matrix and display on screen (i.e [self.view addSubView:imageview] like this I added all 9 image tiles).
Now for solving game when I drag one image tile to another image tile sometimes it goes over the image or sometimes under the image (like the default behavior of iOS first image added to view appears under remaining all images and last added image appears on top when user drag image see in attached images)
Now I want when I drag any image tile it must be appear on top of remaining images.
Same as last added image appears on top.
Whenever an image view is touched for dragging you can move it to front by calling bringSubviewToFront.
[self.view bringSubviewToFront:touchedImageView];
When the touches start call -[UIView bringSubviewToFront:] on the tile's superview, with the tile as the argument.
you should know about:
- (void)bringSubviewToFront:(UIView *)view
and
- (void)sendSubviewToBack:(UIView *)view

UIImage or UIImageView with paging and zoom on click

I have a UIView in which I get certain information about a user, wthin a bunch of textfields and a bunch of photos of him, if available.
No Im a bit limited here, so I must have a UIImage or UIImageView on my View (only the first half of my view, to display this images.
Up to now I have a array of this images in the background and as soon as the user swipe over the UIImageView, the image shows the next.
But it's ugly, becuase there is no real paging (you know, see the second image in pieces while you swipe, at the moment its only a UIMageView.Image = xxx and its ugly) and no zooming (zoom on click).
Any idea to solve this?
Use an UIScrollView and place all of the images in it (as UIImageViews).

Resources