ActionScript 3.0 :: Get Center Of Image Not Working?

Feb 21, 2010

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.

View 3 Replies


Similar Posts:


Flex :: Center An Image Horizontally And Vertically In An Image Control?

Aug 14, 2010

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.

View 1 Replies

ActionScript 2.0 :: Loading A .png Image With LoadMovie() And Center The Image

Oct 20, 2009

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.

View 3 Replies

ActionScript 2.0 :: Challenge To Center Working Preloader

May 19, 2010

I'm in a bit of a pickle and can't sort my way out. I'm loading an external swf that has a preloader on Scene 1, and the main content on Scene2. While the content on Scene 2 centers nicely, the preloader content refuses to do so.

Here's what I've got on my main project timeline:
Code:
mcHMI.onRollOver = function() {
this.gotoAndPlay("over");
} mcHMI.onRollOut = function() {
this.gotoAndPlay("off");
[Code] .....}

As mentioned, the swf loads just fine and stays centered at any resize. The preloader will jump to another position when you resize.

View 0 Replies

ActionScript 2.0 :: Challenge To Center Working Preloader?

May 21, 2010

I'm in a bit of a pickle and can't sort my way out.I'm loading an external swf that has a preloader on Scene 1, and the main content on Scene2. While the content on Scene 2 centers nicely, the preloader content refuses to do so, lol.Here's what I've got on my main project timeline:

Code:
mcHMI.onRollOver = function() {
this.gotoAndPlay("over");

[code].....

View 6 Replies

Xml Image Gallery Appear In Center?

Apr 14, 2010

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;

[code].....

View 1 Replies

IDE :: Center Swf Image In Browser?

Nov 9, 2009

Is it possible to center an swf in the html or php file, when the swf has a width larger than the browsers width?

View 1 Replies

ActionScript 1/2 :: Center Image Using LoadMovie?

Jul 31, 2010

I'm trying to load an image and center it within a movie clip already on the stage.
 
function loadImage(){  image_mc.loadMovie("fullImage/"+imageNum+".jpg");  image_mc._x= Stage.width/2 - image_mc._width;  image_mc._y= Stage.height/2 - image_mc._width;}
 
I know it's something simple and there are forums dedicated to this topic but I can't seem to view the code examples that the helpers are using.

View 3 Replies

Actionscript 3 :: Center One Image Horizontally?

Nov 5, 2011

with the formula below I can center one image horizontally.

var xPoint= stage.stageWidth / 2 - imgWidth / 2;

In case if I may have more than one image, how can I center them horizontally?

View 2 Replies

ActionScript 2.0 :: Center Image In A Movieclip?

Mar 23, 2010

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();

[code]....

But I can't see the picture....

View 2 Replies

ActionScript 3.0 :: How To Center Image To MovieClip

Jul 7, 2011

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".

View 2 Replies

Actionscript 3.0 :: Row Counter Of Center Image?

Apr 24, 2009

How do i make this problem solved

problem.gif (72.44 KiB) Viewed 381 times

View 3 Replies

ActionScript 2.0 :: Center An Image/movieClip?

Nov 10, 2004

Now I am trying to center an image/movieClip. Below is how I get everything going

Code:
var k = _root.createEmptyMovieClip("stage", 50);
k._x = 400;
k._y = 300;
var p = k.createEmptyMovieClip("bigImage", 0);

[Code]...

View 4 Replies

Flash :: Flip Image Around Center?

Jan 5, 2012

To flip an image around the center i am using this piece of code:

// Calculate offset
var offsetWidth:Number = image.contentWidth/2.0;
var offsetHeight:Number = image.contentHeight/2.0;

[Code].....

View 1 Replies

IDE :: Mc Tween Resize Center Of Image?

Jan 23, 2009

I'm just trying to figure out to get my MC to resize from the center instead of the top left? Can I change the registration point or something in AS?

View 1 Replies

ActionScript 2.0 :: How To Center Image In TextField

Oct 4, 2004

I have a dynamic textfield and it is using the htmlText attribute. How do I center an image that is loaded in using the <img> tag?

View 1 Replies

ActionScript 2.0 :: [MX] Center An Image/movieClip?

Nov 10, 2004

Now I am trying to center an image/movieClip. Below is how I get everything going

[code]...

View 4 Replies

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.

[Code]...

View 16 Replies

Flash :: Cursor Image To The Center On Mouseout

Nov 17, 2009

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.

View 2 Replies

ActionScript :: Drawing An Image In The Center Of A Shape?

Oct 20, 2011

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.

View 2 Replies

ActionScript 2.0 :: Scale-Center Image, Then Show?

Jan 16, 2012

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..

Code:
thumb.onRollOver = function() {
this.gotoAndPlay("rollOver");

[code].....

View 3 Replies

IDE :: Image Alignment - Won't Center Until Resize The Stage

Feb 19, 2009

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

View 2 Replies

ActionScript 2.0 :: Kirupa Slideshow - How To Center The Image

Jun 10, 2011

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?

Kirupa's original code is this one:

[code].....

View 1 Replies

Actionscript 3 :: Image Is Working After Compilation But Not Working Once The Executive File's Location Is Changed?

May 25, 2011

package
{
import flash.display.DisplayObject;[code]....

View 1 Replies

ActionScript 2.0 :: Align An Image To Center In A Flash Frame?

Mar 4, 2009

how can i align an image to center in a flash frame with actionscript 2.0? i'm trying something like that but it doesn't work.

imageContainer._x = (-(imageContainer._width - Stage.width) / 2);
imageContainer._y = (Stage.height - imageContainer._height) ;

View 9 Replies

ActionScript 3.0 :: Center Image/movie Clip On Click?

Oct 23, 2009

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);}

View 5 Replies

As3 :: Flash - Rotating Image And Then Moving X And Y Relative To Center?

Feb 21, 2011

I am in the midst of finishing up a design application where you can upload images and colors. I use the greensock transform manager. I am taking anything a user does and recording it so I can recreate what they made on larger scale behind the scenes (to be exported for printing purposes)

The problem I am running into is with rotation and moving x and y values. The transform manager does everything relative to a center point, but when i recreate the image object the registration point is at the top left. I have found how to rotate around the center of the object using the transform matrix, but I can't seem to move the x and y correctly because these values change when you rotate. I want to just move the image to the left or right relative to the center. How could I go about doing this.

Here is how I rotate.

private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point) {
var m:Matrix=ob.transform.matrix;
m.tx -= ptRotationPoint.x;

[Code]....

View 1 Replies

ActionScript 2.0 :: Center Align Externally Loaded Image

Sep 4, 2009

The code is in the first frame of the timeline. I want to center an externally loaded image, but I just can't make it work:

[Code].....

View 9 Replies

ActionScript 2.0 :: OnLoad For JPGs - Center Image On Frame

Jan 9, 2010

I'm working on a basic flash gallery, when the user clicks a thumbnail, the large image above it will load (using loadMovie ("whatever.jpg")...that's all working fine, but I want to have the image center on a frame once it's fully loaded since I have some portrait and some landscape images. What I'm wondering is, is there a simple way to check if a jpg has been completely loaded, similar to an xml.onLoad = function()? I've tried the getBytesLoaded and getBytesTotal thing as well as an onEnterFrame that checks the width but these have both had issues, maybe there's just some really simple way to check?

View 1 Replies

ActionScript 3.0 :: Center An Image Inside A Movie Clip Via Xml?

Nov 27, 2011

i have the following code which works. Its for two buttons either side of a movie clip (holder_mc) which holds the images. The images load but their top left corner go to the 0,0 position of the movie clip (top left). My images are all different sizes and i want them all to be centred. I have looked at alot of threads and cant figure it out.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved