Flash Slider Component - actionscript-3

I just started learning flash on my own and I decided to make a cool little image gallery (somewhat of a family album). When I test the movie the first image loads in the center. Below the image are little thumbnail sized buttons which can be clicked and the image will load in the center. Since I am going to be incorporating a lot of photos I would like to use a Slider (left to right) so I can scroll back and forth through the photos and find the one I want to click on to display.
Since I have no experience with Action-script I was hoping someone could get me started with that process and maybe explain how the Slider works.
Thanks!

You can create easily your own slider, and learn something in process :) .
In slider - moving of knob, must correspond to moving of gallery where size of gallery is translated to size of slider. That is basically it. So you will need some mathematical formulas and basic elements:
gallery.width/slider.width - to determine if gallery is wider than
slider (so you would want to proceed with sliding), you can also use this proportion to determine a size of the knob. So if gallery would be smaller than slider - then you may not render slider, or make knob the size of slider, so it would be not movable. Or make knob proportional size to size of overflow of gallery - just experiment with everything I'm writing here.
You would need to use also those elements:
gallery (Display Object),
mask/container for gallery (the visible part of gallery),
slider,
knob.
Rectangle object
Gallery would be just a Display Object that contains all images as children.
Mask/container would be display object that would provide boundaries of area where part of gallery would be visible
Slider - any Sprite
Knob - any Sprite
Rectangle - would be of course Rectangle object, with width of slider.width - knob.width, and height of 0, so it would allow to drag knob along a slider without going outside of it, by using function:
knob.startDrag(false, rect); // Use it at MouseEvent.MOUSE_DOWN of knob
knob.stopDrag() // Use it at MouseEvent.MOUSE_OUT of knob
You can create rectangle with this code:
new Rectangle(0, knob.x, slider.width - knob.width, 0);
And you would need to translate moving of knob to moving of gallery which would be something like this:
// When moving knob you can use this formula:
gallery.x = knob.y / (slider.width - knob.width) * (gallery.width - mask.width); // Use it at MouseEvent.MOUSE_MOVE of knob
I think that should be it, I wrote it from the top of my head based on some library I wrote some time ago, so please tell me if you will encounter any problems, but I think that are all basics you need.

Have a look at the ScrollPane
Add your thumbnails in a container and use that as the Scrollpane's source and scrolling will be taken care of

Related

Fixed Position element changes color when scrolling down to a new page

I saw the Google Material Design website and was amazed by the change of color of the left, sticky "speech bubble"-image when you scroll down.
I am trying to understand the concept but Google's code is huge and somewhat confusing...
I think there are actually two images, but I cant recreate it just with different z-index values alone (I can let the first image disappear and the first appear but in combination it doesn't work).
Do I need a JS-library for that? Waypoints/scrollreveal etc., is this some kind of SVG magic or am I overlooking a simple solution?
on simple usage try onScroll() method using js for applying basic css colors on your element.
I believe those are animated objects, and the sections (their containers) have overflow:hidden, so those objects stay within their sections.
Also they probably have position:fixed and positioned using'top' and 'left' properties to stay on place all the time (or probably some JavaScript magic).
And ther animation is launched using JavaScript function scrollTop(), when visitor is on a certain distance from a page top.
I'm not sure what is used in this exactly page, but you can change and adjust scale, size, color and transparency depending on position from page top using JavaScrip - 100%.

Adobe Edge Animate: Is there a way to use CSS media queries to resize an image?

I'm using Adobe Edge Animate and I'm really having trouble with all the different screen sizes and resolutions. I see that Adobe is coming out with new products which may address this issue. Basically all I'm tryng to do is have an image display (like a banner for example) that fills the width of the user's screen. I see the following questions, but answers are old and I know that there has been a lot of development in this area. Any ideas greatly apprciated.
Stackoverflow questions
From the splash screen. In the Properties tab change the switch next to the width to make it 100%. Select the Max W parameter and change this to too. All these tweaks will make the layout responsive. Next drag the image onto the stage and position in the top-left corner. In Properties click on Use Presets for Responsive Layout and choose the Center Background Image option, then Apply. This means the image will stay central whenever the stage morphs. Drag the bottom-right corner handle so the image fits over the entire background. Notice the image doesn’t scale or stretch but stays in the centre. In the Position and Size tab is an expand button; click this and add a Max W of (how many px your image is). Change the width to 100% and press Enter. It will jump right back to 75% but it has accepted the change. Click on the resize marker and drag to the left to see what happens when the stage is resized to a smaller layout. As you can see, the background is clipped but the image resizes to fit.
Here is a link to the tutorial I think this will better answer your question if you do this tutorial. http://www.webdesignermag.co.uk/tutorials/create-a-responsive-animation-with-adobe-edge-animate/

AS3 move image as the mouse moves

This probably will be very easy for some, but I am stuck on this. I have a map in a movieclip(mc_map) on stage and a small square which acts as a mask to the really bigger size of the same map. What I am want to do is that when I move the mouse on the mc_map(eg: say my cursor is on New York), the small sqaure window will unhide the same area, or will move that bigger image such that the same area is shown under the square mask. I also want to add another cursor(or crosshair) to the stage which is live only in the area of the square and replicates the position of mouse on map. Any help on this will be great thanks.
There are a lot of tutorials on this type of "magnify" effect. See if this one helps: http://www.flashuser.net/flash-actionscript-as3/create-a-magnifying-glass-in-actionscript-3-0.html

transparent JButtons in JFrame with a Background Image

I am making a Class that extends JFrame and have my custom background image on it..
I have two problems..
1) I want my background image to stay fixed sized that covers whole screen when maximized. How can I do that?
2) I want to add a transparent button and panels on the frame that does not disturb my background. Is there any easy way to do that?
help will be greatly appreciated... thank you
Load the image into a BufferedImage.
Add a ComponentListener to determine when the frame is resized. Use the frame size to calculate scaling and call BufferedImage.getScaledImage(xScale, yScale) to obtain a scaled image.
In your class you should be overriding paintBackground() to do the painting. Just call g.drawImage(scaledImage, getWidth(), getHeight(), this) to paint the image.
Any components you add to the frame need to call setOpaque(false) so the background gets painted underneath them.

scaling and positioning with tweenlite

I have a movieclip with the mesurements of a rectangle. When the application is launched the movieclip is being scaled before placed on the stage as following.
menu.width = 400;
menu.scaleY = menu.scaleX;
this is a smaller size than the original.
the position of the movieclip at this moment is in the middle on the x and top of the stage on the y.
when i click iti would like to do a tween with tweenlite wich scales it to its original(bigger) width and height and position it in the center of the stage on x and y.
the problem is when i position it with tweenlite, it gets done according to its old scale and not according to its new(bigger) scale so the movieclip isnt placed in the exact center of the stage.
Anyone know how i can resolve this?
I tried to compensate by adding a bigger number on the position so it gets positioned in the right way.
But when i click it again i would like it to rescale to its beginning scale and position so it would be very messy to compensate again. Is there any easier way to do this kind of tween?
I doubt that i'm being clear to what i want but i hope i am after all.
The easy and way of tween position and scale is probably to add the menu to a container.
You would then on one hand tween the position of the container, and on the other apply the scale to the menu it self without having to recalculate the proportional position if the scale changes.
This way you can even control the registration point of the menu within the container. e.g. to always scale from the middle...
This can be done with a matrix as well if you want to avoid to stack objects, but honestly it can get really tricky whereas the container method is bullet-proof.