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




Aaarrgh Have A Map Centering Question...



I posted a question regarding the ability to create a zoomable map. I've created a PDA style application, and there's a window where the user can either click a "+" button to zoom in, or a "-" button to zoom out. When you click either button the map will increase or decrease in scale, but the map doesn't remain centered. for example: I've used a button and this script.on (press) {map._xscale += 10;map._yscale += 10;} How could I add the ability to center the map? Any help will be greatly appreciated.



KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 10-08-2004, 11:11 AM


View Complete Forum Thread with Replies

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

Aaarrgh Have A Map Centering Question...
I posted a question regarding the ability to create a zoomable map. I've created a PDA style application, and there's a window where the user can either click a "+" button to zoom in, or a "-" button to zoom out. When you click either button the map will increase or decrease in scale, but the map doesn't remain centered.

for example: I've used a button and this script.
on (press) {
map._xscale += 10;
map._yscale += 10;
}

How could I add the ability to center the map?

Any help will be greatly appreciated.

Aaarrgh....help (flash2phpandbackagain)
,

I m trying to send these variables to a php_script, but they won't get there, while putting the string I copy from my .fla into my browser shows me the script works just fine..

please download my .zip and show me the way

.zip

THNX a trillion!

Swapdepth, Z-positie, Particles.. Aaarrgh
Hey folks, I've got a problem.
I have this 3D engine with pivots that contain particles.
When I render the mc's (particles) I need to assign the right depth:
some mc's should be on top, some beneath others.

The problem is that everything is utterly bugged:
- mc's blink like crazy while battling for the same depth
- mc's don't animate behind or above others, when they are supposed to
- mc's disappear for another mc has overwritten the others with the depth

So that pretty much sucks. Now what? ... HELP!!!
Underneath I have 5 experiments to solve my problem. None work properly.
Normally the depth of a mc would be derriven from it's z-position.
In my case it's a bit more complex: I'd like to assign a depth to each pivot
so that it's particles won't interfere with the particles of other pivots.
This way I contain the particles nicely in their abstract "containers" (pivots).

Code:
var swapType = 0;
switch (swapType) {
default:
// e.g: Number("20" + "1") = 201
mc.swapDepths(Number(String(pivot.depth)+String(depth)));
break;
case 1:
// e.g: round(20 + 352.58844677 + 1) = 374
mc.swapDepths(Math.round(pivot.depth+((100000-position3D.z)/10 + depth)));
break;
case 2:
mc.swapDepths(Math.round((100000-position3D.z)/10 + depth));
break;
case 3:
mc.swapDepths(100000 - position3D.z*100 + depth);
break;
case 4:
var d = (1 / ((position3D.z/perspective) + 1));
mc.swapDepths(d * 500);
}
Who can help me solve this problem? I'm reaching out here..
So I'd like to use a manual assigned a depth to a pivot, to group it's
particles above or below other pivot's particles. The only reason I gave
a particle a depth is to temporarly solve a little problem when more particles
have the same z-position, so they won't have to fight over the depth.

Thanks in advance! - Mediamonkey

Swapdepth, Z-positie, Particles.. Aaarrgh
Hey folks, I've got a problem.
I have this 3D engine with pivots that contain particles.
When I render the mc's (particles) I need to assign the right depth:
some mc's should be on top, some beneath others.

The problem is that everything is utterly bugged:
- mc's blink like crazy while battling for the same depth
- mc's don't animate behind or above others, when they are supposed to
- mc's disappear for another mc has overwritten the others with the depth

So that pretty much sucks. Now what? ... HELP!!!
Underneath I have 5 experiments to solve my problem. None work properly.
Normally the depth of a mc would be derriven from it's z-position.
In my case it's a bit more complex: I'd like to assign a depth to each pivot
so that it's particles won't interfere with the particles of other pivots.
This way I contain the particles nicely in their abstract "containers" (pivots).

Code:
var swapType = 0;
switch (swapType) {
default:
// e.g: Number("20" + "1") = 201
mc.swapDepths(Number(String(pivot.depth)+String(depth)));
break;
case 1:
// e.g: round(20 + 352.58844677 + 1) = 374
mc.swapDepths(Math.round(pivot.depth+((100000-position3D.z)/10 + depth)));
break;
case 2:
mc.swapDepths(Math.round((100000-position3D.z)/10 + depth));
break;
case 3:
mc.swapDepths(100000 - position3D.z*100 + depth);
break;
case 4:
var d = (1 / ((position3D.z/perspective) + 1));
mc.swapDepths(d * 500);
}
Who can help me solve this problem? I'm reaching out here..
So I'd like to use a manual assigned a depth to a pivot, to group it's
particles above or below other pivot's particles. The only reason I gave
a particle a depth is to temporarly solve a little problem when more particles
have the same z-position, so they won't have to fight over the depth.

Thanks in advance! - Mediamonkey

Aaarrgh Simple (no Doubt) Solution Required
I'm a bit of a newbie to intermediate, but theres somethings I've just never done that I've been trying to do.

so I need some help before I lose any more hair!!

My main movie, slides.fla is loading into an empty movieclip (mcLoader) a swf, slidepres.swf.

All I want to do is at the end of that slidepresentation, is click a button on the final slide to carry on playing the movie from frame 2 of the main movie.

I can not for the life of me figure the targeting out!

So any help will be gratefully received

Thanks again.

Centering A MC
I need a simple way of centering one MC over another MC

Thanks

Darin

Centering Your SWF
Alright this one has me confused. I have tried the publish settings and all.. I can not get my SWF to center in a browser window... I would really appreciate it if you caould me out... thx

Centering IE Etc
Hello

i was wondering how one can centre a flash site on the net

from right to left top to bottom

Centering
How do i get my flash movie to be in the center of the webpage?

Centering
Is there a way to center a flash file dead center in the middle of a browser. I don't want it to match the browser window size, just center it.

Help With Centering
I feel like I'm going crazy.
Here's my question:
How can I make the Info panel recognize the center of the stage as 0,0, rather than the upper left corner of the stage? I know I've done this before, but I can't figure out how. A lot of my older movies have this - but I can't figure out how to do this with my new ones. The reason I like it is because I know things are evenly spaced if they are -25,0 and 25,0 etc.
Does someone know this (probably) simple answer?
Thanks

Centering
Code:
loadMovie("home.swf", "loaded");
loaded._x = loaded._x - loaded._width/2;
loaded._y = loaded._y - loaded._height/2;
thats on the first frame of the index movie
various movies are being loaded into the index movie.
i want each movie to have a different size but each needs to be centered.
cant get it to work yet...any help would be appreciated

thanks
-2

Centering Help
i am using a blank mc container to call in some images dynamically.
the images are different sizes and end up not being in the center of my content area because of the differnet sizes. is there something i can tell my container to make them center insted of all starting from the top and left.
like...can i place something inside that blank mc...like another mc in the center of it?

follow me?

i am pulling hair.

c

Centering
Hey, take a look at this:

http://www.norwaysays.no/

See the centering technique here (resize you browser),
I know they may using onResize but how do they do the "after" resize, and the transition(tween) to center it?

Can anyone help

S

Centering
I haven't used Flash is a while. Isn't there away to set it up so that no matter what resolution someone has their monitor on, that when your website comes on, it automatically centers in the middle of their monitor?

Please help if you can

Thanks

Treena

Centering?
Stupid question. I'm working in Flash MX 2004 and I can't center my flash movie. I keep publishing it with the settings to make it centered but everytime I open the html file it doesn't work. It's always flush left.

How can I center it?

Any help I'd really appreciate.
Thanks,
Jeremy

Centering Pop - Ups?
i have a website (pop up based). but the problem is that on my screen, (1280 x 1024), it looks fine, but when i launch it another computer, the pop up is way off screen.. is there a method to center screen the pop - ups??


and btw, which is the best method of pop-ups,,
using a javascript:window.open(blah blah) or using an fscommand(which i need some help) ????

Centering
I need to center an flv, is there any code to do this?

Centering?
I just published my first site in Flash 8 and just used the generic html publish that comes with it. I was astonished to view my site on a computer with one of those new short wide screens and see that it wasn't centered in it. I used to have to put centering html code in all my flash by hand in the old days with MX but I figured that with Flash 8 Macromedia, nay Adobe, would have figured out how to write html centering code. Am I nuts? Is there something I am missing in the automatic publishing process? Or do I still have to go through every html I publish with flash 8 and enter a div tag with a table and row and cell and center it? Thanks.

Centering
Alright, I'm fairly new at uploading and designing websites. I just finished updating mine and have yet to figure out how to center it in the browser. I know practically nothing about HTML or Java or any of that. I only used Flash MX 2004 professional and used a lot of the basic action scripting and what I've learned in some tutorials. It has a publishing option to center the movie but it doesn't seem to work. Can anyone help me out on what to do? Please be as detailed as possible. You can check out my site at www.jeremytomsart.com It may look like it's center on some computers, but trust me it's not. I just made the stage large enough to appear more in the center. Any help would be greatly appreciated. Thanks in advance.

Centering
Is there a way to center a movieclip in the movie? I have my SWF resizing to 100% wide but not height in the html document. Is there a way, maybe with actionscript, that you can cetner the movieclip?

Remember I'm a big noob so details are good.

Thanks!

Swf Centering
i am trying to center an swf into the stage

i am using this code below to resize it and then center it
the resize part works fine but the mc loads off center

this.createEmptyMovieClip("mc", 0);
mc.loadMovie("DBdriven//2.swf");
mc._xscale = mc._yscale=sized(mc._height, mc._width);
mc._x = (Stage.width-mc._width)/2;
mc._y = (Stage.height-mc._height)/2;




function sized (H, W) {
// get he actual value of container
var _w = W;
var _h = H;
//trace(_w+""+_h);
// set the dimensions of the page
var maxW = Stage.width;
var maxH = Stage.height;
var scaleX = scaleY=scaleFactor=80;
var scaleX = scaleY=scaleFactor=80;
if (_w>maxW) {
scaleX = maxW/_w*100;
}
if (_h>maxH) {
scaleY = maxH/_h*100;
}
scaleFactor = Math.min(scaleX, scaleY);
return (scaleFactor);

}

Help On Centering
I have a problem on centering my flash document in my website. When i publish it, and upload it to the file manager in my web host, it's align farthest to the left. Kind of weird. I centered it aligned to the center of the document in flash. I want it set in the middle in my website. Can anyone help me on this?

Centering
Hello i have a gallery in flash right now that loads up each indiv. jpg when each thumbnail is clicked. How can i get it so that when each jpg comes in it comes directly to the middle of the movie no matter what size.

This is all i have right now

on (release) {
loadMovie("ex26.jpg", "_root.screen");
}


If someone could give me insight or help me out thad be greatful.
Thanks

Centering Swf In FBF
Hi there,
I am quite new toAS...but I try to figure how to center a loaded swf which is loaded into an empty MC.

I did get it to work with loading a jpg dyn. it centers perfect and even on resize.

But the swf is centered horiz. but not verti......only after resize.

If someone can help me out¿¿¿

cheers

btw heres the code :

Stage.scaleMode = "noScale";
Stage.align = "TL";


var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
target_mc._x = (Stage.width - target_mc._width) / 2;
target_mc._y = (Stage.height - target_mc._height) / 2;
};

this.createEmptyMovieClip("myClip_mc", 1);
var img_mcl:MovieClipLoader = new MovieClipLoader();
img_mcl.addListener(mclListener);
img_mcl.loadClip("loadCenterSWF.swf", myClip_mc);

ss_mc.swapDepths(myClip_mc);

var stageL:Object = new Object();
stageL.onResize = function() {

var stageXCenter:Number = Stage.width * .5;
var stageYCenter:Number = Stage.height * .5;

var b = myClip_mc.getBounds();

stageXCenter = stageXCenter - (b.xMin + myClip_mc._width*.5);
stageYCenter = stageYCenter - (b.yMin + myClip_mc._height*.5);

myClip_mc._x = stageXCenter;
myClip_mc._y = stageYCenter;

};

Stage.addListener(stageL);

------CENTERING------
Hi,

I bought one of those flash templates online. I am now ready to install it with our service provider. When I run the swf file everything looks perfectly aligned. However, when I run the index file (I'm told I need because it calls the sfw file from within) my swf file is left of center.

Any ideas how I can get it to run like the sfw file? The swf file even has it automatically resized to it's max potential (perfect size). The html file just opens the full screen mode and there is my tiny, little image off to the upper left.

Thanks
G.

CENTERING
Dear Flash People,

I am a self taught Flash user working on a 1.25ghz eMac.

I'm having trouble trying to centre my Flash project in the browser window. As far as I can see I have set the options in the HTML publishing options box before publishing, as per the manual I use, but it just wont centre. It just plays on the left hand side (Incidentally playing with the options left/right/top/bottom seems to make no difference at all, whether it's in the HTML or Flash alignment option menus).

Can anyone help? I just can't see what's going wrong here.

Many thanks

Tonyhandlebars.

Centering Swf
Can anyone point to a resource that would help me design a site that used a centering swf?

Imaginaryforces.com and skuadstudios.com both use similar techniques so it seems to only be a secret from me.;)

It's not just the centering but the address and a menuing system being sensitive to window size/shape that perplexes me. Are there any good books that cover these kinds of techniques?

THX

rg

Centering Pop-up
I got XML Gallery working but now when I use


Quote:




on (release) {
getURL ("javascript:openNewWindow('products.html','thewin ','height=500,width=340,toolbar=no,scrollbars=yes' );");
}




it pops up uncentered, and off to the left a bit, and is still scrollable with the scroller on the mouse even when i set scrollbar = no. Anyway to center it and not allow it to scroll?

thanks ahead

Centering An Mc
hey guys,

here's the deal, I have a main swf named index.swf with only 1 frame, on that frame I have actionscript that creates an empty movieclip loads an external swf and centers it depending on the user's browser size.

My problem is if I load an swf that doesn't take the whole 1020x610 of the index.swf it won't be centered. It's kind of hard to explain. so here's some of the code.


ActionScript Code:
this.createEmptyMovieClip("container",this.getNextHighestDepth());container.loadMovie("../swf/splash.swf");var stageXCenter:Number = Stage.width * .5;var stageYCenter:Number = Stage.height * .5;stageXCenter = stageXCenter  - (container._width * .5);stageYCenter = stageYCenter  - (container._height * .5);container._x = stageXCenter;container._y = stageYCenter;stageListener = new Object();stageListener.onResize = function():Void {    stageXCenter = Stage.width * .5;    stageYCenter = Stage.height * .5;            stageXCenter = stageXCenter  - (container._width * .5);    stageYCenter = stageYCenter  - (container._height * .5);    container._x = stageXCenter;    container._y = stageYCenter;}Stage.addListener(stageListener);


Any help would be greatly appreciated

Centering?
How do I get my website in the center of the webpage now matter how big my window is?

Centering Until A Certain X Value
Im stumped, 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){
mc._x = Stage.width/2;
mc._y = Stage.height/2;

}
};
}



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

Centering
my flash website is 640x480, how would i center the movie in the web browser?

Centering
Hi, I saw this question in here once but i cant seem to find it. The question is does anyone know the code for your flash file to center it right in the middle of your page. All i remeber it had something to do with tables.

thanks again, here is a example of what I am talking about. If anybody wants to see it.



http://www10.brinkster.com/soundgraphy/angklung/

Centering?
How do I have my flash doument align in the middle of a html doument. In the center of the page? Is there some code?

Can Someone Help With Centering MCs
I guess I must've hit submit instead of preview. I apologize if this has created a mess.

I wanted to center an instance of a MovieClip entitled "circle" in an instance of a MovieClip entitled "square" using the following syntax:

this.circle.centerIn(this.square);

and this is what I tried, but it didn't work. Any ideas?


ActionScript Code:
MovieClip.prototype.simpleCenter = function(standingDim:Number, movingDim:Number):Number {
    var moveAmount:Number = int((standingDim-movingDim)/2);
    // int can be replaced (or not) with Math.floor, etc.
return (moveAmount);
};



ActionScript Code:
MovieClip.prototype.findCenter = function() {
    var center:Array = new Array();
    var bounds:Array = this.getBounds();
    center["x"] = (bounds["xMax"]-bounds["xMin"])/2+this._x;
    center["y"] = (bounds["yMax"]-bounds["yMin"])/2+this._y;
    return (center);
};



ActionScript Code:
MovieClip.prototype.centerIn = function(someClip:MovieClip, centerType:Array) {
    //check to see if option "centerType" exists
    if (centerType == undefined) {
        //if not defined, center on both X,Y vertices.
        var centerX:Boolean = true;
        //center Horizontally
        var centerY:Boolean = true;
        //center Vertically
    } else {
        var verticalOpts:Array = ["v", "V", "Vertical", "vertical", "VERTICAL", "Y", "y"];
        //list of vertical label options
        var horizontalOpts:Array = ["h", "H", "Horizontal", "horizontal", "HORIZONTAL", "X", "x"];
        //list of horizontal label options
        var centerX:Boolean = false;
        //initialize the horizontal flag as false;
        var centerY:Boolean = false;
        //initialize the vertical flag as false;
        //iterate across the centerType variable (in case multiple center types were entered) *see below
        for (var t in centerType) {
            //for every value entered in centerType
            for (var h in horizontalOpts) {
                //check against possible label options
                if (t == h) {
                    centerX = true;
                }
                //if matching, set flag
            }
            for (var v in verticalOpts) {
                //same with vertical
                if (t == v) {
                    centerY = true;
                }
                //see above
            }
        }
        var thisCenter:Array = findCenter(this);
        //requires previous declaration of findCenter function
        var targetCenter:Array = findCenter(someClip);
        //returns an associative array for x and y;
        if (centerX) {
            //if the horizontal flag is set
            var horizDisp:Number = simpleCenter(targetCenter["x"], thisCenter["x"]);
            //determine the horizontal displacement
            this._x += horizDisp;
            //add the horiz displacement to the current horizontal position
        }
        if (centerY) {
            //check the vertical axis?
            var vertDisp:Number = simpleCenter(targetCenter["y"], thisCenter["y"]);
            //finds the vertical displacement
            this._y += vertDisp;
            //adds it to the current y position
        }
    }
};

Centering My Swf...
Hello,

I wondering the best way to center my swf within my web page.
I have it centered already (horizontally and vertically) using html and frames - but the way I have done it seems a bit messy.

Can my swf be centered more neatly using action script? Or do I have to use html as I have done?

Centering Gone Mad
Man, don't you hate it when something that seems so EXCESSIVELY easy and simple doesn't work at all? lol. Can drive you InSAnE!

Anyways.

_root.image_mc.loadMovie("1.jpg",get);

// IMAGE APPEARS AND IS ATTACHED TO THE MC.

imgX = _root.image_mc._width;
imgY = _root.image_mc._height;

// ODDLY NUFF, THESE VARIABLES = 0, GO FIG.

_root.image_mc._x = 380 - (imgX / 2);
_root.image_mc._y = 350 - (imgY / 2);

// THE STAGE IS 760 x 700 SO THAT SHOULD CENTER THE ITEM
// BUT SINCE IMGX AND IMGY CANT CAPTURE THE WIDTH/HEIGHT
// IT MAKES SENSE THAT 380 - (0/2) = 380, SO THE IMAGE DOESN'T
// MOVE.

My problem here? For God's sake, I can't capture the WIDTH/HEIGHT of the loaded JPG! lol.

Centering My Flash.
Ok, i was curious if there is a way to center a flash screen
on the browser depending on what resolution they are using. all i have now is html code that align's the flash to the top left hand corner. Looks good for me but others can see funny things.. any clues??

Centering Actionscript?
i have the following code to print letters using actionscript:

duplicateMovieClip ("_root.words", "words" + i, i);
setProperty ("/words" + i, _x, startx+charinline*kerning);
setProperty ("/words" + i, _y, starty+linenumber*linespace);
set ("/words" + i + "/letters:letter", substring(text, i, 1));
i = i+1;

this justify's all the text on the left hand side. How would i get it so all of the text is centered on each new line?

Also, i seem to be having problems just organizing my movies. is there any particular rules to follow? like put everything within mc's or everything on the main timeline? what is the best thing to do to get good optimization?

Centering A Pop Up Window...
I just finished my buddies band site at http://members.rogers.com/unfairadvantage/
and i have the javascript for the btn in flash as

on (release) {
getURL ("javascript:window.open('http://members.rogers.com/unfairadvantage/news.html','NameofWindow','width=645,height=315,to p=0,left=0'); void(0);");
}

it pops up fine but it goes to the top left of the browser, how do i make it center when it pops up??

Centering Swf Files
How do I get my swf file to be centered in the web browser window?

Is this something I can do through the publish settings or do I need to change something in my html file.

thanks.

*j

Centering Set Of Movieclips
Hey Guys,

Lets say I have 5 movieclips stacked next to each other on the x axis.

These movieclips are duplicated, so I need to find out the math to set the group of 5 clips in the center of the flash movie, so no matter how many clips are duplicated, they will be centered.

I hope I make sense.

I thought about putting all the clips inside an empty movieclip and just centering that, and if this is the easiest way, then I will do it that way.

what do you all think?
dduck1934

Centering The Movie
how can i get my movie to be centered in the window, and not on the top left?

Centering Swf In Page
My flash page is 800 x 600 with allowscale set to false, i want it to be centered in the browser window if the viewer has a higher resolution. Right now if I view at a higher resolution it is placed in the upper left corner?

Centering Pixelfonts Possible?
In a menu I am using pixelfonts for the caption. The caption needs to be centered, but when centering the pixelfont doesn't align to a whole pixel anymore (example _x of pixelfont = 1.3 instead of 1.0 as is necessary). As a result the text gets blurred.

Any Ideas on how I can center the text and still having pixelfont advantages?

Centering Streeamed *.jpg
Here is the thing,
i have the swf that loads the external jpg,
that jpg once is loaded, I need to rotate, resize, scale etc.
I did that script and that all works fine, but I can`t find the way to center that image, so when I`m rotating it, the picture position is y=0, and x=0, and the rotation is not centered it rotates around the y=0,x=0.
Thank you!

Centering Site
Hi, I was wondering what is the code to center everything so that if you fullview it would still be at the same WxH (width & Height) size?

Thank you.

Centering You File
Hello....this might be a java question, but does anyone know how to have your swf or html file automatically centered in the browser window, no matter what the size is? For example, I added a javascript to my HTML-exported flash file that automatically opens it in fullscreen....but I want to page to be centered. Thanks.

-X

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