ActionScript 3 :: Centering Moving Object On Stage Resize

Nov 19, 2010

I want to center a big movieclip (1400 px wide) on my stage on stage resize. This big movieclip moves to the right on certain events so I can't use code like this:
currentPage.x = ((stage.stageWidth/2) - (currentPage.width/2))
Is there a way to maybe use its offset from 0 (the left side of the stage 'viewport') and use that offset in centering? The movieclip only changes in x.

View 2 Replies


Similar Posts:


Actionscript 3 :: Centering Objects On Stage And Auto-Scaling With Stage Resize

Oct 19, 2011

I'm writing a web based flash app that's written entirely in AS3. I have objects on the screen as part of a GUI. I would like the user to be able to resize the window, or make it full screen. I would like everything to auto-scale with the resize, but also remain in the same relative position on the stage.

View 1 Replies

ActionScript 2.0 :: XML Object (images) Centering On The Stage

Jan 2, 2010

I would like to call up images from myXML and I would like to center them on the stage. Each object is a different size therefore I can't place them to a set _x position. Hopefully someone may have the answer.... here's the function that will call up the firstimage:

function firstImage() {
if (loaded == filesize) {
var myHoriTween:Tween = new Tween(content_mc, "_x", normal, 0, 480, .75, true);
content_mc.loadMovie(image[0]+".jpg", 1);
content_mc_num();
}

The highlighted '480' is the number i would like to replace to center. I'm not being to vague with this request, otherwise i'll offer more information.

View 2 Replies

ActionScript 2.0 :: Centering Nested Object To Stage?

Jun 18, 2005

I have a picture of a mine which is nested within an object, nested within another object. Now what I want it that on the keypress of shift, I created mine image at the same position of the tank. The issue is that the main object that is nesting the mine moves, thus not creating at the the center, rather on that position of the object.

Here are how my images go by instance names;
1. Tank Stays in the center
//////
/////
1. Land (moves) -- 2b. map -- 3b. All objects that hitTest
|
2a. Objects
|
3b. All the objects that don't get hit (in here is mine.)

View 4 Replies

ActionScript 3.0 :: Stage Resize Event On Mouse Stop Moving?

Nov 13, 2009

I have a stage.addEventListener(Event.RESIZE, resizeHandler); that I would like to perform the repositioning of the objects when the user stops resizing the browser window. I imagine I need to use a mouse move listener, but how do I check to see if the mouse has stopped moving in the resizeHandler?

View 1 Replies

ActionScript 3.0 :: Moving An Object Around The Stage

Apr 28, 2011

i'm trying to use code so if i type in -10 to 10 the object will move up or down the y axis. The code i'm using at the moment calculates how far to move it from the number inputed, then it removes te object and places it in the required position. However doing the removeChild technique messes up when having many on the stage. I was wondering if anyone knew a way of calculating the rating and then using it to move the object on the stage without removing it and adding it. Here is the code i'm using to move it. OR a way in which i can remove certain objects on the stage using remove child

[Code]....

View 3 Replies

ActionScript 3.0 :: Moving An Array Of Object Across The Stage

Jun 30, 2010

I have MovieClips in the library that are instantiated and loaded to an array. From that array I want to add them to the stage and move them across one by one at specific intervals. I've chosen not to use a tween because it acted finicky and the MCs get stuck for whatever reason. So I've taken a different approach by changing the x coordinate of the individual MC with a timer to make it move (sort of like a particle system.) The problem is that each one needs to be assigned it's own timer function. As of right now every time the timer fires it just resets to the next item in the array and nothing moves. The only solution I can think of is to write an individual timer function for all 18. This seem impractical and there has to be a better way. I guess idealy I would need a function that can write a new function for each array item but I have no idea how to do that. Here's some of my code:

var myTimer:Timer = new Timer(4000);
var moveTimer:Timer;
myTimer.start();

[Code]....

View 1 Replies

Actionscript 3.0 :: Centering Mc On Browser Resize?

Mar 24, 2011

I am working on a flash website which needs to be fluid layout. The background image is resizingperfectly fine when the browser is re-sized.I have also managed to make the logo centre on re-size. My problem is with the two other movie clips which both have other mc inside.My content is residing inside a movie clip called "content_mc" inside the content_mc I have other movie clips with AS. I have tried using the same line of AS I used to centre the logo on "x" but the content disappears of the screen on run time!I thought maybe I am doing something wrong in the math. Note my content_mc it is positioned at x= -1620 and y= 270 W= 900 H= 7412. Here is the AS I use to resize the bg img and to centre the logo_mc

Code: Select all// background image resize..//
function init()
{

[code]....

View 9 Replies

ActionScript 2.0 :: OnEnterFrame - Moving Object On Stage And Change Direction

Mar 22, 2006

I'm trying to set up a script which would force an object to move through the stage until a particular point and than change direction. I wrote something like that:

onClipEvent (enterFrame) {
moveUp = function () {
this._y -= 1;
if (this._y<-30) {
this.onEnterFrame = moveDown;
}};
moveDown = function () {
this._y += 1;
if (this._y>600) {
this.onEnterFrame = moveUp;
}};
this.onEnterFrame = moveUp;
}

But it doesn't work. the object moves only one direction and does not change it.

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

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

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 3.0 :: Centering 3D Objects On Stage?

Feb 8, 2010

I am new to working with 3D in Flash CS4. My project has a center-registered movie clip with a z-axis setting of 850 that I need to keep centered on the stage at all times, including when the stage is re-sized.ode like this for centering 2D objects doesn't seem to work:[code]

View 5 Replies

ActionScript 3.0 :: MovieClip Centering On Stage Using Event

Feb 20, 2012

I have a website made with flash and I have added all the pages inside a movieclip and this moviclip is centered in the stage using event. Resize and event.Enterframe. But now the problem is..although the gallery (which is an external swf) is inside this movieclip it doesn't stick to this stage.rezise event. How can I control this gallery.

View 1 Replies

ActionScript 2.0 :: Centering MovieClip On Stage Automatically?

Oct 21, 2004

How do a make a center a mc automaticly on the stage with aS. The script should detect what the stage size is and move the mc to the middle. I am making smartclip-preloader and want to be as productive as possible later on.

View 4 Replies

ActionScript 2.0 :: Centering In Browser Window Using Stage Class?

Dec 10, 2006

having some problems with having my mc's always center in t5he middle of the browser window even when it resizes??

Cheers all,
basically the code i'm using is this:
_root.abc.Stage.width/2;

[code].....

View 1 Replies

ActionScript 2.0 :: Centering Nested Movie Clips To Stage?

Aug 16, 2007

I'm currently working in Flash 8 with Actionscript 2.0.

I've been trying different alternatives and none of them are working. I've even posted here previously and tried a few things but I haven't quite resolved my centering to stage problem. Some of you may have already read pieces of this from another post.

I have a landscape that functions sort of like a 360 vr tour. The main movie clip directly on the stage is labeled, "mainMovie", and within it is another movieclip labeled, "singleStrip".

To simulate the 360 vr tour, there's script inside, "mainMovie" to duplicate "singleStrip". Also, inside the "singleStrip" movie clip, I have different elements appearing through the landscape, in this case, we'll use letters as an example. The letters A - Z are sitting on the landscape throughout the entire "singleStrip" movie clip.

Everything rotates fine with the script that's placed some sensitive area movie clips that are placed on the root level. When you place your mouse pointer to the left edge of the stage, the landscape shifts left, when you move the mouse pointer to the right edge, the landscape shifts right, (or vice versa, I can't remember).

The problem I'm having is for the letters that are in view on the stage, I want the user to be able to "click" on them and then that letter zoom up to the center of the stage, (through the "x" coordinate). I'm having difficulty with this since the letter movieclips, (example, "letterA"), are within the "singleStrip" movie clip, which sits inside the "mainMovie" movie clip, which are both constantly moving and their x position continues to change.

I've been using the tween class in order to animate them with easing and it's usually the "endx" variable that I'm having trouble because I don't know how I can match it up to the center of the stage, whether it's a "endx = stage.width._x /2; " or something else. Here's an example of some of the [code]...

View 2 Replies

ActionScript 2.0 :: Centering An Object In Movie

Dec 21, 2009

Im having a problem with centering an object in my movie. When it loads in flash player, there is no problem. But when it opens in the internet browser the movie clip isn't centered and once I go to re size the Internet browser, the code starts to work and centers the movie clip from stage.[code]

View 4 Replies

ActionScript 2.0 :: Creating Comic - Centering Smaller Frames On Stage

Apr 30, 2009

My problem should be simple but I'm still having trouble. I am making a comic that appears on screen one frame at a time based off of on of the first flash tutorials that come with the program. It allows the user to click a button to move to the next frame. My problem is that the smaller frames need to be centered on the stage.

Here is the code I have so far
/* 0 */
var image0title:String = "Dr. Berg's Clinic. 1 of 4";
var image0uri:String = "images/Berg_frame_1.jpg";
/* 1 */
var image1title:String = "Dr. Berg's Clinic. 2 of 4";
var image1uri:String = "images/Berg_frame_2.jpg";
[Code] .....

My stage is set at a height of 350 px and a width of 500 px and the largest image is a height of 319 px and width of 500 px (the remaining 31 px are where I put the description and the button). The smaller images are a height of 319 px and a width of 166px and need to be centered.

View 4 Replies

Vertically Centering Flash Movie In Browser With Stage.scaleMode?

Oct 30, 2009

I have this flash website where i use Stage.scaleMode to dynamically resize the swf depending on the browser size. (i use A.script 2.0). So the width takes the whole screen and the height is scaled in proportion. My design is in a landscape format. It works fine, except that i need the swf to also be vertically centered in the browser Window. (explanantion - on certain screens, example a 19 inch PC monitor which is quite "squared", my flash movie expands the whole way across the width, and the height in proportion, but as my design is in landscape, i have a big empty space in the browser below the swf.)
 
This is how it is:    This is how it should be:

Here is the code:
 
stop();
Stage.scaleMode = "noScale"
Stage.align = "TL";

[Code].....

View 1 Replies

ActionScript 3.0 :: Centering Object When Resizing Window?

Aug 1, 2010

I've been playing around with a code that keeps a specific object on the center of the movie when the window is re-sized. It works well but here is the issue: I don't want the object to be centered at the very center of the window but on a specific x,y coordinate. How can I modify this code to assign an x,y coordinate so that the object will be "centered" in reference to that coordinate?

Next, is the code. "centerlogo" is the object to be centered and "backgroundImage" is as the name implies the background. I know that what i ask has to do with the part under the "//center content" comment

function init()
{
stage.align=StageAlign.TOP_LEFT;
stage.scaleMode=StageScaleMode.NO_SCALE;

[Code]....

View 5 Replies

ActionScript 2.0 :: Browser Dependent Object Centering?

Mar 4, 2007

I seen alot in many sites. Full screen flash site with objects in the site centering or their predestined position as browser scales.

View 3 Replies

ActionScript 2.0 :: Position A Movieclip In The Middle Of The Stage Even If The Stage Or Window Resize?

Feb 27, 2006

i saw a thread while ago .. that always position a movieclip in the middle of the stage even if the stage or window resize any1 can point me to it

View 3 Replies

ActionScript 2.0 :: Adjusting Columns And Rows On Stage Resize, According To Stage.width?

May 10, 2008

When you resize the browser window the thumbnails rows and columns adjust accordingly to fit.I've managed to attach the thumbnails correct when my enableButtons() function is called but i'm unsure how to approach resizing.

Stage.align = "TL";
var numberOfGalleries:Number = 20;
var thumbMarginX:Number = 163;
var thumbMarginY:Number = 109;

[Code].....

View 1 Replies

ActionScript 3.0 :: Can't Get Stage Resize Listener To Resize Movieclips In "main" Swf

Sep 9, 2009

I've got a large bitmap (1920 x1306) that my client wants as a bg image, scaled to the swf size on load (930 x 575); but that can "grow" up to its original size if/when a user expands the browser window. All the rest of clips in the display list are to remain in place (except for a copyright clip, which they want to always be 14 pix above the bottom of the browser frame. I've tried loading the bitmap dynamically at full size and then using scaleX,scaleY to set it's initial smaller (930x575) size, and I've tried just setting the height/width of the dynamically loaded image using the math of scaleX,ScaleY just in case the scaleX "transformed" the bitmap so that it couldn't return to its original size.  Both make the bitmap the right size. But the resize function below did  nothing to it, (or the copyright.y.) THEN I tried just putting the bitmap into the display list (both sizing methods work here, too). But even as an original member of the compiled display list, the resize event is still not reaching the target. Everything I've seen on the web says this should work - but...no luck.
 
Here's the AS3 code in the 1st frame of my swf:
 
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageScaleMode;

[Code]......

View 1 Replies

ActionScript 2.0 :: Moving Symbols On Resize / Blurry Edges?

Mar 6, 2007

Is there a way that during a browser resize and my symbol gets repositioned, it wont become blurry? As in perhaps a way so that it doesn't include the decimals in the new position/rounds up or down?

View 3 Replies

ActionScript 3.0 :: Moving Vehicle On The Stage, Which Should Change Directions According To Where Click On The Stage?

Oct 24, 2010

I have a moving vehicle on the stage, which should change directions according to where I click on the stage.I already made it work using this formula:var angle:Number = Math.atan2(dy,dx)*180/Math.PI+90;However, I need the car to tween to the correct angle, instead of just "jumping" to it. While this is easy enough to do, the car sometimes takes the longer turn (especially when I click in the bottom-left quarter of the stage), and it seems unnatural.

View 0 Replies







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