ActionScript 1/2 :: Center The Image When Click The Movieclip
Oct 30, 2009
i am new with flash, and i had swf which contains big image it will resize to best fit. when i double click the image the clicked position come to center of the stage. i achived little bit, it zooming but image not come to center position. i have attached the fla file in it i have used this script to zoom on double click and bolded 2 lines are to position the image.
i am trying to center the image once clicked, i have multiple images(4) and want them to open dead center on the stage i would also like to close the opened image when the next one opens and return it to original position!
what i have got so far:-
stop();port1_mc.doubleClickEnabled=true; var centerX:uint = stage.stageWidth / 2;var centerY:uint = stage.stageHeight / 2; port1_mc.addEventListener(MouseEvent.DOUBLE_CLICK, go); function go(evt:MouseEvent):void{ //opens image to the stage gotoAndPlay (2);}
I've recently taken Krilnon's tutorial on interactive image panning, and have a need for more complexity. My image to be panned (relative to user's mouse movement) has several 'hot spot' buttons placed within. Each hot spot, when clicked, is to smoothly zoom and shift within the mask, with pertinent info displayed next to each, once zoom and shift is complete. almost like I'm making a motion tween, where the final position is known, but the start position is wherever the BG image is when the user clicks the nested button. I need to determine the x-position at the moment of click of the button (different for each button), and then, I think, use a simple-math "stagger-step" method of moving and scaling, until I've reached my final dest. here's the link to the tutorial I originally referenced:If anyone knows of a tutorial or example out there, I'd love directions to it(them). or,
I have a movieclip, that is draggable (horizontally), i have this code (helped achieved by Kglad!):It has a nice effect, but when i click to drag the movieclip jums to its registration point.
var completeTween:Boolean; var finalMouseY:int; var startMouseY:int; mc.addEventListener(MouseEvent.MOUSE_DOWN, onDown1);
I try to put an extern image in my flash movie. No i have problem to center it.This is the code i tried to use:
Code: var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth()); var image:MovieClip = container.createEmptyMovieClip("image", container.getNextHighestDepth()); var listener:Object = new Object();
As the title says, I'm trying to figure out how to center and image to a movie clip. I am familiar with centering images to the stage. imageLoader.x = (stage.stageWidth - Number(rawW)) /2; imageLoader.y = (stage.stageHeight - Number(rawH)) /2; But I do not know the correct actionscript phrases to implement this same concept into my movie clip known as "gallery_mc".
I am loading a set of thumbnail images from an array [hard coded] into a movieclip symbol on the stage. I have two arrays with the thumbnail and the full size image having the same index number. In many examples, "event.currentTarget.contentLoaderInfo.url" returns the full path to the image selected. i just want the index number. Adobe does not make is easy to figure out what other properties are available to me from the contentLoaderInfo. Is 'SelectedIndex' or something like that available? Where does an inspiring AS programmer find the contentLoaderInfo properties and or methods available? Is url the only thing that us usable here?
var thumbnails:Array = ["tn_2010OpenHouse_00.jpg","tn_2010OpenHouse_01.jpg"]; var images:Array = ["2010OpenHouse_00.jpg","2010OpenHouse_01.jpg"]; var thumbX:Number = 10; var thumbY:Number = 623; var loader:Loader = new Loader(); loader.load(new URLRequest("images/" + images[0])); addChild(loader); loadThumbs(); [Code] .....
How can I center a loaded photo [lets say 200x300] in an image control [lets say 400x600]? My image control has fixed dimensions while my contents have different dimensions and I want them to get centered automatically.
I'm loading a .png image with loadMovie() and I need to center the image (for later dragging). I know flash has some issues with loading stuff, but I really need to get the movieclip's width. If someone knows how to get over this and get the movieclip's width
This is a part of a more complex app, so that's why I won't paste any code.
I'm having toruble with an image that I zoom into in flash. I got everything to work, only I want the clicked X and Y coordinats to center to the stage. ( so that the area clicked on always zooms in and position the area clicked to the middle of the stage) the image is a movieclip and it zooms with a tween, but i tried everything but the image wont center the stage..
does anyone have a clue for wich actionscript 3 code I can use to do this?
my code is:
const TWEEN_IN:String = "tweenIn"; const TWEEN_OUT:String = "tweenOut"; var tweenDirection:String;
I would like to know how to make it so when you click a button, it goes to a different frame within a MOVIE CLIP. Kind of like gotoAndPlay but not a frame in the timeline. I would like it to move to a different frame in a movie clip.
created in flash. The issue i am having is when an image is loaded it always appears on the left handside attached to the top left point of the stage. Is there anyway i can get these images to load in the centre of the stage? This is the AS that is attached to my flash document.
Actionscript Code: function initGallery() { function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; total = xmlNode.childNodes.length;
I have am trying to establish the center of the imags that load so that I can put them in the center of the stage. I am doing this as each image is a different size.
Here is the code i have gotten to work before but its not working now and I have been searching to find what I have done wrong with no luck. : ( Would you look it over and maybe you will see what I am doing wrong?
public function placePicture(e:Event = null):void { rawImage = imageData.image[imgNum].imageURL; lastImageIndex = imageData.*.length() - 1;
[Code].....
and I tried doing all of the above by inserting the loader into a sprite and then applying the code to the sprite and then adding that sprite to another sprite and putting that at 640 and not inserting it in another sprite and trying to straight up put the existing sprite at 640 (hopefully that all makes sense). And I have tried to put it to width/3 and nothing different happens.
I am building a flash interface and I would like a menu where it is hidden to begin with (just a tab). You click the tab to expand it, and click again to collapse it. I've made a movieclip with animation of the menu opening up and closing, but I can't seem to work out how I'd go about making the movieclip open and close properly.
I'm a real noobie with flash and I was wondering if somebody could help me with this one. I have this actionsript 3 code, where the cursor image "ball_mc" follows the mouse's position with a slight delay:
[Code]...
1) How can I get the cursor image automatically return to the center of the stage on mouseout? As of now, it stays at the position where the mouse leaves the stage.
2) How can I reverse the movement of the mouse? So that when I, for example, move mouse to the right, the cursor image would move to the left? And when moving the mouse up, the image would go down. The stage is 800 x 250 pixels, in case that makes any difference.
I'm trying to draw an image in actionscript, I set it as a BitmapFill within a rectangle. The problem is that if I move the rectangle away from the origin(0,0), in my case I start drawing the rectangle at (20,35), the bitmap background doesn't follow along. The background is always drawn at (0,0) and then repeated, so I don't get a centered image but rather 2 halved images. Here's what my code looks like:
public class PageTileRenderer extends VBox { private var sp:Shape;
[Code]....
how to move the background fill origin. Or is there another solution to draw the image centered.
I have a list of artist, each one a mc, in a vertical display. Next to them, I have a holder in which I load the thumbnails one the mouse is over a mc.This images, are being loaded via loadclip.. resize-center and then shown with alpha..But sometimes, the image are shown huge, and instantly resized and positioned.This a dvd project.. so images are not being downloaded..this is the part of the code..
im creating an xml image gallery and its going well, but for some reason when i add the loaded image to the stage even though i've specified it to go to the center of the stage it doesn't, and won't center until I resize the stage
I am working on a flash project right now with the help of the tutorials found on this website and decided to use and modify this existing slideshow by Kirupa.
[URL]
What I did was, I resized it according to my projects demands, which is 1024x650 [URL]Everything is working perfectly except for one drawback.
Some of my images are sized 440x650. Normally, when I link that to the XML file provided, it is aligned by default to the left. My current solution was to resize the entire file into 1024x650 creating the illusion that the image is at the center because I included the seamless background on the saved jpeg.My question is this, is there any way I can center the 440x650 image to be displayed in the slideshow?