Positioning Using AttachMovie
I'm having trouble controlling the placement of an mc when I use the attachMovie code to put it on the stage. Could someone please show me the proper syntax for putting say "milk_mc" into "cow_mc" at 100,192??I've been trying cow_mc.attachMovie("milk_mc", "milk", {_x:100, _y:192})but that's not working, the milk_mc is still at 0,0 in the cow_mc.
Adobe > ActionScript 1 and 2
Posted on: 11/09/2006 07:18:25 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
AttachMovie Positioning
Hi,
I have a for loop that attaches a variable number of instances(the same clip in the library) to the stage... I've used the same loop to space them evenly vertically.. My question is I'm trying space them evenly based on varying sizes in the clip...which I haven't been able to get to work... here's the code...
var comp=total;
for (var i = 1, j=50; i<=comp; i++){
attachMovie("drag1","dr"+i,i);
this["dr"+i]._y =j;
this["dr"+i].gotoAndStop(i); //---I'm going to sequential frames with
//---varying image sizes..
j=j+50;
}
I tried something with the height, but it was screwy, I'm thinking I have to find the position of the bottom of the previous clip???
Any help is much appreciated...
thanks,
-max
Help With AttachMovie And Positioning
this is the function I currently call:
code:
function createTemplates():Void {
for (i = 0; i < totalProducts; i++) {
var attachProduct:MovieClip = attachMovie("templateClip", "product" + i, i);
attachProduct._y +=10;
attachProduct._y += i * 230;
}
}
searching..I read several threads..and tried to implement the same "solution"
using "x" & "y" vars for rows & columns... and then running a loop.. through them...however..I am NOT getting the results I want..
either nothing happens...only 1 clips gets attached.. 1 clip nothing is populated..etc..
I like to be able to control the loops through the loop paramters like x<2
& y<10 etc..etc..
here is my last attaempt:
code:
function createTemplates():Void {
for (i = 0; i < totalProducts; i++) {
var attachProduct:MovieClip = attachMovie("templateClip", "product"+ i, i);
for (x=0; x<2; x++) {
for(y=1; y<10; y++){
attachProduct._x = x*50;
attachProduct._y = y*50;
}
}
}
}
I get the LAST clip in my XML file only!! HAHAH
anybody see what Im doing wrong?
thanks
Attachmovie Positioning
I'm trying to create a small text based mc that launches when you click on a button. It shows up in the upper left corner no matter what I put in for xy coordinates here's the code on the button.
on (release) {
_root.attachMovie("specs1","specsmt",1);
_root.specsmt._x = 0;
_root.specsmt._y = 0;
}
specsmt is the empty mc on the stage and specs1 is the mc loaded from the library.
thanks
Problems Positioning AttachMovie Mc's
Hi,
I was wondering if somebody could tell me what im doing wrong. I think the code speaks for it self:
PHP Code:
per_row = 4; // Number of items per rowrow_item = 0;row_count = 0;xmlNode = this.firstChild.childNodes[1];total = xmlNode.childNodes.length; //length of xml filefor (i=0; i<total; i++) {_root.dropZone.attachMovie("container", "pod"+i, i); //Duplicate the podrow_item++;_root.dropZone["pod"+i]._x += 180*row_item; //Give the new pod a new x value_root.dropZone["pod"+i]._y += 215*row_count; //Give the new pod a new y valueif (row_item>=per_row) { //Check if we reached the maximum pods per rowrow_item = 0;row_count++;}
And here you can find a screenshot of it:
AttachMovie Incorrectly Positioning Clips
I'm using a Movie Clip (mc1) as a button and for it to be able to function with a mouse click, I placed a Button symbol (b1) inside of the Movie Clip and put some ActionScript onto the nested Button symbol:
Code:
on (release) {
_parent.attachMovie("mc2_id", "dot", 100);
dot._x=150;
dot._y=100;
}
As you can see, I'm trying to get another Movie Clip (mc2) onto the stage and that part works fine, but for some reason it keeps ending up at the top-left corner of the stage even though my code says otherwise. What am I missing? I'm including the .fla if anyone would be kind enough to look at it.
Any help appreciated.
Also, when I was setting the linkage properties for the clip to be attached, I had to enable the "Export in first frame" function just so it would work (I normally don't since I was told it would kill a preloader if I had one); how would you export things without having this box checked if you normally don't do that sort of thing because of a preloader?
AttachMovie() Within Another AttachMovie() Created Instance?
I'm still struggling away on my web site, but I've made quite a bit of progress and I think my code has cleaned up quite a bit. I still have the issue of not being able to attach my new content box movie clip when the button is pressed. I am successfully able to load the data for that instance of the tab, and can access the variables. It also is able to run the newContentBox() function inside it with success, but when it tries to run attachMovie(), nothing happens. Could this be a problem with my depth? Or is it my nesting?
I have been thinking about making a global variable for depth that will increment each time anything is created, so every movie clip is guaranteed to be on its own depth. Would this be a solution?
The site can be viewed here.
The source can be viewed here.
All the data files are located in that directory as well.
This is really driving me nuts, and I want to get something solved so I can move onto the submenu creation.
AttachMovie Inside Another AttachMovie
is it possible to attach a movieclip, and then attach another inside of it? i'm trying to load in images via using loadMovie and XML (a little background) i want the image to be dropped in to have a mask applied to it so that the image appears as a rounded rectangle... here's my code for the for loop that attaches the movie clips...
PHP Code:
for (i=1; i<=totalImages; i++) {
attachMovie("multiplebox", "box_"+i, i);
movieNamer=_root["box_"+i];
}
is it possible to attach a movie inside of 'box_"+i'?
AttachMovie Within An AttachMovie? Not Working
So I've finished a project (let's call it Project Blue) where I use attachMovie which references a folder (of swf's) to place each page of the swf. It worked fine. Next, I made a master 'shell' to place this project (among others) into. To do that I used attachMovie again to place Project Blue in the shell.
But now my attachMovie pages for Project Blue won't show up. Does Flash have a problem with using an attachMovie within an attachMovie?
Thanks for any insight on this....
AttachMovie Nested AttachMovie...
I have in the root timeline an empty movie clip that loads other movies inside of it. Using the attachMovie function.
Inside one of these attachMovie clips I have a nest "attachMovie" clip as well but for some odd reason it's not working. Is there anything I should be aware of when nesting an attached movie?
Positioning Exe's
Is there any way to control the positioning of the .exe's that are being opened?
I have a project that requires 3 different exe's that opens one up after the previous one is finished and the previous one closes. But I want them to be in the same location on the desktop. Right now they cascade down.
any suggestions?
thanx
Bean
Positioning New .swf
People,
I am trying to load a .swf with dimensions of 320 x 240 into the base .swf of 770 x 500, I want to position the targeted swf inside the base and have control over the x and y co-ordinates. Please note these are not movie clips.
And to top it all off I cannot control the size of 320 x 240 It will not import and It is not a native FLASH file.
I am using v5. So....
Is it possible?
If so how do I do this?
Thankyou for any help....I'm desperate
Positioning SWF - X - Y
Hey Guys,
I was wondering what the best way was to position a swf??
I have a main SWF and wanting to load another on top.
example:
on (release) {
loadMovieNum ("example.swf", 1);
}
this loads the swf onto level 1 but is allways positioned
in the top left hand corner when i want it positioned in the center lets say.
Any help would be great.
Thanks
-Mdesign
Positioning An Swf
Hey everyone. I know this has been covered but I cannot find any of the old posts and I am having a brainfart.
I need to load an swf into an MC and position it. I need a frame to call the swf not an object or button. what's the script again? Here is the pseudo code.
//load movie test.swf into the MC called testMC and make sure it;s positioned at _x == 300 ans _y == 3.0
Thanks in advance to anyone who answers.
PS: I may also need to target specific frames in the loaded swf which I also forget how to do. Thanks again to anyone who answers.
X/y Positioning
i have two different actions on buttons calling different movies and am wonderting about positioning x and y....
button 1
on (release) {
_parent._parent.targetClip._x = 112;
_parent._parent.targetClip._y = 110;
_parent.targetClip.loadMovie("test1.swf");
}
button 2
on (release) {
_parent._parent.targetClip._x = 200;
_parent._parent.targetClip._y = 375;
_parent.targetClip.loadMovie("test2.swf");
}
the only way i can get it to work is if i change the instance name to something different (targetClip1) -- is that the only way it can be done? If the instance name is not changed it just loads it in the same x/y position as button1.
Positioning Of Swf In Mc
I have a mc on the root and I am trying to bring in an external swf.
It is bringing the file in but it is positioned to the right and below - how do I get it into the same position as the orginal clip?
Thanks!
My code is below.
on (release) {
tellTarget ("_root.headerModule_mc") {
gotoAndPlay("openSubMenu");
_root.pBOpener_mc.loadMovie("testload.swf");
}
}
Positioning?
Hi
I have been trying to learn by downloading movies and taking them apart. I wanted to learn how to click a button and have a photo slide in from one side and center where I want on the page. My understanding of positioning is useless so I was thinking that maybe somebody knows of a tutorial that explains positioning and how to use it to put things where you want them. I know how basic this is, but I don't understand it and any help would be wonderful.
Thanks
Positioning
I am trying to position the button, the dynamic text boxes, and the drop menu the same on both of my movie clips on different frames. I can't seem to get the positioning working even by typing in the cordinates. Can anyone help?
Pls Help ,swf Positioning
hi,
i am loading a swf file externally ,it is working properly.but what the problem is i want them to load at a particular point.so how do i specify X & Y co-ordinates dyanmically whenever swf file is called.pls help me
As Positioning
is there a way to move a movieclip's position via actionscripting....ie..on(press)///move clip1 to a defined area??
thanks in advance
X And Y Positioning: HELP
Can someone please tell me what I am doing wrong. I have made a mini game (in it's early stages) in which you move a guy around and when he touches the walls he goes back to the red dot in the center (where he starts) Here is the problem. I program to the guy (who is a movie clip):
onClipEvent(load){
moveSpeed=10;
function reset(){
this._x=261;
this._y=173;
moveSpeed=10;
}
}
onClipEvent(enterFrame){
//all the key press stuff
if (this._x>550){
reset();
}
if (this._x<-550){
reset();
}
if (this._y>400){
reset();
}
if (this._y<-400){
reset();
}
}
Now look at the collision bit (the end bit where the If conditions are). That should work right? But when I travel in the negative axis directions, my guy just keeps moving off the screen and then after 7 secs approx it reappears in the center. How come? How can I get rid of the seven sec waiting time. I lowered both negative axis to 15 and it works! Coincedentaly, when I turn on the grid, the width and the height are both 18, near 15. Can someone please help me!
Edit:
Can someone also tell me how to make dynamic text be displayed when the guy resets? (So for example, the guy runs into the side and a message at the top of the screen displays "You bumped into the side so you were reset!"
Positioning?
Is there a way to position Mcs on the stage in one go without having to set the x & y manually for each one?
gabs
[F8] MC Positioning
hey everyone.... I need a hand here...
i've already searched for hours on the net and found nothing.....
well the thing is ....
i have on the library a few movieclips and i need that the moment i open the swf those movieclips position themselves in specific positions, each one in a specific depth as well.
the only way i found to do that was moving the movieclips (i mean, making them enter the scene), but that's no good for me, i need them to be there when i open the file.
that's what i got till now and it's not working...
Code:
var i=10
this.createEmptyMovieClip(floors_mc, i);
function buildStage() {
_root.floors_mc.attachMovie("f001", "f001_mc", i);
_root.floors_mc.f001_mc.onEnterFrame = function(){
this._x = 0;
this._y = 0;
};
_root.floors_mc.attachMovie("f002", "f002_mc", i+10);
_root.floors_mc.f002_mc.onEnterFrame = function(){
this._x = 0;
this._y = 20;
};
_root.floors_mc.attachMovie("f003", "f003_mc", i+20);
_root.floors_mc.f003_mc.onEnterFrame = function(){
this._x = 0;
this._y = 40;
};
};
the movieclips in the library are f001, f002 and f003.....
does anyone know how to solve this??
i thank in advance any intention to help...
Positioning A SWF Using AS3
Hello,
I am trying to bring in a swf file to the stage using ActionScript 3 but am having problems with positioning the file. As it stands the swf plays in the top left corner of the stage, but what if I wanted to change the X & Y position of it, how would I do that?
Here's my script,
stop();
var folioRequest:URLRequest = new URLRequest("scrollingPortfolio.swf");
var folioLoader:Loader = new Loader();
folioLoader.load(folioRequest);
addChild(folioLoader);
Any help would be great, thanks everyone
Positioning
I was wondering if anyone could tell me where to look. I am wanting to create a bar that(about 60 pixels high) that hugs the browser top or bottom and also takes 100% of the browser width. If the person browsing resizes the window the menu bar continues to hugs it programmed position.
Any ideas?
-meylo
MC Positioning
hey everyone.... I need a hand here...
i've already searched for hours on the net and found nothing.....
well the thing is ....
i have on the library a few movieclips and i need that the moment i open the swf those movieclips position themselves in specific positions, each one in a specific depth as well.
the only way i found to do that was moving the movieclips (i mean, making them enter the scene), but that's no good for me, i need them to be there when i open the file.
that's what i got till now and it's not working... 07/07/2006 14:49
var i=10
this.createEmptyMovieClip(floors_mc, i);
function buildStage() {
_root.floors_mc.attachMovie("f001", "f001_mc", i);
_root.floors_mc.f001_mc.onEnterFrame = function(){
this._x = 0;
this._y = 0;
};
_root.floors_mc.attachMovie("f002", "f002_mc", i+10);
_root.floors_mc.f002_mc.onEnterFrame = function(){
this._x = 0;
this._y = 20;
};
_root.floors_mc.attachMovie("f003", "f003_mc", i+20);
_root.floors_mc.f003_mc.onEnterFrame = function(){
this._x = 0;
this._y = 40;
};
};
the movieclips in the library are f001, f002 and f003.....
does anyone know how to solve this??
i thank in advance any intention to help...
Positioning
When an object is positioned, it takes it position based on a certain point on the object. Is there anyway to change that point? For example, if I put an object at 0,0 and the positioning point is the top left corner, can i change it to the top right corner(in this case putting it off the screen).
Y Positioning
I'm using this code within my LoadNav function to position my navigation items vertically - each is postioned based on the previous items _y pos...
onEnterFrame = function () {
for (i=0; i<=item.length; i++) {
this["but"+i]._y = (this["but"+(i-1)]._y+this["but"+(i-1)]._height)+5;
}
};
When a button is pressed an swf loads into that mc, hence the '_height' reference in the actionscript above. The first nav item is positioned at _y = 100, and the others at 120,140,160 etc...
Now whenever i click on a nav item i would like it to repositon at _y = 100, and the others reposition accordingly. e.g if nav10 is pressed it moves to _y = 120 and the others (1-9) repostion at -60,-40,-20,0,20,40,60,80,100
Can anyone think of a way to do this within the onEnterFrame statement above?
Thanks
Xy Positioning
This must be a simple fix, I cannot find it. !!
My objects according to the properties panel are stating negative xy positions, yet on the stage with the xy 00 at top left they should read positive.
Positioning A JPG
hello,
on level 0 :
a button executing : loadmovie("1.JPEG",1) ( loaded to level 1 )
I would like to give a position (x,y) to this picture.
how can I do this?
Thanks for your help
Positioning With AS
i'm trying to build a movie where there are a couple of long bars positioned on the stage on a vertically, like this:
////////////////////// bar 1
////////////////////// bar 2
////////////////////// bar 3
////////////////////// bar 4
////////////////////// bar 5
////////////////////// bar 6
let's say if the user click on any of the bars, say bar 3, how can i make it so that bar 4 will automatically replace it's position but going up 1 step using AS?
and bar 5 will replace bar 4 and so forth.
sorry for not listing out any AS because i don't even know where to start with. this list is killing me but there must be something in AS i didn't know, help need please!!!!
Positioning
Hi guys i need some help. i just finished a flash proyect the problemm is that i'm trying to positionate a movieclip in the far right down corner, the movie i made fills the entire window but i dont know the coordinates for the four corners, i know that 0,0 for x and y puts the movie clip on the up left corner, but what about the others?
thanks in advance guys
Positioning A JPG
hello,
on level 0 :
a button executing : loadmovie("1.JPEG",1) ( loaded to level 1 )
I would like to give a position (x,y) to this picture.
how can I do this?
Thanks for your help
_x, _y Positioning
hi there ..i need some help NOW
i'm trying to let a smartclip (button inside) to tekk a target (markerMC) to position itself ontop of the smartclip ..use the same _x and _y as the smartclip.
on (press) {
gotoAndStop (2);
setProperty ("/marker", _x, this);
setProperty ("/marker", _y, this);
LoadMovie Positioning
= PLEASE HELP = PLEASE HELP = PLEASE HELP = PLEASE HELP =
I am using LoadMovie to load a temporary movie on Level 1 (temporary meaning it will only last about 150 frames). The movie loads and unloads fine.
The Situation: I need the movie to load at a specific place in the main movie (approximately 20 pixels from the left and 35 pixels from the top).
The Problem: Using x Position 20, y position 35 in the LOADED movie- it moves the entire movie, parent and child.
I only need to position the LOADED movie.
= PLEASE HELP = PLEASE HELP = PLEASE HELP = PLEASE HELP =
Duplicating Then Positioning MCs
hi all,
I want to duplicate an MC, say 12 times, then position the clones in a list fashion, i.e. the first clone is 10px less _y than the original, the second clone is 10px less _y than the first.. and so on.
I know that arrays are needed, but i'm not too sure how to approach this in Flash.
Cheers for any and all input,
-Meph
Positioning Text
Ok, here is the deal. I'm using the text effect .fla files from flashkit to put in my site. Everything works but one thing. I can't figure out how to position my text. It trys to put it all on one line. What code will make it part of it on another line and positioned properly under the top line of text. Is there a way to do this? Thanks for your help guys.
Positioning A Movie?
I don't know if this was posted b4 but here goes...
I was wondering if it was possible to manipulate the position of a movie loaded by the LoadMovie action!!
Movie Positioning
Hi Folks
I'm a bit new to the whole ActionScript scene. At the moment I have two flash movies. The first is the main movie (800px*600px), and into this I want to load the second movie (100px*20px).
I have managed to successfully load the second movie in using a button in the main movie:
on (release) {
loadMovieNum ("smallmovie.swf", 1);
}
However, I want to position smallmovie.swf at an exact pixel position. I can't figure out how to do this. I presume I use the _x and _y properties?
Any help would be appreciated.
Cheers,
Kenny.
Comlex Positioning
I made a MC and positioned it like i wanted, but i would like to make some Advance things like use attachmovie because it would be smarter programing, the problem is, as i positioned this MC in another MC just the way i wanted it, when i make this MC with attach and put it on a stage iw wont be aligned like i want it to...so i can try and put some coordinates and after some 10,20 tries maybe i will make it like i wanted it to be, but the thing is that i would like to do following, to see the coordinates of that Mc when i first put it in the other Mc write it down and then use it when i use attach and then position it like it was before....how to do that??
Duplicate MC Positioning
Here's my problem.
onClipEvent (load) {
i = 0;
xpos = 0;
setProperty (_root.oi, _visible, 0);
}
onClipEvent (keyDown) {
i = i+1;
duplicateMovieClip (_root.oi, i, i+10);
xpos = xpos+20;
setProperty (i, _x, xpos);
}
All this code is placed on a movie clip with instance name control.
_root.control
I'm using the above action script to duplicate a movie clip whenever a key is pressed. I want each new movie clip to be positioned right next to (but not on top of) the previous clip. So if my movie clip is 20 pixels wide, I would need to move each succesive clip over 20 pixels. The problem that I'm having is that I can't get the duplicated movie clip to change to a new x position correctly. I think that it has something to do with not having the right path to the new movied clip. But I'm not totally sure.
Each new movie clip would have a the name of the number relative to i, which is incrimented each time a key is pressed. I guess what I want to know, is if there is a way to use the setProperty action with a variable as part of the path name. How would I specify a path to the new movie clip.
Hope that makes sense.
Positioning Problem
I have several objects in several layers(40) and would like to reposition them all (in the center). How can I select all these objects (throught the frames, so position tweening remains constant) and change their position.
My problem is a large portion of my movie is offcenter and I want to center those parts. I don't know how to move them to the to the dead center of the canvas, while keeping the position tweening consistent.
Flixx Positioning
Hey out there.
Problem is this. I make a .swf movie with Flixx. I then use "LoadMovie" level 1. The movie loads fine, but always in the upper-left hand side of the parent movie. I usually adjust the position within the .fla of the movie, but Flixx gives you no .fla. Is there a way I can center it using x and y coordinates when I call the movie in? This might be easy, but it has me stuck for some reason.
Thanks for your help!
Re-positioning A Loaded Swf
How can I re-position an SWF file that I load into another SWF. I am loading it like this:
loadMovie("MovieClip1.swf",500);
That loads the movie fine, but now I need to re-position this loaded clip, but I dont know how to reference it or even if I can.
I tried
_level500._x = #;
_level500._y = #;
but that didnt work.
I can't load the SWF into a holder mc, because it then messes up it's own coding because it assumes the timeline of the holder mc.
Any help?
thanks
.fe.
Positioning A Loaded Swf
Hello All. I know how to load an swf into an MC and position it but is there a way to load an swf into a level and assign it and x and y postion? I thank anyone in advance for a reply.
Positioning Mcs On A Stage
I want to set some movies on a stage, and I wanted to do it randomly; the only proble is that I want to avoid that those movies could intersecate each others. I should use a detection system, but I don't know how to do it, so if anyone knows where I can find some already done or give me any suggestion it'll be great.
TIA
Giano
Positioning Of Movie
I have a main movie and I have to load another short 20 second movie into it.
I have done load movie etc and it loads but the position of the inserted movie is not what i want ..
I tried reading the help files and i understood that I should use target .. ummmmmm but i'm new to this :'(
this is what i had with the level specified .. and it worked but in the wrong place .....
loadMovieNum("C:\Julie\FLASH\NOMusic\Reds Movie.swf", 5);
so i tried this .. (target ?? - I put the name of the file .. :S)
loadMovie("C:\CSI\FLASH\NOMusic\Reds Movie.swf", "Reds Movie");
setProperty("Reds Movie", _x, "650");
setProperty("Reds Movie", _y, "450");
ummm .. it did not think much of that at all
3 hours i've been trying to move this thing grrrrrrrr
Please can someone help me ??
thank youuuuuu
Julia
|