AttachMovieClip
Hola! I'm using duplicateMovieClip to randomly generate and duplicate a certain MC on the stage of my movie. In theory, I thought I could use attachMovieClip(); to attach an MC from the Library (with linkage identifier of course) to a different MC on the stage, setting a higher level for this attached MC than that of the MC w/the duplicateMovieClip(); command. Thus, the MC attached from the library would, in theory, reside on a level higher than that of all of the duplicated MC's. Unfortunately, when I use attachMovieClip and set the level to 100 (or even 999 for that matter) the MC being duplicated (and all duplicated instances) are still on a higher level than the attached MC which is being set to a much higher level? I'm baffled! Please help!Thanks in advance.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-06-2007, 06:42 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do You Use Attachmovieclip?
Hello there, I recently learnt of the attachmovieclip command but haven't been able to use it. I'm assuming this command allows you to run a movie clip that is in the library without having to place it on the stage. I have a Flash movie that contains four scenes; each scene only has five frames. I want a 20-frame movie clip that is in the library to run over/span the four scenes. If anyone can tell me the set up procedure for this I would really appreciate it. Thanks!
K.Rice
Attachmovieclip
Please help me. At the moment I'm trying to make a shooter. I already buid the script that can follow my mouse. I programmed it that if I click a bullet will be fired (This is also a movieclip) The code that I used:
onClipEvent (mouseUp) {
_root.gotoandplay (2)
}
On frame 2 of the main timeline i made the following:
this.attachMovie("Schot", Knal, 1);
Xwaarde = _xmouse;
Ywaarde = _ymouse;
setProperty (Knal, _x, Xwaarde);
setProperty (Knal, _y, Ywaarde);
_root.gotoAndPlay (1);
But when I fire, the bullet isn't going to the right place. The first time I shoot it's good but the second time it fails!
Please help me!!!!
Attachmovieclip
i attached a movieclip using attachMovie
_root.attachMovie("ball", "spot1", 1)
now how do i change its location?
i cant figure it out.
Attachmovieclip Help
How can I make a movie clip attach to the mouse, then, when a key is pressed, a completely new movie clip is attached to the mouse. When the key is pressed again, it removes the new movie clip and attaches the old movie clip to the mouse? I would really appreciate it if any of you could figure it out. Thanks.
AttachMovieClip
Hey,
I was wondering if there was a way to specify an x and y value when attaching a movie clip to another. Say if I had a movie clip called stage and used it as my stage, could I attach movieclips to specific places on the stage movieclip?
Thanks
Jay
Attachmovieclip
Hi there, i am using flash mx 2004 and i wondered if there is any way to attach a mc from library to load in which frame you want. Thanks
AttachMovieClip
hello,
need help. when attaching a mc to the stage, how do i reference the time line in the mc attached? i am using the same code in the main time line with _root. i put the same code in the attached mc but took out _root cause i do not want to use the code in the main time line. the code i need to work is in the mc attached. i have tried home, _parent, this, but none seem to work. would someone be kind to let me know what im doing wrong? thanks
AttachMovieClip Help
hey guys, first post here so be nice
im making a top down racing game whereby the car stays in the same y position and the obstacles / enemies are generated and come from the top, i have managed to code in a rock that generates and falls from the top of the screen, and collides with the user if they dont move out of the way. What i cant work out is how to be able to make duplicates of the clip every time my distance variable gets to a certain number, and have it perform the same actions as the original. any links to tutorials that might help me, or any help from yourselves would be much appreciated
Mat
Attachmovieclip Only If?
Hey everyone. I'm working on a website currently that has 3 container clips in it, where other .mc's load depending on navigation. Everything works great, except for one thing...
The .mc's that work are basically just pics. I also have a scripted phototransition that calls on an .xml file. They work fine except that if I click on a button that is meant to call them into the container clips and they are already there, they duplicate down and to the right on top of the current clip. I end up with a cascading pic transition MESS...
Anyone have any idea what the deal is? I assume I need to completely empty the container clip, and then place the .mcs back into it, but I can't get it to work!!!
Here is the actionscript for the buttons, where movie1, movie2, and movie3 are the pic transition movies:
on (release) {
container1.attachMovie("movie1", "newname1", 0);
container2.attachMovie("movie2", "newname1", 0);
container3.attachMovie("movie3", "newname1", 0);
Thanks in advance!
AS3 Vs AS2 AttachMovieClip
In the previous version of ActionScript, it was possible to do attachMovieClip("myLinkageName") now we can do new MyLinkageName(); where MyLinkageName refer to a Class.
My question is more about a for loop like this:
// AS2
for(var i:Number; i < 5; i++)
this.attachMovieClip("myLinkageName_" + i);
How to do that in Flash if my objects are named like MyLinkageName_0, MyLinkageName_1, etc
Thank's for youyr help
Help With AttachMovieClip
i know how to attach a Movie Clip in one line i did this code
for(i=0; i<10; i++) {
_root.attachMovie("ball","ball"+i, i);
_root["ball"+i]._x=i*_root["ball"+i]._width;
}
so this clip will generate 10 MovieClip in one line
the one i really want to do is i want 10 lines
and each line that will make 10 Movie Clip
how can i achieve this??
AttachMovieClip
when i use attachMovieClip, is there some way i can make it go ontop of the old clip. so that when the new one is finshed "building" over it i can remove the old one, preventing a stackup????
AttachMovieclip
Hi!
I have attached a clip which contains other clips. I can make these clips move but if I want to use them as buttons it doesn't seem to work. I have tryed to use the myMovieClip.onRollOver but without success. What do I have to do to make them react on the mouse?
HELP!
Thankx
Johan
AttachMovieclip
Can someone explain to me the advantage of linking a movieclip and then using the attachMovieclip function instead of just placing the movieclip on the stage in the first place? Does this affect your file size when you publish your movie. I've been watching some movies from lynda.com and they show you how to do this but don't explain the why or when.
Array To Attachmovieclip?
i have an array (this is just a test)
Code:
map = new Array();
map = [[1], [2], [3]];
and i want some code that goes through it and if it = 1 attach movie 1 or if it is 2 attach movie 2 and so on??? how is this done??
AttachMovieClip Question
hi,
i have the following problem : a movieclip in a scene attaches another mc by calling
_root.attachMovieClip('clip','clipat',1);
'clip' itself has a little animation over 15 frames, but after the mc gets attached this animation doesn't run in the scene where i attach it. i just see the first frame of the mc, then it stops.
can anybody help me with this ??
cheers,
alex
Variables And AttachMovieclip
Hi folks:
Can anyone help me out with this problem.
I am creating a flash file to be used by our sales staff which shows our
sales regions within the US. Each region has X # of states in them. Each
region is its own movie clip. When you click on a button associated with the
state three movie clips are loaded. I manually load the first clip which is
called state_template (and then give it a name based on that state (i.e.
maine_temp).
The only thing I use this for is so I can layer the following two mc:
stateBorderTemplate and then a movie clip based on the state button
selected (i.e. maine_mc).
i use the code below:
this.attachMovie( "stateBorderTemplate", "border0", 1);
this.border0._x = 0;
this.border0._y = -185;
//object.prototype.stateName is a global variable that is set when you
release the state button
if (object.prototype.stateName == "maine") {
this.attachMovie( "maine_mc", "maine0", 0);
this.maine0._x = -30;
this.maine0._y = -5;
}
On the stateBorderTemplate there are a series of buttons that highlight
specific sales regions within a state, allow you to navigate around the map
and to zoom in and zoom out. All works well but as you can see, when I start
adding the other fifty states I am going to run into a lot of code. I want
to do this programmatically but I seem to be running into a problem passing
the variables.
On one of the navigation buttons I tried this in various concoctions with no
positive results:
mapToGet = "_parent." + object.prototype.stateName + "0";
trace (eval(mapToGet._y) + " " + _parent.maine0._y);
The stateName in this case is "maine" and so I think the two results I
should get in my trace would be identical (in this case -5) What I get is a
blank and -5. Its only returning the hard coded one. Is there something else
I need to do to the string I am passing (or conversly something i am doing
which I shouldn't) or does this not work with attached movie clips.
Any help would be appreciated
Thanks
Steve
Attachmovieclip Maximum?
Hi guys
It seems to me that there is a maxium of attachmovieclips that Flash is performing.
i've got a movieclip which at a certain frame attaches the same movie to it,parent. when flash reaches to 256 it stops ?? i canot find any documentation on this ??
does any body know something about this??
Attachmovieclip.my.butt
Yargh!
Here's what I have: an introduction with 7 buttons. I want each button to:
Open a scene or movie clip that places a background (it fades in) and
launches a corresponding movie on that background
When that movie clip is done, buttons across the bottom will:
open a new movie clip (on the same background)
and close the other movie clip.
I have had success with placing a blank MC on my background and attachmovieclip to the buttons across the bottom.
I have not had success with launching from the initial 7 buttons. I can place the background, but haven't been able to call the correct MC.
Make sense? Can anybody help?
.attachMovieClip Function
Heeeeeeeeeeelp!!!
My problem is this...
I have an .swf file in an html doc which has navigation buttons on it. I am loading a movie using the onPress which brings in a small transluscent box called("eventsthings") that I want to attach a movie clip to called "calendar" that resides in the same library as the swf "eventsthings".
The window pops up on press and is able to be dragged, reduced and trashed, works fine, however I am unable to bring the attachMovie in and place it on the stage of ("eventsthings") which is on level 3. Here is the code I am placing in the 10th frame of the movie "Eventsthings". The stop is because I have the movie "eventsthings" Tweening in from 0 opacity to larger 100% opacity. It stops on frame number 10 which has the following code in it. Can anyone tell me why it won't attach the movie which I have named event-cal under the linkage. Appreciate all your help
thanks
John
//Stop the tween when the eventsthings.swf opens.
stop ();
//attach to the movie clip instance name "event-win" the //following movie. "event-cal on level 35
_root.event-win.attachMovie( event-cal,event-cal, 35 );
[Edited by jsm-inc on 08-23-2002 at 12:24 AM]
AttachMovieClip...[init Obj] ?
okay what i want to do is attach this mc and with it the code onRelease=closeWin; closeWin is a function. how can i do this using the init obj part of attach mc? ive seen it done like attachMC(...{onEnterFrame:function}); but i cant get it to work. thanks for your help!
Which Is Better...attachMovieClip ...or GoToAndPlay?
I am making a series of Flash movies that displays MCs telling about the area that the cursor rolls over. I have found 2 ways to "skin this cat". One is to use goToAndPlay and it goes to the area of the timeline and plays the timeline with the same basic layout with the new graphics in place. An example would be to have the cursor roll over a photo detail and an enlarged photo of the detail(with caption) would appear on the stage. In frame(1) I would have the photo...in frame 15-25 I'd have the same photo but a graphic of the enlargement would fade in. When the curson rolls out of the area the timeline is directed back to Frame(1). I hope all this talk will make my intentions more clear.
The alternative is to use attachMovieClip and basically do the whole thing with actionscript. Thanks to lukesquall I know how to do this.
My question is...are there any advantages either way? Or just two ways of doing the same task?
AttachMovieClip Not Showing Up
Hi I need a pair of fresh eyes...
Are there some devastating errors in this code...
the "celle" MC has properties and linkage identifier selectet..
nothing shows up??
Code:
start_x = -10;
start_y = 0;
skemaVars = new LoadVars();
skemaVars.load("data.txt");
skemaVars.onLoad = function(success) {
if (success) {
datoer = this.datoer.split(",");
size = datoer.length;
for (j=0; j<=size; j++) {
this.attachMovie("celle", "celle"+j, j+1);
this["celle"+j]._y = this["celle"+j]._height*0.8*j;
}
} else {
trace("Det bare noget lort!");
}
};
stop();
AttachMovieClip + _xscale
Problem:
My mc is attached dynamically using attachMovieClip.
I want to flip the mc using:
_xscale *= -1;
I can't! It flips excactly once and then returns to _xscale = 100; Although I can add to _xscale's value using:
_xscale += 50;
I suspect that it has to do with attaching the mc dynamically since this code works nicely with non-attached mc's.
Code:
if(this.flipVar == true){
this._xscale *= 0.8;
if(this._xscale < 1){
_xscale *= -1;
this.flipVar = false;
}
}
if(this.flipVar == false){
this._xscale /= 0.8;
if(this._width >= this.flipWidth){
this.flipVar = true;
}
}
Does anyone know how to work around this? Even when I place the _xscale *= -1 in onEnterFrame=function() it only flips once and then returns to _xscale = 100 again... When it should flip back and forth on every frame???
AttachMovieClip With Loop
attachMc with loop - now w/ diagram!
For some reason im stuck on this. so i have deleted some of the code to clean it up. I was trying this with no luck:
mc = orgin.attachMovie('mc', 'mc'+i, this.getNextHighestDepth());
I need to attch movie clips to an 'orgin' movie. Im attaching them via a loop like this:
// Place the clip on the stage later to become a member of the activator class
function placeClip() {
// Here im creating the orgin clip that needs to allow the 'mcs' to be attach to it
_root. createEmptyMovieClip('orgin',getNextHighestDepth()
);
// Loop to create fan
for (var i = 0; i<120; i++) {
// Attach the movie clips
mc = attachMovie('mc', 'mc'+i, this.getNextHighestDepth());
// Set degree of each clip
mc._rotation += i*3;
// Have the clip become a member of the activaotr Class
mc.activator();
}
}
Also please see the diagram, although i dont think its really nessessary.
Thanks for the help!
[F8] AttachMovieClip Duplicating Odd
Attempting to make a simple flame effect that follows the mouse. Well that works, except it's duplicating the flame again in an odd fashion and I can't for the life of me work out why! Any help much appreciated.
On the first (and only) _root frame.
PHP Code:
i = 1;
onMouseMove = function () {
decalpos = {_x:_root._xmouse, _y:_root._ymouse};
};
onEnterFrame = function () {
var flame = _root.attachMovie("flame_mc", "flame_mc", i, decalpos);
i++;
};
On the flame symbol (on the first and only frame)
PHP Code:
this._x -= random(5);
this._x += random(5);
this._y -= random(2);
this.onEnterFrame = function() {
this._y -= 5;
this._alpha -= 1;
this._xscale -= 4;
this._yscale -= 4;
if (this._alpha<=20) {
trace("removed");
this.removeMovieClip();
}
};
.fla attached
AttachMovieClip Problems
What is wrong with the code below? I managed to do this before but somehow I can't do it again. I have a MC in the library called rocket, it is also linked for actionscript with rocket as identifier.
Code:
var oMouseListener:Object = new Object();
oMouseListener.onMouseDown = function():Void
{
trace ( "mouseClick detected" );
this.attachMovie( "rocket", "newRocket", getNextHighestDepth );
}
Mouse.addListener(oMouseListener);
BTW Am I alone in thinking that adding the datatypes (like Object();, function() etc is only taking away from readability? I don't see any advantages to this...
Preloader For AttachMovieClip
Hi,
Does anyone know how to actionscript a preloader to use on a movieclip that is attached using attachMovieClp and that loads in jpegs dynamically?
Many thanks
UISCroll + AttachMovieClip + HELP
So I have read the How to on addint UI Compoents Dynamically and for some reason it doesn't work me.
I have on dynamic text field on stage, with the instance name "info_bx"
Here is the code I'm using
attachMovie("UIScrollBar", "myScrollbar", 20000, {_targetInstanceName:"info_bx", horizontal:false});
myScrollBar._x = info_bx._x;
myScrollBar._y = info_bx._y;
myScrollBar.setSize(info_bx._height);
The problem is that it will not attached to the text field.
HELP
Where do I look to trouble shoot something like this? Is there something wrong with my code?
Attachmovieclip Question
Hi,
Thanx to jjbilly I've got this code to export a movieclip and display all the duplications in a circle.
Code:
//define the centre of your circle
var oX : Number = 200
var oY : Number = 200
//define the radius
var rad : Number = 200
//the number of buttons
var buttons : Number = 20
//work out how big the angle is between each button:
var delta : Number = 2*Math.PI/(buttons)
//assuming you are attaching your buttons to this:
for (var i=0; i<buttons; i++)
{
this.attachMovie("testje2","button"+i,i,{_x:oX+Math.cos(i*delta)*rad,_y:oY+Math.sin(i*delta)*rad})
}
It works great, but is it possible to give each exported movieclip an own unique instance name? so i can apply this drag and drop function to them:
Code:
exported_mc1.onPress = function() { this.startDrag();
};
exported_mc1.onRelease = function() {
stopDrag();
};
In other words, how do you export a movieclip and export unique instance names with them? Like exported_mc1, exported_mc2 etc.
I know you can give instance names to new blank movieclips with
existing_mc.createEmptyMovieClip(newinstancename, depth);
But i dont know how to combine that code with the code above, each exported movieclip has to be created inside the new movieclip created with createEmptyMovieclip. The amount of empty movieclips has to be variable, the amount of exported movieclips has to be equal to that variable.
Attachmovieclip Problem
Hello all,
What i want is to attach a movieclip that is attached to the _root.
Here is what I have,
function component(label)
{
_root.attachMovie("roundledcomponent", "roundledcomponentHolder",
this.getNextHighestDepth());
_root.roundledcomponentHolder._x = 100;
_root.roundledcomponentHolder._y = 100;
_root.roundledcomponentHolder.attachMovie("up", "upHolder",
this.getNextHighestDepth());
_root.roundledcomponentHolder.upHolder._apha = 50;
} //end function component
I am sure the properties for roundledcomponent and up are ok, i do get the
roundledcomponent.. the up wont attach to the roundledcomponent.
Any ideas?
regards,
Peter
AttachMovieClip Issues
Hi All,
I am attaching a movie clip from the library.
The movie clip has a FLVPlayer inside it.
The instance name of the player is "myPlayer"
_root.attachMovie("play_mc", "playClipmc", _root.getNextHighestDepth())
after attaching that i am loading the video inside the attached movie clip
_root.playClipmc.myPlayer.load("mov.flv")
_root.playClipmc.myPlayer.play()
This is not playing the FLV.
Can anyone tellme how to fix this issues please.
Thanks & Regards,
Sridhar B
Attachmovieclip Question
When you attach a movie clip does it have the same code in it as the original? I only ask because when i tried to the code in it didn't run.
Attachmovieclip To Stage?
How do i attach a movieclip to the stage without dragging it from the library. Also how do I tell it where to appear on the stage?
AttachMovieClip(); Problem - Lag
I'm making a game that makes lines after a moving object. First I used the dulpicateMovieClip(); function but that made it lag. So then I modified the script to attachMovieClip(); this still makes it lag after awhile. None of the movie clips I am duplicating have script in them. Also after awhile I use the unloadMovieClip(); function but it still lags. I have also used the removeMovieClip(); function
Here is some of the script:
Code:
if (mySpeed>.5) {
_root.trail1.createEmptyMovieClip("1trail"+i, count);
_root.trail1["1trail"+i].lineStyle(10, 0x0099FF, 20);
_root.trail1["1trail"+i].moveTo(car._x, car._y);
_root.trail1["1trail"+i].lineTo(newcarX, newcarY);
count += 1;
i++;
_root.trail1array[_root.trail1arraySize] = i;
_root.trail1arraySize++;
updateAfterEvent();
}
and
Code:
for (l=0; l<_root.lazerarraySize; l++) {
if (_root.wall1.hitTest(_root["bluelaz"+_root.lazerarray[l]]._x, _root["bluelaz"+_root.lazerarray[l]]._y, true)) {
_root["bluelaz"+_root.lazerarray[l]].play();
} else {
_root["bluelaz"+_root.lazerarray[l]]._x += Math.cos(Math.PI/180*(90-_root["bluelaz"+_root.lazerarray[l]]._rotation))*8;
_root["bluelaz"+_root.lazerarray[l]]._y += -Math.sin(Math.PI/180*(90-_root["bluelaz"+_root.lazerarray[l]]._rotation))*8;
}
}
Note: in the one above blueLaz.play(); plays the movieclip and the at the end removes it.
Thanks for any help.
AttachMovieClip In Functions?
Hey all!
Im sorry to start on this forum with.. well a terrible question I suppose.
Ive been messing around with actionscript for a while now and ive been able to find out most of my problems on my own. This one make no sense.. at all. Ive searched on this forum, and on the internet for answers to this stupid problem.
Here it goes!
Code:
i = 1;
onEnterFrame = function ()
{
function randBalPlacement ()
{
i++;
this.attachMovie("bal", "newName_" + i, 20);
var bal:MovieClip = _root["newName_" + i];
var xCo:Number = Math.floor(Math.random() * (400 - 200)) + 200;
var yCo:Number = Math.floor(Math.random() * (400 - 200)) + 200;
bal._x = xCo;
bal._y = yCo;
}
randBalPlacement ();
}
The attachMovie part is placed inside a function in this script. It does nothing though, and thats the problem. However when I delete the function part as seen below it acts like it should.
Code:
i = 1;
onEnterFrame = function ()
{
i++;
this.attachMovie("bal", "newName_" + i, 20);
var bal:MovieClip = _root["newName_" + i];
var xCo:Number = Math.floor(Math.random() * (400 - 200)) + 200;
var yCo:Number = Math.floor(Math.random() * (400 - 200)) + 200;
bal._x = xCo;
bal._y = yCo;
}
Is there any specific reason that attachMovie doesnt work in a function? And what are possible solutions for this problem?
Thx,
ArmoredSandwich AKA ImWithNoob
Attachmovieclip Question
When you attach a movie clip does it have the same code in it as the original? I only ask because when i tried to the code in it didn't run.
AttachMovieClip, Limitation ?
Hi everybody.
Allright, in a personnal project i use the 'AttechMovieClip' funtion in order to change the menu in my interface.
There is submenus (mcs) in the menu (this is the mc that i change by using attachmovieclip)
menuHolder
|------- Menu1
|------- submenu01
|------- submenu02
when i do an attachMovieclip, it changes the menu but seems to erase the instances names of my submenus clips contained in my menu:
menuHolder
|------- Menu2
|------- ?? (The submenu is there but no instance name)
|------- ?? (The submenu is there but no instance name)
Can someone tell me how can i keep the instance name of movieclips place in a movieclip that's been change using the function attachMovieClip.
Thanx;
AttachMovieClip Problem
Evening all...
I am still new to Actionscript and have been experimenting with attachMovie and removeMovieClip... my problem seems to revolve around attaching and removing the same movie clip a number of times. The first time I attach the movie clip it works perfectly - but when it is removed and later re-attached it no longer works and the fla no longer seems to recognise it as a movie clip.
If you attach a movie clip and then remove it, can you then re-attach it later with the same instance name and expect it to function in the same way?
Cheers for any help...
David
AttachMovieClip Problem.
Hey guys... Yet again.
I did this simple block of syntax:
Code:
var menuItems:Array = ["Home" , "Projects" , "About Us" , "Contact Us"];
var menuLength:Number = menuItems.length;
function generateMenu() {
//Generates Menu Items
for (var m = 0 ; m < menuLength ; m++ ) {
trace("making button: " + m);
trace(main);
var menumc = main.attachMovie( "btnModel_mc","menuItem" + m , _root.getNextHighestDepth() );
menumc._y = -18;
menumc._x = 18 + ( 200 * m);
menumc.buttonItem.itemLabel.text = menuItems[m];
trace(menumc);
}
}
Basically, I loop through the array and make buttons.
Setup is right, syntax is right, but for some weird reeason, I only get the fourth button, the "contact us".
All the traces show up fine, but either the first three are blocked or just doesn't show.
After it loaded I've tried:
"Debug" --> List Objects
to see what was on stage and to see if they were blocked, and lo, they aren't on the stage except the fourth one. The loop is fine, array is fine, but the first three just don't get shown or really 'attached'.
Anyone know what the problem might be?
Thanks,
Keehun
AttachMovieClip Is Not Working Plzzzzz HELP
i create two mcs w/ rootshape and target as instances.
In my code, I used duplicateMovieClip to create 6 instances
of mc rootshape and 3 instances of mc target dynamically as
the movie is played. It's obviously not working.
When I play the movie, only 3 rootshape instances and
3 target instances are created. The funny thing is that
when i swaped the location of the for loops, i got 6
rootshape instances but i don't get the 3 mc target
instances. PLEASE HELP..i'm sooo lost. thx in advance
//*******************code*************************** ***
numberOfShapes = 6;
numberOfTargets = 3;
distanceApartY = 100;
distanceApartX = 250;
distanceApartX1 = 250;
distanceApartY1 = 500;
for (i = 0; i < numberOfShapes; i++)
{
duplicateMovieClip("rootshape", "shape" add i, i+1);
//Set the shape's position on stage
if (i % 3 eq 0 && i ne 0)
{
distanceApartY += 150;
distanceApartX = 250;
}
setProperty("shape" add i, _x, distanceApartX);
setProperty("shape" add i, _y, distanceApartY);
distanceApartX += 150;
}
for (j = 0; j < numberOfTargets; j++)
{
duplicateMovieClip("target", "target" add j, j+1);
setProperty("target" add j, _x, distanceApartX1);
setProperty("target" add j, _y, distanceApartY1);
distanceApartX1 += 150;
}
//Set the original shape movieclip outside of stage,
//and make it invisible
setProperty("rootshape", _x, -1000);
setProperty("rootshape", _visible, false);
//Set the original target shape movieclip outside of stage,
//and make it invisible
setProperty("target", _x, -1000);
setProperty("target", _visible, false);
stop();
//***************end code******************************
Attachmovieclip Inventory System?
I am attempting to generate an inventory system. When you roll over an item and press "o" for obtain, it disappears from the stage and goes into your inventory (press "i" to view"), to show the item in the inventory, I cant use the simple _x and _y, I have to create "spots" to hold the items. NEbody know how this can be done?
Here is my attempt:
AS2 Question - AttachMovieClip From Within A Class
Well I'm trying to get into classes now - sigh - I feel really stoopid in AS2.
Anyway just wondering if someone can help me. I want to attach a movie clip from within a class method. I've got the MC in the movie library with all the linkage set up.
Can I use attachMovieClip in a class method? Or so I need to set up a variable in the class that will activate a script in the main movie?
Thanks for any help
ss
AttachMovieClip(); Addresing Problem
Hello all,
I have a little problem and i hope you could help (pleasee). Here is the source of my problem:
Code:
for (var i=0 ; i < songdata.length ; i++) {
list = attachMovie("songlist", "songlist" + i, i);
list._x = 58;
list._y = 37+(15*i);
}
// songdata is an xml object with max count of 4 rows (songlist3 - biggest)
So my problem is: i have a Button exported for AS with the name "songlist", inside this button i have a textfield called "ime" how could i set the textfield of every created (new) Button with a diffrent value... i have tried something like:
Code:
songlist0.ime = "some text here";
but with no success, is there anyone who can help me ? please !
Thanks in advance.
Regards,
Lyubomir Lyubenov
AttachMovieClip Without Exporting In First Frame?
Is there any way to attach a movieClip to a dynamically generated mc, without "exporting for actionscript" in the first frame? It seems to be slowing my movie way down by doing it this way.
thanks in advance for any assistance,
Jay
AttachMovieClip Positioning Problem
I want to attach movie clips and set their positions relative to each other, with 30 pixels of space between them, as the code shows:
ActionScript Code:
attachMovie("mc_btn", "mcBtn0", getNextHighestDepth(), { _x:34, _y:330, _alpha:0 });
attachMovie("mc_btn", "mcBtn1", getNextHighestDepth(), { _x:(mcBtn0._width + 30), _y:330, _alpha:0 });
attachMovie("mc_btn", "mcBtn2", getNextHighestDepth(), { _x:(mcBtn1._width + 30), _y:330, _alpha:0 });
attachMovie("mc_btn", "mcBtn3", getNextHighestDepth(), { _x:(mcBtn2._width + 30), _y:330, _alpha:0 });
The second button (mcBtn1) is positioned correctly. The rest are at the same position. See trace:
ActionScript Code:
mcBtn0._x = 34
mcBtn1._x = 154.85
mcBtn2._x = 154.85
mcBtn3._x = 154.85
What am I doing wrong? Thanks for your help.
Windows Using AttachMovieClip, RemoveMovieClip?
here is the deal, on the main canvas I have buttons, when you click them they load a movie clip. that works i'm using the code.
Code:
songBtn.onRelease = function(){
this.attachMovie("song_info", "song", this.getNextHighestDepth(), {_x:100, _y:100});
}
then inside the movie clip "song_info" i have a closeBtn, used to close the windows. i'm not sure what to put into the code though. I've tried a few things like
Code:
closeBtn.onRelease = function(){
this._parent.removeMovieClip();
}
closeBtn.onRelease = function(){
removeMovieClip(this);
}
but it doesn't seem to work and i'm a little stuck... how do i get the close button to close the movie clip it's inside?
AttachMovieClip Not Transfering Code?
i made a movie clip and made it so when i clikc on it another movie lip is created inside. That movieclip should move forward but is doesn't. look at the 10 lines of code and try and find a problem. Heres the code if u don't want to look at the .fla
on the box:
Code:
on (press) {
++i
_root.box.attachMovie(_root.bullet,"bullet"+i,i)
}
on the bullet:
Code:
onClipEvent (load) {
this._x = _root.box._x;
this._y = _root.box._y;
}
onClipEvent (enterFrame) {
if (this._name != "bullet") {
this._y -= 5;
}
}
Attachmovieclip On A Particulat Layer
hey,
I've got 3 layers..
Layer ONE
Layer TWO
Layer THREE
And I have this attachmovieclip() code...
Code:
_root.attachMovie("Character", "MainC", 1, {_x:198, _y:192});
However.. it always puts my movieclip on the top-most layer.. how do i make it so it puts the movieclip in "layer TWO"?
Thanks
|