ActionScript 3.0 :: Centering An Image?

Dec 3, 2011

I have a movieclip on the stage which has the dimensions 400x400.I currently load images,and add them to this component.Each image is a different size. At this moment in time, they are placed at position 0,0 within the movieclip container.Some of the code looks like

var data:XML;
var total:Number;
var url_list = new Array();[code]....

Is there anyway I could get the loaded images placed at the center of the movieclip container.I dont know if I have to do something like subtract the images width and height from the containers width and height, and then divide by 2?

View 3 Replies


Similar Posts:


ActionScript 2.0 :: Centering Image In The Xml Image Gallery?

Jan 30, 2007

did the tutorial on this site for an xml image gallery - it worked great... My question would be is there a way to accomodate for multiple image sizes that would allow the image displayed to be centered?

View 1 Replies

Centering A Background Image?

May 14, 2009

I'm told that the following chunk of script will center the stage on resize, but not knowing much of anything about actionscript,

myListener = new Object(); myListener .onResize = function () { ... } Stage.addListener( myListener ); // later ... Stage.removeListener( myListener );

View 5 Replies

Professional :: Centering Image On Stage

Dec 31, 2010

i've created a rotating banner with images and wanted to increase the stage size so i can put an opaque larger image in the background and have the other images rotate on top of it. when i made the stage larger i'm having difficulty selecting the other photos so i can center them back on the on the stage. i was able to get the first image centered but i only see the outline of the other images.

View 3 Replies

ActionScript 2.0 :: Centering A Loaded Image?

Jun 24, 2008

i am trying to get an empty movieclip to center after a jpg loads into it. the images load, but they don't center. my first attempt (using loadMovie) would read the size too quickly and would only center after a second click. i thought using a MovieClipLoader would work, but my leftEdge always returns 350. i'm getting a 0 value for _width.

on a related topic, i want to apply a DropShadowFilter to the same empty movieclip.i haven't tried it with the MovieClipLoader, but it didn't work using loadMovie. any ideas on that? if i have to, i can create a generic dropshadow and position and scale it accordingly, but again, i will need to be able to read the size and position of the empty movieclip.

Code:
var mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();[code]...

View 5 Replies

Actionscript 3 :: Centering An Image Inside A Loader

Mar 17, 2011

I'm developing an ActionScript 3.0 app for Blackberry Playbook. I have a Loader with a fixed size of 240x240px. The images that can be loaded inside are smaller or bigger than 240x240px, and also they aren't squared. I use this code to resize that images:

[Code]...

View 1 Replies

ActionScript 2.0 :: Centering A Loaded Image/Movie?

Apr 11, 2006

I am needing to load an external image (probably jpg) into a movie. I am using an empty movie clip, giving it an instance name and the code:

Code:
instance1.loadMovie("image.jpg");

What I also need to do is be able to either place that image in a specific location on the stage or just center it. Any advice you can give me on that?

I am attempting to do something like this: Use two movie clips. One is a holder that contains the second movie clip, which is where the image is actually being loaded. Then, I am using the following math:

Code:
instance1.isntance2.x - instance1._width/2 instance1.isntance2.y - instance1._width/2

Does this look like it would work? Is there anyway I can set instance1 to have a width that is equal to the size of the main movie (1024 x 768)?

View 12 Replies

ActionScript 2.0 :: Centering Image Within Resizing Frame?

Oct 2, 2003

Im having problems of centering my images dead center of my resizing frame.

heres the code:

// All the credits go to Gorlim from www.flashxpress.net
// You need 2 clips in the library: btn and fond
cmpt = 0; //handles depth to attach

[Code]....

View 4 Replies

ActionScript 2.0 :: Centering Image Loader Component

Dec 4, 2011

Im trying to use a Loader component to add images to my flash file externally because i need to use a single loader for multiple images of various sizes the centerpoint is forever changing the centerpoint is ALWAYS to top left (as seen in image) and i cant figure how to change it.Ive used the following actionscript 2 code which i would have assumed it would center it fine but its never truley centered.[code]

View 1 Replies

ActionScript 2.0 :: Centering Image On Scaling Flash File

Feb 4, 2011

I'm working on a fullscreen application that doesn't run flash on the browser. Running Flash player 10. When you open the file, I have fscommand to run fullscreen, the flash file is built at 1280 x 800, and I have an image (menu screen) that starts off the flash file. I'm trying to find a way to center the image to the native SCREEN resolution, not the flash resolution. Is that possible?

I have this code running on the menu MC:
onClipEvent(enterFrame){
this._x = Stage.width /2;
this._y = Stage.height /2;
}

I've tried other variations of this, and no luck. On my 1280x800 native resolution monitor, it's great. Tested it, and it works. However, if I run the same file on a 1920x1080 monitor, the image is on the lower right hand corner. Also, the image at the moment has a center anchor point, but I'm sure you realized by my simple code. Also, just escaping the fullscreen mode, and scaling the window also screws up the formula. So I'm not sure what I can do to make it dead center no matter the screen res, or size of window. The reason I need to do this, is also because there are times where I have to change the flash resolution, and I don't want to go into the image everytime to adjust the center.

View 1 Replies

ActionScript 2.0 :: Kirupa Photo Slideshow Tute - Centering Image?

Sep 11, 2006

I've been going through the tutorials and forum trying to build a photo slideshow. I managed to get the slideshow working with buttons, but am really stuck with trying to center the images ... I'm using portrait and lanscape images, and want them both to be vertically and horizontally centered in a 504x504 moive.

View 2 Replies

Actionscript 3 :: Flex4, Centering And Resizing A Image Inside A Group Container

Jan 21, 2010

I'm looking for the best way to get a flex 4 image object to resize and horizontally center whenever its parent container (a custom component based on group) resizes. I cannot set horizontalCenter="0" to accomplish the image centering because I use a move transition to "slide" the image in and out of view.

I'm externally setting the image source in the component. Here is a simplified example of my component code that only addresses resizing the image.

<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo" >


[Code].....

View 2 Replies

Actionscript 3.0 :: Centering Stage And Background Image Using Actionscript?

Jun 13, 2010

I did a website using actionscript 2 where the content was centered on the browser window both vertically and horizontally.

e.g. [URL]

all that took was a small piece of actionscript code that i can't remember now.

Now using actionscript 3, I can't find such code anywhere, instead I am guided towards using dreamweaver and css which seems like a nightmare for me to achieve. Such a fundamental thing should be possible with minimum effort surely?

Also, I have a similar problem where I'm trying to repeat tile or just add a textured background behind the stage. This also seems like I'm having to use html/css to achieve. I'd rather just use flash if possible??

View 1 Replies

Centering Stage In Cs3?

Sep 16, 2009

When I open a new document in flash, the stage is in the top left corner of my screen and I cannot figure how to center it in the middle. I cannot go to the left or above the stage which is making it very difficult to work with as I cannot access those areas.

View 1 Replies

ActionScript 2.0 :: Centering Until A Certain X Value?

Jun 25, 2008

I know theres probably a simple solution but it's escaping me at the moment.

I have a centered swf, I want it to stop centering if the swf reaches the side nav so they dont overlap.

function Center(mc) {
mc.onEnterFrame = function() {
if(mc._x >500){

[Code]....

this stops the centering when it hits 500, but it stops all centering because it's stuck on 500.

View 3 Replies

ActionScript 2.0 :: Centering Pop Up?

Oct 25, 2003

I have used the centering pop up technique, but my problem lies with the boreders. I'm using the pop ups for jpgs, but it seems to have a bit of a boreder at the top and the left of the image, how can I get rid of this. I used the tut on this site for centered popups. an example of my problem is on my site at [URL]..

View 4 Replies

ActionScript 3.0 :: Always Centering On The Stage

Jun 23, 2009

I have a movieClip that starts out a a specific scale. I then tween the images properties and as it tweens it also scales again. What I'm trying to do as it tweens and scales its obviously changes the width and height of the movieClip. So I'm trying to constantly keep the clips position in the center of the stage.

I'm using tweenMax and I tired an update event so I could keep checking the width and height of the clip as it scales and then using this code to center it but it doesn't seem to be centering the image. On other thing to note is my MovieClip is using its top left corner as the registration point.

[Code]....

View 1 Replies

ActionScript 3.0 :: Not Centering On Stage / Why

Oct 14, 2009

I've come across a new snag to a previous project. I'm not quite sure why, but when the full image is loaded to the stage, it is not centering it properly. The trace of fullLoader returns "0" for the width and height of the full-sized image, and I'm not quite sure how to pass the necessary information into the showPicture function so that it correctly centers the image. I tried tracing the content of fullLoader and got an error message.[code]

View 2 Replies

Actionscript 3.0 :: Centering The Swf In A Browser?

Feb 22, 2010

- How can I center my main SWF inside the browser without stretching the the swf? I just want it to be center both horizontal and vertical when you resize the browser.

- I found some tutorials but it is only referring to just ONE movieclip. What if I want to center the whole stage? Is there any other way to call the stage that has content in it?

View 1 Replies

ActionScript 2.0 :: Centering SWF In Browser?

Jul 8, 2004

I'm trying to center an swf in a browser without using table width and height 100% and the most promising way i've found so far is to set

Stage.scaleMode = "noscale";

in the first frame and then set the width and height of the object tag in the html to 100%. However, i'm having trouble getting this to work with the doctype in some newer browsers.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

[Code]....

View 3 Replies

ActionScript 2.0 :: Centering A CreateEmptyMovieClip?

Jun 16, 2005

this is what i have.- createEmptyMovieClip "hold"- hold.attachMovie("logo","logo",1)the problem is that when attaching the logo...it's not centered. how do i center it...i've tried _x and _y but Movie Clips seem to have different dimensions than the actual movie size.

View 4 Replies

ActionScript 2.0 :: Centering JPG's When Using LoadMovie

Jan 9, 2006

I have done some searching on my problem and found some discussion but no direct answer. I have a slide show flash movie that is using actionscript and loadMovie to load a set of jpgs in. My problem is the jpgs are various sizes and I need to have them centered in the movie clip they are loading to. Below is my actionscript. center the loading jpgs?

[Code]...

View 1 Replies

IDE :: Centering .swf On Html Page And More?

Mar 25, 2009

1. I have an .swf framework file that imports two other .swf files into itself to be viewed. The actionscript to import the other .swf files is as below. This works in firefox 3.0.5, but not in any other newer or older version of firefox, even if they have the latest, and same flashplayer 10 versions installed. It doesn't work in explorer either but in opera it works. I't doesn't matter if I use mac or PC. Why ? Is there something wrong with my actionscript ? For now the page with the imported .swfs just shows up empty.

var loader:MovieClipLoader = new MovieClipLoader();
var loadHandler:Object = new Object();
loader.addListener(loadHandler);[code].....

2. I've used a html template that use div tags to center content both horizontaly and verticaly in any browser.The centering works fine, but when I put in the code for embedding my framework .swf, it starts chewing alot before the .swf shows up. It's like something slows down the whole process.Sometimes I have to reload the page to make it show. Check out the website to see whats wrong. View the source code in any browser to see if I have made some misstake putting in the code for flash embedding...

View 4 Replies

ActionScript 3.0 :: Centering SWF In A Browser?

Feb 22, 2010

I have some questions about centerting your SWF inside a browser using actionscript 3.0.

- How can I center my main SWF inside the browser without stretching the the swf? I just want it to be center both horizontal and vertical when you resize the browser.

- I found some tutorials but it is only referring to just ONE movieclip. What if I want to center the whole stage? Is there any other way to call the stage that has content in it?

View 4 Replies

IDE :: Centering Preloader On Stage?

Jun 21, 2010

I'm heaving trouble centering the preloader on the center of the stage. The preloader is basically a rotating oval shape.

so, below is the code that for some reson puts the circle in the top left corner...

Code:
stop();
var circle:LoadCircle = new LoadCircle();
var circle_WIDTH:Number = circle.width;

[Code]....

meaning... the stage is not static, but it dynamically shrinks and expands to the size of the oval preloader...

how to make the stage "static" so that when I set the size in the document properties, centering an object in AS3 will stick to it?

View 2 Replies

ActionScript 2.0 :: Centering SWF In Browser

Jul 8, 2004

I'm trying to center an swf in a browser without using table width and height 100% and the most promising way i've found so far is to set Stage.scaleMode = "noscale";in the first frame and then set the width and height of the object tag in the html to 100%. However, i'm having trouble getting this to work with the doctype in some newer browsers.[code]

View 3 Replies

Centering Datagrid Text And Headers?

Jun 25, 2009

I've be messing around with Flash for a little while now and just recently starting trying to do a datagrid which is loaded from an XML file. Well I've gotten the XML to populate the datagrid. Everything is fine in that aspect but I cant seem to get my text to align properly in the datagrid. By default ofcourse everything is aligned Left. I would like align everything centered (the cells as well as the column Header.The code that I have basically creates the datagrid at runtime,

Note: I had found two other threads from a couple of years ago that said use the line below, but I've tried that line of code to no avail:

Code:
myDataGrid.getColumnAt(2).textAlign = "center";
HERE IS MY CODE:
Code:
import fl.controls.DataGrid;[code]....

View 1 Replies

ActionScript 3.0 :: Centering The Stage In A NativeWindow?

Aug 4, 2011

I'm having trouble with the positioning of objects within the NativeWindow. So my code below creates a NativeWindow, and then draws a rectangle and adds it to the stage of the NativeWindow. I can't seem to have the rectangle centered in the window. I've tryed playing with the stage scale mode, and align properties. By default the align should be center, but it doesn't appear to be the case. The rectangle seems to be drawn from somewhere between the center and top left of the window. I've also drawn a rectangle onto the main app window using identical code.

Code:

import flash.display.NativeWindowInitOptions;
import flash.display.NativeWindow;
var NWIO = new NativeWindowInitOptions();

[code]....

Left window is the main app, and the right window is the NativeWindow.

View 5 Replies

ActionScript 1/2 :: Centering A Pop-up Browser Window?

Jun 2, 2009

how to horizontally and vertically center a browser pop-up window in Flash? Below is the code tied to my Flash button:

on (release) { getURL("javascript:openNewWindow('http://www.blahblahblah.com','thewin','height=300,width=400,toolbar=no ,location=no,menubar=no,status=no,scrollbars=yes') ");}

[Code].....

View 13 Replies

Positioning (centering) An Externally Loading SWF

Aug 3, 2009

how to make it so that it is always centered horizontally in the middle of the browser window. I am having issues making it so that it is centered vertically between 150pixels from the top to the bottom. This will make it so that if the window is small the swf will be right at y=150 but if the window is large it will have equal spacing between the top(150) and the bottom of the window.

[Code]....

View 3 Replies







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