Changing Centre Point With AS
Is it possible to alter the centre point of a createEmptyMovieClip with actionscript? If so, how would you go about doing it?
Thank you
DevShed > Flash Help
Posted on: April 16th, 2004, 10:50 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Changing The Centre Point
Hey Guys,
Is there anyway to make the centre point of a movie clip follow your mouse? Like if I wanna 'zoom' in on something, I put the mouse to where I wanna zoom and then press a key and it zooms in on that spot?
Centre Point Has Come Apart
Have a very simple but annoying problem.
With a couple of my symbols the centre point has split in two (I have no idea why).
The cross part of the centre point (the centre point for the contents of the symbol) is in one place, while the circle part (the centre point for the symbol itself) is in another.
I have tried moving the contents around but the distance between the two centre points stays the same.
Is there a way to bring the two parts back together?
Help please.
Editing Centre Point...
Is it possible to edit the centre point of an image or a vector graphic in flash, and how can I do it?
>>> Centre Point On A Oobject
When you enlarge a object using the mouse (graphic object) the middle bit satys there all the time dosn't move and it enlarges round the middle part, but when you enlarge a gpahic object by typeing in the width and hights in the dialog box the centre point moves and is no longer enlarged from the centre point how do you get it to enlarge from the centre point when typing in the hights in the dialog box?
I going to try and get a imaged screenshot example but the attach file thing dosn't work!!
Please try and answer thou
Centre Align An Anchor Point
Hi there!
I've been following a tutorial (found at http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm) and I'm having difficulties centre aligning the anchor point inside the empty movie that loads the images from the xml document. At present the anchor point is located at the top left corner of the image so the images will not be positioned correncly if they are different dimensions. Is it possible to centre align the anchor point using Actionscript so images will be displayed in the centre of the image window? Can anyone help? I've attached the code that exists in the first frame in the timeline which controls the movie. The instance name for this MC is "picture". Thanks in advance
Attach Code
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
Menu Control Around A Centre Point. Help
I need a lot of help! I can't find much guidance on movement tied to a centred registration point.
I've created a menu based on a circle. I want the outer ring to rotate on it's own, then if you wave over it, have it slow down and stop, (and vice versa)so that you can select the buttons within the MC.
Also, I need the inner circle with an arrow on it to turn on its own, then when you wave over it, have the arrow follow the mouse - centred around it's registation point again.
All I have so far is the script with gets the two discs turning:
onClipEvent (enterFrame) {
i = getProperty(this, _rotation);
setProperty(this, _rotation, i+3);
}
Any help with the script I need would be greatly appreiciated. Thanks!
Centre Point But Not The Transform Tool?
Hello,
He's an example. From VB I control a simple circel. If i'm telling the circle to be at the top left of the screen (frmMain.Flash.TSetProperty("/mvcCircle", 0, 0) and frmMain.Flash.TSetProperty("/mvcCircle", 1, 0), i'm looking at a quarter. The center point is used for these coordinates, of course but when I move the centre point with the transform tool is not really moved. When you click the circle again there is a dot in the upper left corner of the circle and a crosshair in the middle. Now how do I move the crosshair as well? O, In Flash 5 it works fine....thank for reading..
Frank
Menu Control Around A Centre Point. Help
I need a lot of help! I can't find much guidance on movement tied to a centred registration point.
I've created a menu based on a circle. I want the outer ring to rotate on it's own, then if you wave over it, have it slow down and stop, (and vice versa)so that you can select the buttons within the MC.
Also, I need the inner circle with an arrow on it to turn on its own, then when you wave over it, have the arrow follow the mouse - centred around it's registation point again.
All I have so far is the script with gets the two discs turning:
onClipEvent (enterFrame) {
i = getProperty(this, _rotation);
setProperty(this, _rotation, i+3);
}
Any help with the script I need would be greatly appreiciated. Thanks!
Moving The Centre Point On A Can Of Spray Paint?
I have created a can of spray paint that the user can spray paint with.
But the problem is that the paint sprays from the middle of the can and not the nozzle.
I've tried moving the centre point but thats not working.
Any suggestions on how to fix this?
Moving The Centre Point On A Can Of Spray Paint?
I have created a can of spray paint that the user can spray paint with.
But the problem is that the paint sprays from the middle of the can and not the nozzle.
I've tried moving the centre point but thats not working.
Any suggestions on how to fix this?
Centre Align An Anchor Point, Flash Image Gallery Using Xml
Hi there!
I've been following a tutorial (found at http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm) and I'm having difficulties centre aligning the anchor point inside the empty movie that loads the images from the xml document. At present the anchor point is located at the top left corner of the image so the images will not be positioned correncly if they are different dimensions. Is this possible using Actionscript? Can anyone help? I've attached the code that exists in the first frame in the timeline which controls the movie. The instance name for this MC is "picture". Thanks in advance
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
Changing Centre Of Rotation
I purchased Flash yesterday, and so am starting with very simple animations. One way I thought of doing this was to rotate limbs in different keyframes to give the impression of movement. Unfortunately, the centre of rotation makes this impossible. Is there a way to change the cente of rotation, or am I doing it wrong?
Changing The Centre Of Scaling?
Hi, I'm a bit of a newbie at using actionscript so sorry if this is an obvious question. I'm trying to create a scalable, panable map (http://uploader.polorix.net//files/290/mapexp1.swf).
The only problem is that the zoom in / out function zooms from the centre of the map image, rather than the centre of the screen. This makes it very hard to zoom in to a particular point in the map. Take a look at the swf - see what I mean?
Any suggestions on how I could fix this would be great.
Cheers! Tom
Changing The Stage Size Centre Aligned
Can anyone tell me how tochange the stage size of flash, but from the centre of the stage.
In pshotoshop you have the option to change the canvas size and then specify if the canvas has to change from the right, left or centre.. can you do this with flash? Or something similar?
When I change the dosument size in the document properties window it simple cuts the page back to left of the document (or expands it from the left of the document depending on wether I make it smaller pr larger..)
Can anyone help? It would save me a huge amount of work.
I'm using Flash MX on a mac runing OS 10.3.
Many thanks.
Changing Center Point..
How do I change the center point of something I've "drawn" in Flash - say a square.
I'm trying to get it to rotate on a different axis, like from one of its corners.
Changing The Rotation Point
there is a center point for movie clips for rotations...they can be changed by editing the movie clips yet I want to know if they can changed by scripting so that during a movie play, user can change the rotation point by clicking on the rotating object.
'll appriciate any comments.
Changing MC Registration Point
Hi. Is there any way to change a movieclip's registration (i.e. center point) in code???
I need to scale a movieclip at diffferent points.
PLEASE HELP!!!
Changing An MC's XY Reference Point
Hi there.
Problem:
Everytime I import an SWF when I make a text effect
created with Swish 2.0, I have the need to move every
frame content of the MC's to where I'm importing it,
to it's "cross hair" in order to have a 0,0 xy reference.
Question:
How can I change the XY reference, center point, crosshair,
registration mark or what ever it's name is, inside a MC with MX ?
I've tried that trick with the free transform and then moving
the little circle, but that only changes the rotation center
if I'm seeing the mc as an object in the main stage, but
if I edit that mc's frames, I find that every object is around
the -180 -20 XY position, BUT imagine a combined text
effect that takes about 100 frames !!! I can't just
waist time moving every object in every frame to center
the registration mark.
Thanks 4 the help !
-Waltman
Changing The Registration Point
Hi
I'm trying to change the registration point of a movieclip so that I can rotate it around that point.
I found setTransformationPoint() but I can't get that to do anything and the code is not coloured as a function when I type it in (I have MX2004 pro) and anyway I'm not sure if that is the function I want.
If anyone knows how to do this or a workaround please let me know
Thanks
Changing Registration Point
how do I change the registration point of a movie clip AFTER I've already created it in the Flash MX environment....I'm sure it's an easy answer, I just can't find it!
[F8] Changing Point Of Rotation?
Is it possible to change the point of rotation via actionscript?
The reason is that in my platformer the registration point is in the bottom middle (where the feat are) to make hitTests with the ground easier. But now I would need to change the registration point by 20 pixels to make a rotation in the middle...and then I would have to change all the code again...
Is it possible to change the rotation point?
Changing Registration Point
Hello,
Basically I just want to change the registration point of a movie clip I've already created. I don't want to change the movieclip into a new symbol because then I lose the animation frames/labels etc.. can anyone help me with this? ^^
Regards, bloodstyle
Changing Registration Point
Hi
I've been trying to loading a external swf into a movie clip but when I load it won't align properly in the movie clip and I'm pretty sure it has something to do with the registration point of the movie clip ,can anyone help?
Changing Registration Point
Is there a way to change the registration point after one has made a movie? I can't seem to find where I can change it once it's in the library.
Changing Registration Point
Hi
I've been trying to loading a external swf into a movie clip but when I load it won't align properly in the movie clip and I'm pretty sure it has something to do with the registration point of the movie clip ,can anyone help?
Changing Mc's Registration Point
Let's say i create an mc and during creation i select it's registration point. Is there any way (through as or flash IDE) to change it's registration point afterwards?
thanks
Changing The Movie's Center Point
Hi.
I need to change the 0,0 coordinates from the upper left corner to a different position on screen.
I am making a longitude/latitiude system and I need to do this for it to work.
thanks
Changing Registration Point In Script
Is it possible to alter the registration point of a symbol dynamicly using actionscript? I want to pan and zoom smoothly around a huge image and the zooming function would be much simpler if the image was always located in the center of the screen and only the registration point changed.
Changing Registration Point Dynamically ?
I Couldn't find the answer from the previous questions and I'm way too stupid to use Flash native help file.. so here goes for all the gurus out there:
Is there a way to change registration point dynamically in actionscript (for a movieclip instance named "myMovie")?
I'm really loosing the rest of my allready sparse hair with this, so any help would be GREATLY appreciated.
- Harry S
Changing The Center Point Of A Graphic
hi
i have a bit of code that changes the _height of a graphic in a clip so that it gradually gets taller or shorter - that works fine except that the center point(? - the circle with the little cross in it)is top left, so when the height changes it's the bottom edge that slides up and down and not the top ...
so, how can i change the center point to bottom right?
i know that this is a stupidly simple question but just can't find the thing to do it !!!!!
thanks for any help you can give
Bob
Changing The Registration Point On A Component
I've been using a textArea component which I am dragging around the stage. The default position for the registration point seems to be in the top left. I would like to change this position to the centre. Is there any actionScript code I can use to do this? I have named my components: text1, text2, etc.
Thanks for any advice.
Richard
[F8]Changing The Mouse Reference Point?
This could actually solve the problem i have from my other post.
When i load my external swf(its a game that uses the mouse co-ordinates to use startDrag and calculate a hit test), the game uses the coordinates based on the entire main flash file which is much larger. If i position the movieClip at (0,0) then all is fine.
My question is: If i wanted to move the movieclip somewhere other than (0,0), is there any way (without editing the game file) to change the mouse x and y values when being read by the game? Like maybe a onRollOver function?
Thanks before hand
Changing A Sprite's Registration Point
I need help from any of you experienced coders out there! I'm trying to make an interface similar to Leo Burnett but with a little more flexibility.
The main interface needs two separate registration points (of course not REAL registration points, but conceptually!):
- One used to control the x and y (I'll call it Translator)
- A second one to be used as the center for all scaling and rotations (Rotator)
Ideally changing either point will not effect the other AT ALL.
This has been my biggest issue to deal with.
These points can be relative to the stage, the sprite, or the sprite's parent - whatever you think is easiest to implement! In my particular case the Rotator reference point will always be located in the center of the stage, but the Tranlator is free to move around freely. Ideally everything would be top left aligned so that setting Translator to (0,0) would put it in the top left corner of the stage.
I've literally tried a dozen things. Any comments, ideas, psuedo code, examples, links are very welcomed! Perhaps my whole idea just doesn't make sense and someone can enlighten me
[CS3] Actionscript 2.0 - Changing Scaling Point
I have a movieclip that's a rectangle, and I want it to scale around a point that's on the bottom of the rectangle.
I can do this fine inside the IDE using Tweening, however, if i use the Tweener class like:
var tweenX:Tween = new Tween(etc, etc);
then it doesn't scale around that point I set inside the IDE but rather it seems to scale based on the top left corner.
Is it possible to change this?
Changing Point Of Origin Using Actionscript 3.0
Hello
I have a photo gallery that i created using actionscript 3.0. All of the thumbnails and the enlarged photos have an origin point in the upper left hand corner of the image, i want to be able to change that to the center of the image using actionscript.
Thank You
Changing An Images Registration Point
Hi all
Just a quick one here i think, i just need some advice.
when i import a bitmap via xml it of course makes the registration point of that image 0,0. My question is how would i set the registration point so it was in the middle of that image, basically i want to scale bitmaps from the middle i import via xml?
Is this something quite simple?
Thanks as always Sam
Changing Width According To Anchor Point?
Hi,
I'm changing the width of a symbol using ActionScript,
by using:
ActionScript Code:
symbolInstanceName._width = value;
Is there any way to make the width grow from a specified anchor point??
I mean, it always changes the width starting from the left... but I need it to change according to the symbol's anchor point (at the middle in my case).
Please help
And thanks in advance.
Changing The Registration Point With Actionscript
Hi all,
I hope I'm able to explain this clearly:
I have two MCs (a worlkd map and a country placed on the map) that are scaling together. The country MC's centre point is set to match that of the world map so that when they scale using my script, they stay locked together as far as positioning goes. After the world map and country get to a certain scale (200%), the country needs to keep scaling until it reaches 400%. So far, I have that working fine
However, when the map scales seperately of the world, I'd like the centre point of the MC's scale to be the centre of the country, not the senter of the world map. Is there any way to do this 9and do it smoothly without the country jumping position on the stage)?
Thanks for any help!
Changing Registration Point. Not Transformation
How to change registration point of movie clip ? The one I select then creating it, not transformation point.
(Why I need this is, then I copy frames from inside movie clip to stage, objects are moved to side (registration point matches corner of scene..))
Thanks,
Linas
Changing Registration Point Of A Movieclip
I have created a rectangle with the following code:
this.createEmptyMovieClip("square_mc", 1);
square_mc.beginFill(0xFF0000);
square_mc.moveTo(0, 0);
square_mc.lineTo(100, 0);
square_mc.lineTo(100, 100);
square_mc.lineTo(0, 100);
square_mc.lineTo(0, 0);
square_mc.endFill();
Now, I want to change its registration point from top-left corner to its center using ActionScript code....
Can anyone tell me how to do this?... any idea guys???
Dynamically Changing The Registration Point Of A MC?
For a simple image editing application in Flash (AS 2.0) i'm looking for a method to change the registration point of a MC dynamically. This is needed since the imageHolder clip that i loadMovie() my jpeg in needs to be rotated, scaled etc. after it has been placed on the scene, and it's a drag to correctly center the image on each event based on a point in the upper left corner instead of simply the middle of the image. trust me on that one
I have tried simple loading the jpeg into a MC that already has it's registration point centered but this does not seem to matter.
Any ideas/tips?
|