Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Keeping The Stage Centered



i m using this script var stageListener:Object = new Object ();stageListener.onResize = function (){ stageSize_txt.text = "Stage.width:" + Stage.width + " Stage.height:" + Stage.height; // position mc's tl_mc._x = tl_mc._y = 0; tr_mc._x = Stage.width - tr_mc._width; tr_mc._y = 0; bl_mc._x = 0; bl_mc._y = Stage.height - bl_mc._height; br_mc._x = Stage.width - br_mc._width; br_mc._y = Stage.height - br_mc._height;};Stage.scaleMode = "noScale";Stage.align = "TL";Stage.addListener (stageListener);// call resize functionstageListener.onResize();in a full screen flash page, to keep some mc in the corners of the browser. and now my stage doesn't stay centered anymore. if i change Stage.align = "TL"; to Stage.align = "MC"; the stage will center itself, but the mc from the corners move with it to.can it be done?please help again



KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 08-16-2005, 08:10 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Keeping It Centered....
I'm working with a table and I want it to always stay at the center of the html page. How can i do that?

If I'm changeing the size of the window the table should still remain in the center.

Keeping MC Centered
i have figured out how to get a background image in my flash movie to scale and cover the whole browser window, now i need to figure out how to keep the main content and navigation to stay centered and at a consistent scale like here:

http://www.animallogic.com

see how the nav stays the same size and in the middle ? any tips on this would be helpful. thanks.

Keeping A MC Centered..?
I'm making a car-driving game but I can't get the map to scroll the way I want it to.

This is my problem:
I'm looking for a script to center the car MC,
so that if it turns left 90 degrees you go to the left (the map doesn't rotate, but the car do, making the map scroll depending on where the car is)...
Hope you understand.

I have tried anything I can come up with, but I'm not good at actionscript.

Keeping Tweens Centered
OK, this is hard to describe sobear with me-
I'm tweening a shape- a triangle / ,with angles like this.

It's a lighthouse beam.
I am tweening it to rotate around the house.
My problem is that when I tween it to be wider, and to rotate, the center of the shape shifts, because I am actually skewing the shape. (To allow for perspective, etc.)
How do I keep the center point of the vector shape from shifting during this tween?
Ack! (And it's due by Wed.!)

Thanks!!!!!!

Keeping Things Centered?
Let's say you have a Flash movie that contains a button, for example, and that said movie is taller and/or wider than a given browser window. Is it possible to fix the button's position relative to the top/bottom/sides of the browser window, such that the button appears to remain stationary even if the browser window is resized or scrolled up/down or side to side? If so, how can this best be done?

Any help would be greatly appreciated.

Thanks,
The Raven.

Keeping Centered While Scaling
I'm trying to scale up some letters in a text, but I also want to keep them exactly centered in the middle of the screen. Is there a better way to do this than simply to adjust the y-coordinate in some crude fashion as the scale grows larger such as I am doing below? It seems that every letter might have to be individually adjusted based on its specific size etc.

(excerpt of relevant code)
(mc.y is the y-location of the lower-left part of the text on the screen)

function createAllText(textList) {
    for(var i=0;i<textList.length;i++) {
    
        // create movie clip
        mc = createText(i,textList[i]);
        
        // set location
        mc._x = 100;
        mc._y = 100;
        
        // set scale to 0
        mc._xscale = 0;
        mc._yscale = 0;
        
        // set scale var to negative amount
        mc.scale = 0-i*250;
    }
}

function init() {
    // create array of text
    var words = "LovePeaceDestinyLlamasFate Rocks";
    var textList = words.split("");

    // create AT movie clips
    createAllText(textList);
}

function moveText() {
    // loop through words
    for(var i=0;i<numWords;i++) {
        
        // increase the scale
        mc = this["text"+i];
        mc.scale += 10;
            
        mc._xscale = mc.scale;
        mc._yscale = mc.scale;
        mc._y += 1;
    }
}



Keeping Character On Stage Plus Keeping Moving Background With Character On Stage
Im in the process of creating a superman game.. and i right now have him in walking mode .. i created him which is superman_mc . which has his waking animations etc.. inside and i have created a background mc which is level1_mc which basicly moves along with superman as he walks. .the problem i am getting is keeping the back ground from moving off the stage and superman from going off the stage i can keep superman on the stage and in one place on the stage with the code i have now but the background still moves off.. here is the code i have :
stop();
//Superman walk & flying movements
fly = "off";
_root.onEnterframe = function() {
if (Key.isDown(70)) {
_root.superman_mc.gotoAndPlay(4);
_root.superman_mc._y -= 17;
fly = "on";
}
if (_root.superman_mc, hitTest(_root.right_mc)) {
_root.superman_mc._x = 700;
}
//moves superman right
if (Key.isDown(39) & fly == "off") {
_root.superman_mc.gotoAndPlay(3);
_root.superman_mc._x += 17;
_root.level1_mc._x -= 17;
direction = "center";
//makes superman face foward
} else if (direction == "center") {
_root.superman_mc.gotoAndStop(1);
}
//moves superman left
if (Key.isDown(37) & fly == "off") {
_root.superman_mc.gotoAndPlay(2);
_root.superman_mc._x -= 17;
_root.level1_mc._x += 17;
direction = "left";
} else if (direction == "left") {
_root.superman_mc.gotoAndStop(1);
}
};
whats happening is that the background keeps going but since i have it setup to move along with superman .. if anyone can help thank you alot..

-rob-

Keeping Character On Stage Plus Keeping Moving Background With Character On Stage
Im in the process of creating a superman game.. and i right now have him in walking mode .. i created him which is superman_mc . which has his waking animations etc.. inside and i have created a background mc which is level1_mc which basicly moves along with superman as he walks. .the problem i am getting is keeping the back ground from moving off the stage and superman from going off the stage i can keep superman on the stage and in one place on the stage with the code i have now but the background still moves off.. here is the code i have :
stop();
//Superman walk & flying movements
fly = "off";
_root.onEnterframe = function() {
if (Key.isDown(70)) {
_root.superman_mc.gotoAndPlay(4);
_root.superman_mc._y -= 17;
fly = "on";
}
if (_root.superman_mc, hitTest(_root.right_mc)) {
_root.superman_mc._x = 700;
}
//moves superman right
if (Key.isDown(39) & fly == "off") {
_root.superman_mc.gotoAndPlay(3);
_root.superman_mc._x += 17;
_root.level1_mc._x -= 17;
direction = "center";
//makes superman face foward
} else if (direction == "center") {
_root.superman_mc.gotoAndStop(1);
}
//moves superman left
if (Key.isDown(37) & fly == "off") {
_root.superman_mc.gotoAndPlay(2);
_root.superman_mc._x -= 17;
_root.level1_mc._x += 17;
direction = "left";
} else if (direction == "left") {
_root.superman_mc.gotoAndStop(1);
}
};
whats happening is that the background keeps going but since i have it setup to move along with superman .. if anyone can help thank you alot..

-rob-

[F8] Zooming In On A Map > Keeping Image Centered?
Hi guys, gals, and others,

This is driving me insane!

I'm building a little flash app - a scrolling, zoomable map. I've got the file to load in variables from an XML file, I've got the scrolling working, and I've got a failsafe function to stop the image going off the edge of the screen - but the zooming part has got me stumped.

I'm not really much good at math, and I think this is where my problem comes in. I can get the image to zoom in and out to a certain level without leaving the confines of the viewport/stage, but the containing mc's registration point is in the top-left, and this is where the movie's scaling from.

I know what I need to do, I just can't seem to write the code to do it - I need the x and y position of the clip to move in sync with the scaling. For example, say there's a box in the middle of the screen at the smallest zoom level - when the user zooms in, I'd like the box to stay centred on the screen.

Any ideas? I'm at my wits' end!

Keeping A Flash Movie Centered In A HTML Page?
First of all, Hello everyone!

I know this probably sounds silly, but how does one do to have a flash movie that spans the browser window size (both height and width) so that i have the whole browser window usable as a flash movie in order to allow the visitors to open up several popUps and move them around.

I have tried to do this by making the movie as big as the screen resolution i'm working at, but when the window is resized it all gets off centered.

I've seen sites where the window can be resized and the flash movie seems to adapt its size (not by resizing) by "managing the transparent" area and keeing the "important stuff" centered?

Well i hope u understand what i mean...

Thnx in advance.

P.S. - I got tricked into doing a website in flash without knowing how to do more that have a circle move around... :'(

Keeping The MC On To The Stage.
I have the actionScript for an MC to move around using the arrow keys but it can move off the screen. Is there any script to keep the MC on the screen?

Keeping Mc On Stage
o.k. my last post was way too confusing

I am trying to have an image that is controlled by the mouse and increases in size as the user steers around the pic. The problem I am having (one of em) is that the mc is not confined to the stage

I am trying to have the action scripts control the mouse movement and use tweens for the resize. The reason I am doing it this way is because when the image reaches a certain size I want a new image to fade in and then be controlled by the mouse in the same way. I am sure this can all be done through scripting but I have no idea how.

hmmm.. i think that is just as confusing

here is the source if anyone wants to help me out:

http://www.folkphotography.com/index...testflight.fla

Thanks to anyone for any help.. I am so close to finishing this project.. just got to get this licked

here is the code I am using


onClipEvent (load) {
// This code assures that the movie clip has larger width and height dimensions than the Stage does
// It scales up the movie clip proportionally until BOTH its width and height are larger than the stage
while (this._width<Stage.width || this._height<Stage.height) {
this._xscale += 1;
this._yscale += 1;
}

}
// end onClipEvent(load)
onClipEvent (enterFrame) {
// Use this variable to set a maximum "speed limit" for the motion
maxSpeed = 20;
// Use this number to adjust the overall "responsiveness" (speed) of the motion
speedMultiplier = .05;
//
// First, we calculate the target position for the clip.
// The target postition is based mainly on the (x,y) position of the
// mouse on the stage, but it also takes into account the dimensions of this movie clip.
//
targetPositionX = -1*(_root._xmouse/Stage.width)*(this._width-Stage.width);
targetPositionY = -1*(_root._ymouse/Stage.height)*(this._height-Stage.height);
// Next we calculate the distance from the targetPosition(s)
distanceFromTargetX = Math.abs(this._x)-Math.abs(targetPositionX);
distanceFromTargetY = Math.abs(this._y)-Math.abs(targetPositionY);
//
// Then we calculate the "speed" at which the movie clip will move. This is actually
// calculating the distance (in pixels) that the movie clip will move this frame.
//
speedX = (distanceFromTargetX*speedMultiplier);
speedY = (distanceFromTargetY*speedMultiplier);
// Reinforce the speed limit with these two if conditionals
if (speedX>maxSpeed) {
speedX = maxSpeed;
}
if (speedY>maxSpeed) {
speedY = maxSpeed;
}
//
// Then we actually move this movie clip based on the following logic:
// "If this movie clip is not already at its target position, then move
// it toward the target position by speedX and speedY calculated above."
//
if (this._x != targetPositionX) {
this._x += speedX;
}
if (this._y != targetPositionY) {
this._y += speedY;
}

//
// Finally, the following code will make sure the movie clip always fills the stage.
//
if (this._x>0) {
this._x = 0;
}
if (this._y>0) {
this._y = 0;
}
if (this._x+this._width<Stage.width) {
this._x = this._width+Stage.width;
}
if (this._y+this._height<Stage.height) {
this._y = this._height-Stage.width;
}
// This statement helps make the animation smoother under certain conditions.
updateAfterEvent();
}
// End onClipEvent(enterFrame)

Load Swf Into Stage - But Centered How?
i want to load a swf file (gallery images) to a target placeholder mc.
the loaded mc is defaultly always TopLeft alligned. how can i center the clip?
(so that the gallery images are always centered on the stage)

New Symbols Always Centered On Stage
Hi,

This is probably something simple but its driving me nuts. Its an authoring mode preference problem (me thinks).

I'm working on a 1024 X 768 project and when I'm working on the stage on the main timeline I keep the rulers showing and 0,0 is near the top left and I can easily scroll over or hand grab over to the right side in the 1024 area. Everything is fine.

But when I create a new movie clip (F8) the stage is centered with 0,0 in the center and working area of about 1400 X 1400 pixels. So on the ruler the x -axis goes from about -700 to + 700. The problem is that I can't scroll or hand grab the stage and move it over.

Like I say, its driving me nuts. Anyone know how I can reset this?

Thanks,
Randy

Papervision 3D: Does It Have To Be Centered On Stage?
I followed the cube tutorial as an intro to papervision and i've gone through the documentation but i can't find anything to indicate that the 3D object can be placed anywhere on the stage except dead center. is this true? if not, how can i do it?

Keeping Draggable Mc On Stage
I have a movieclip that is draggable, scalable, and rotatable. i want the user to be able to dragg the movieclip to any position as long as it stays completely on the stage. all works fine using the constraints of x and y in startdrag as long asthe image isn't scaled or rotated. but if it is either then the constraints are based uopn the original orientation and size. so if the MC is scaled up and then dragged part of it will go off screen, or if it is scaled down i end up with a gap. any thoughts? i tried putting little pixel sized MCs on the corner and then hittesting them on a pixel sized border, but that failed, and i tried taking a snapshot of the mc in its current status and testing that but it didn't seem to work either. it still records the original size and rotation

how do i test based upon current size, and rotation

Keeping A Window A Certain % From 0,0 Of Stage
Hey guys,
I'm working on a full screen flash site with a floating content window and a menu bar. You can see what I have so far at
http://ostari.com/ronnie/point1

Now you notice when you resize the window just stays in the top left. That is ok however what I would like to see is the window float a certain percent from 0,0 of the stage. I say this because If the users resolution is big, the window seems kind of far from the menu, but say they have 1024x768 they are relatively close. Maybe I am going about this the wrong way, but basically I just would like to see the window and menu bar closer together the bigger resolution they have. Thanks.
-Ronnie

Keeping A Window A Certain % From 0,0 Of Stage
Hey guys,
I'm working on a full screen flash site with a floating content window and a menu bar. You can see what I have so far at
http://ostari.com/ronnie/point1

Now you notice when you resize the window just stays in the top left. That is ok however what I would like to see is the window float a certain percent from 0,0 of the stage. I say this because If the users resolution is big, the window seems kind of far from the menu, but say they have 1024x768 they are relatively close. Maybe I am going about this the wrong way, but basically I just would like to see the window and menu bar closer together the bigger resolution they have. Thanks.
-Ronnie

Keeping An Object Coving The Stage
Any help on this would be greatly appreciated. I have an object that is serving as a background for a flash website. The background object (a table) moves and rotates around when clicked, exposing different parts of the table on the stage when the user clicks.
Here is the site so far:
http://www.personal.psu.edu/jwc5062/

My problem is when i want to transition between two points on the table, the table has to rotate and move.. and by just using a motion tween between the two points results in the table rotating off the stage for a few frames (thus exposing the background and making it look really cheezy). I was trying my hand at using motion guides, but can't do it with any accuracy.

So, my question is: Is there a way to guide an object as it rotates and moves so that it doesn't move off screen? (there is plenty of room on the table if i can just guide its path through the 2 second transition). Thanks for any support.

Keeping An Object Only On The Stage And Only Controling It There...?
If you check out this http://www.zen57616.zen.co.uk/excession/ (its a demo, yes I know frames are bad etc)...I have a little sliding bar which moves with the mouse on the menu, however if you click off the movie area on any part of the website it will follow the mouse presses. This could be very anoying for people so is there any way to make sure it is only controlable on the stage area?



Sorry if thats badly explained.

Keeping Randomly Placed Objects Within The Stage
Hello,

I am placing 10 movie clips randomly within the stage using this simple script:


Code:

for(i=0; i<10; i++) {
var t = this.attachMovie("imgs","imgs"+i,i);
t.cacheAsBitmap = true;
t._x = Stage.width*Math.random(550);
t._y = Stage.height*Math.random(450);
t.onRollOver = function(){
this.swapDepths(this._parent.getNextHighestDepth());
}
}
What I am trying to figure out is how to keep all the objects contained within the stage bondaries. Right now some of them are going off screen when they are placed, and this looks goofy when placed in the HTML page I am creating.

Any ideas on keeping them contained in an area so the edges are all within said area?

thanks,
jsm_

**why Sliding Puzzle Won't Centered In The Middle Of The Stage?
Hey there,

I am working on a sliding puzzle. It is working fine on a 270 by 270 stage (canvas). But when I change the size of the stage to 550 x 400 it is not working when I try to center all the puzzle pieces to the center of the stage. The pieces jump into the previous original position (before I changed the size) which is on the top left side of the stage.

My pieces are 54x54 pixels. I have 15 pieces. 4 rows (4 pieces on the first three rows and 3 on the last one). Each piece is called cow with a number added. For example: cow1, cow2, cow3.. all way to cow15.

Overall, I only have two scripts in this project. One in the first frame and another one assigned to a movie clip called actions. The script below is the script in the first frame. I believe the problem is at the first two parts of the script which is as follows:

**Note: I've also tried puting "tileDist=_root.cow15.width" but it isn't working either.

function initGame () {
// set the horizontal and vertical distance
// between tiles
tileDist = _root.cow._width;

// set all tiles in exactly the right spot
for (x=1;x<=4;x++) {
for (y=0;y<=3;y++) {
tile = x+y*4;
_root["cow"+tile]._x = x*tileDist;
_root["cow"+tile]._y = y*tileDist+tileDist;
}
}

Multiple Images Centered Vertically On Stage
I have seen this other places and I wanted to know how it is done... I have a few rows of images and I want to center them on the page with a seperator they are pulled in dynamically from an xml list how can I get them vertically positioned on the stage?

Thanks ahead
Azteroth

Keeping An Attached MC Position Relative To Stage
Keeping an attached MC position relative to Stage even if _parent clip is scrolled?
I'm revising my original question with some of my AS. I'm using Laco tween prototype if anyone gets confused with some of this ...I've commented the AS below with what MCs I want positioned relative to the stage.

///beginAS
for(i=1;i<12;i++){
var iconX=Stage.height/2
var iconY=Stage.width/2
var itemNumber=1
thisItem="item"+i;
this["box"+i].onPress= function(){
trace(boxCount)
blueprints.centerHolder.alphaTo(100,.3);
//The attached MC below are what I want to stay centered to the stage, but only before they are clicked. It's parent MC can be moved Left/Right/Up/Down using scripted buttons, so I don't want the attached MCs moved with it
blueprints.attachMovie(this.thisItem,"box"+itemNumber,boxCount,{_x:iconX,_y:iconY});

onEnterFrame = function(){

if(moveThisDown){blueprints._y-=5;blueprints.centerHolder._y+=5}
if(moveThisUp){blueprints._y+=5;blueprints.centerHolder._y-=5}
if(moveThisLeft){blueprints._x-=5;blueprints.centerHolder._x+=5}
if(moveThisRight){blueprints._x+=5;blueprints.centerHolder._x-=5}
if(rotateThisRight){selectedMCFull._rotation+=5;}
if(rotateThisLeft){selectedMCFull._rotation-=5;}
if(zoomThisIn){blueprints._width+=blueprints._width/100;blueprints._height+=blueprints._height/100;}
if(zoomThisOut){blueprints._width-=blueprints._width/100;blueprints._height-=blueprints._height/100;}
if (defaultThisZoom){blueprints.scaleTo(100,.8,"easeOut")
}
}

blueprints["box"+itemNumber].thisIsSelected="false";
blueprints["box"+itemNumber].alphaTo(100,0);
blueprints["box"+itemNumber].scaleTo(150,0);
blueprints["box"+itemNumber].scaleTo(100,.6,"easeOutBack");
blueprints["box"+itemNumber].nums.thisNumber.text=itemNumber;
blueprints["box"+itemNumber].onEnterFrame = function(){
blueprints["box"+itemNumber]._x=Stage.height/2
blueprints["box"+itemNumber]._x=Stage.width/2
}
blueprints["box"+itemNumber].onPress = function(){
this.swapDepths(boxCount);
selectedMC = this.main;
selectedMCFull = this;
this.startDrag(true);
this.main.alphaTo(100,.5);
this.num.alphaTo(100,.5);
this.nums.scaleTo(100,.2,"easeOutBack");
this.main.scaleTo(100,.2,"easeOutBack");
}
blueprints["box"+itemNumber].onRelease = function(){
this.thisIsSelected="true";
blueprints.centerHolder.alphaTo(0,.8);
this.stopDrag();
this.main.alphaTo(85,.5);
this.nums.alphaTo(100,.5);
this.nums.scaleTo(100,.2,"easeOutBack");
this.main.scaleTo(80,.4,"easeOutBack");
boxCount++;

}

}
this["box"+i].onRelease= function(){
itemNumber++
}

}

// end AS

Hopefully the code is readable ...thanks guys. If anyone needs the FLA to review, please email me at bryan AT bleedingtree.com or MSN Messenger with the same address.

Kirupa Picture Gallery / Keeping The Image On Stage As New Image Loads
Hi, I have the Kirupa Image Gallery implemented and it works great. But I was wondering how I can go about having the image stay on screen as it is loading the next image, so it's not such an abrupt transition. Currently the image container goes blank as it loads the next image. I assume I will need another image movieclip that sits underneath the first one... but then what?

Thanks!

Keeping The Center Of The Stage In The Center Of A Web Browser
Hey,

I have a really wide flash page, but the main portion of it is in the center
of the .swf. My question is how do I make the center of my .swf in the center
of a web browser so that when the user resizes the browser, the center of the stage stays in the center of the browser? Right now it has the left side of the .swf aligned with the
left edge of the browser so the center of my .swf is usually being cut off by
the right edge of the browser and users have to scroll to the right to see the
main portion of the site...I'm sorry if that's somewhat confusing, but any help
at all would be appreciated. Thanks!

Dave

Centered Xml Images / Centered OnResize
I am loading xml images, while also trying to center them onResize.

In this tutorial: http://www.kirupa.com/developer/mx20...otogallery.htm the images are all the same size, are being loaded into a static movieclip, and are aligned to the Top Left corner.

What I am trying to do is load different size images into a movie clip which stays centered on resize (i'm making a fullscreen flash site), while also loading each individual image centered within that clip (instead of the default top left).

Here is the code I am using for postioning the MC onResize:


Code:
mainInit();
function mainInit() {
// Set alignment and scale to allow onResize to work.
//Stage.align = "LT";
//Stage.scaleMode = "noScale";
// Create the title clip.
this.attachMovie("picture", "picture", 10);
// Keeps the title clip in place when the movie is resized.
picture.onResize = function() {
this._y = Stage.height-(picture._height/2);
this._x = Stage.width-(picture._width/2);
};
// Register titleClip to be notified when movie is resized.
Stage.addListener(picture);
// Set initial position of title clip.
this.picture.onResize();
}
I tested the following code (given to me by 'The Canadian' - thanks!) - within the xml onload function using that tutorial and it would not work with the first image, and seemed to only work properly 90% of the time:



Code:
picture._x = (Stage.width / 2) - (picture._width / 2);
picture._y = (Stage.height / 2) - (picture._height / 2);
...So, my question is does anyone know how to load center aligned variable size images, while also calling the movieclip to center onResize. I have tried everything I can think of and cannot get it working properly...

Unhappy Adjusting Columns And Rows On Stage Resize, According To Stage.width.
Hey fello flashers,

what i'm trying to achieve can be seen here, at the FWA's website.

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.

if anyone has encounted this problem before or can help, then pls do i'm a little confounded on this one.

thanks
cam

Stage.align = "TL";

var numberOfGalleries:Number = 20;
var thumbMarginX:Number = 163;
var thumbMarginY:Number = 109;

function init():Void {
enableButtons(numberOfGalleries);
resizeStage();
}

function enableButtons(numberOfGalleries:Number):Void {
currentRow = 0;
currentColumn = 0;
for (i=0; i<numberOfGalleries; i++) {
tracker = i;
thumbsDisplayer = this.createEmptyMovieClip("thumbsDisplayer_mc", this.getNextHighestDepth());
currentThumbnail = thumbsDisplayer.attachMovie("thumbnail holder", "thumbnail"+(tracker+1), thumbsDisplayer.getNextHighestDepth());

currentThumbnail._x = currentColumn*thumbMarginX;
currentThumbnail._y = currentRow*thumbMarginY;
currentColumn++;
if (currentThumbnail._x>(Stage.width-(currentThumbnail._width + thumbMarginX))) {
currentRow++;
currentColumn = 0;
}
}
}

function resizeStage() {
var myListener:Object = new Object();
myListener.onResize = function(e:Object):Void {
//
}
Stage.addListener(myListener);
}


init();

Stage.width && Stage.height Doesn't Work Anymore?
How do you get Stage.width and Stage.height in ActionScript 3.0

2.0 this works like a charm. I guess they may have moved this inside a deeper class or something.

thanks in advance.

Create Array On Stage, Mathematically Referring To Objects On The Stage
Ok what I want to do is create a set of small images on the stage and name them sequentially like you would an array, then refer to them mathematically in actionscript. I tried naming them as an array but it says that the name is reserved for the system or something. Does anyone know how to get an array of objects onto the stage, or have an idea of something else I could do to get the same effect?

Create Array On Stage, Mathematically Referring To Objects On The Stage
Ok what I want to do is create a set of small images on the stage and name them sequentially like you would an array, then refer to them mathematically in actionscript. I tried naming them as an array but it says that the name is reserved for the system or something. Does anyone know how to get an array of objects onto the stage, or have an idea of something else I could do to get the same effect?

Stage.width And Stage.height Not Matching Document Settings?
Ok, so I have no idea why this would be happening and its driving me nuts. I have my Flash movie size set to 960x650. However, when I trace stage.width and stage.height, I get:

950.05x630

Why in the world would this be happening? It's screwing up all the work I'm trying to put into positioning elements relative to the stage size. Thanks for any help!

Centered Box BOx BOX
I want to create an html page with a box smack dab in the middle of the page. This box will contain flash and static elements? how would i do this? css maybe?

Swf Centered ?
Hi. Im working on flash 5 and i want to know how can I put center (middle) on html my movie SWF.

the next website is an example that i want,
http://www.hercules.com if we make maximun the window the SWF always in middle center. please help-

thanks

Centered Pop-up
I have the following flash action, to center (vertically and horizontally) a pop-up window... I've been trying to find an answer, to how I would do the same thing in html, as I've changed the homepage that is home to a pop-up flash site from an swf to html... currently, the pop-up I have at the site works, but it doesn't center it, and I don't know enough html to know where to start... the site is... www.onenovember.com if that helps...

on (release) {
getURL ("javascript:NewWindow=window.open('http://www.onenovember.com/convergence.html','newWin','width=700,height=700,l eft=0,top=0,toolbar=No,location=No,scrollbars=No,s tatus=No,resizable=No,fullscreen=No'); NewWindow.focus(); screen_height = window.screen.availHeight; screen_width = window.screen.availWidth; left_point = parseInt(screen_width/2)-(700/2); top_point = parseInt(screen_height/2)-(700/2); setTimeout('NewWindow.moveTo(left_point,top_point) ',100); void(0);");
}

Why Is It Not Centered ?
Please help me...

I am trying to center a movie horizontally and vertically on my HTML site. In the Publish Settings I have the Flash Align set to Center, Center. Still, the Flash is always on the left side of the web page...

What do I do wrong ?!

Pop Up Not Centered
My pop up is off center. Below is the script I am using
Here is the link- Hit any movie in the movie section - thanks

www.imediastudios.com


on (release) {
getURL("javascriptpenWindow('"+name+"56.html','p opup',240,125);");
}

And on the html I have

<script type="text/javascript">
<!--
function openWindow(url,name,w,h) {
xPos = (screen.width - w) / 2;
yPos = (screen.height - h) / 2;
config = 'left=' + xPos + ',screenX=' + xPos + ',top=' + yPos + ',screenY=' + yPos + ',width=' + w + ',height=' + h;
newWindow = window.open(url, name, config);
}
//-->
</script>

Centered Pop Up
In using the tutorial for the 'centered pop-up' found on this site, I have encountered a repeating problem. It goes like this:

MainPage > button loads movie that contains more buttons.

The new buttons then utilizes the 'centered pop-up' to load the individual windows of the site.

On the first time through the site, the button for the pop up will be pushed & the main page will go blank and give a syntax error, never popping up the pop up.

Refresh page & second time through this will not happen, everything loads as it should - no errors.

What is this & where is it coming from?

Centered Pop Up
ok so i got this all working fine as long as i publish it in "html" but why wont it work as just a ".swf" movie.
i will pop up the window but it never gets the file i want it to load.....
why is that?

Centered? I Think Not
for some reason my flash movie won't center in this pop up window..

http://www.geocities.com/lostinbeta/

any ideas?

Stage.height And Stage.width Erratic Values?
Hey folks,

I was wondering if it happens in all Flash everywhere, or just in mine:

When I trace Stage.height and Stage.width, I always get erratic values:

Stage.height gets me always 4 pixels less than real
Stage.height gets me always 104 pixels less than real

This, way if my stage has 760 x 400, it will return values 756 x 296.

Anybody knows why?

Thanks!

F8 Movieclip Change On Stage Causes The Entire Stage To Dissapear
I have my stage with a background picture.

On stage left are buttons, and on stage right I have a movieclip (mc_Preview).

When the user puts his mouse over each button I would like the movieclip to move to a different frame.

the problem is when the mouse moves over a button, i see the movieclip move but then the entire stage dissappears and turns a few shades of gray.

Does this sound familiar to anyone?
Any help would be greatly appreciated!

External MC Loaded On Stage, I Can Press Buttons That Are On The Stage Through It...
I'm used to AS3, and I don't have much experience in AS2. I'm trying to modify an older flash file done in AS2.

An external swf is loaded using this code...


ActionScript Code:
on(release) {
    loadMovieNum("supplimental/external.swf", 500);
}

The problem is that even though this external movie covers the whole stage, My mouse can still "see" buttons that are on the stage, and I can click them. I don't want to be able to click the buttons through my external movie. Thanks for any help.

Stage.width, Stage.height, Add.Listeners Problem
Hi
i found the way yesterday to ensure my mc stays full screen. now i want to animate the same mc if i can in reaction to a button click.

not sure how this next step goes. do i need another addlistener to the background mc that im tweening ?

kindly check the .fla. to see what i mean.
its very rough cut but hopefully you can get the gist of it.
when the text button is clicked, the bg reverts to the top left of the screen.

thanks
-dj

MX2004 -- Stage.height And Stage.width Different From Mac To Windows
I have a really strange problem that is ruining my movie. I have set the size of the stage to 450px by 400px in the properties dialog. In my actionscript, I've got all kinds of things that rely on Stage.width. So, I developed everything in MX2004 on Mac, and everything worked swimmingly. So, I opened up the exact same file in MX2004 and everything is placed wrong on the stage. So when I did a trace of Stage.width, I got 940px, and a trace of Stage.height gave me a figure of 763 pixels. If I do the same traces on the Mac, I get what I expect, 450px for width and 400px for height. Does anybody have any ideas as to what might cause this kind of discrepancy?

Thanks,
John

External MC Loaded On Stage, I Can Press Buttons That Are On The Stage Through It...
An external swf is loaded using this code...


Code:
on(release) {
loadMovieNum("supplimental/external.swf", 500);
}
The problem is that even though this external movie covers the whole stage, My mouse can still "see" buttons that are on the stage, and I can click them. I don't want to be able to click the buttons through my external movie. Thanks for any help.

Keeping The Nav On Top
Hi, I've got a fla that uses duplicate movie clip, the only problem being when a new swf is loaded it covers the Nav, is there some way to keep the nav elements on top of the loaded swfs?

Could someone please drop me some code or have a look at the attached fla.

LoadMovie Not Centered
Hello. I have trouble loading a movie clip properly.
Some how it does not center the newly loaded movie.
I set up the loading movie size to be the same as the transparent sestination movie clip where the loaded movie will go to.
Some how the loaded movie shows in the center as desired very quickly, but then it moves to the lower right corner of the main movie. I have to put the "dropzone01" to left top to manually adjust the loaded movie to be centered.

I am just wondering why it happened, and would like to know if there is any solution. I have about 18 more movie to load, so I don't want to manually adjust everything.

Here is the script to load movie I used:

on (release) {
gotoAndStop ("pic1");
loadMovie("thumb01.swf", _root.dropzone01);
}


Thank you,

Tsug

Need Java Centered Pop-Up
Hey Guys,

I have a URL I'm working on at: http://www.vmvisions.com/steelhorsesmc/background.swf.

In the galleries section I want to enable a pop-up html window that can be closed by the user, from the window.

What's the javascript code for that?

Thanks,
Marc

Copyright © 2005-08 www.BigResource.com, All rights reserved