The Greate Problem With Names Of Attached Movies
Please, help me! I attach any movieclips with for loop:
Code: for(var i=0;ii<=10;i++){ attachMovie(“asd”,”mc_”+i,-i); }
How can I appeal to them later? Where can I keep their names for to use them?
FlashKit > Flash Help > Flash ActionScript
Posted on: 06-26-2005, 04:51 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Working With Dynamically Attached Movies Inside Dynamically Attached Movies
I'm trying to work with a movie I dynamically attached inside of another movie, what is wrong with this code for setting the _x and _y of the inner most movie, and how do i fix it?
Code:
this[iButton].attachMovie("More","M"+iButton,1000+iButton);
this[iButton].["M"+iButton]._x = 10;
this[iButton].["M"+iButton]._y = 10;
Attached MC Instance Names Disappear
I have a small problem over here. I've attach an MC with attachMovie() and the instance names that were inside of that MC disappeared.
ActionScript Code:
getWinLogin.onRelease = function() { zona.createEmptyMovieClip("winLogin", getNextHighestDepth()); zona.attachMovie("winLogin2", "winLogin", getNextHighestDepth());}zona.winLogin.login.onRelease = function() { trace(zona.winLogin.fieldUser);}
Any ideas what the problem is?
Thank you in advance.
Finding Instances With Instance Names Attached And There Location
I'm working on a site that I received from a co-worker and it’s done with AS2 and the code and instance names are all over the place and it’s really hard for me to follow the code path to change things. I know how to track down what frames and elements have actions through the actions panel but what kind of stumping me is how to find instances with instance names on the stage that are scattered all over the instances that make up the movie.
Is there a way to get a log of what instances have instance names attached to them and where they are located in the timeline?
Thx u for the help
John
Instance Names With Loop Values Attached To The Name Possibl
Hi everyone, I was just wondering if it was possible to have loop values attached to variable or instance names.
I know that it is possible in certain situations such as the createEmptyMovieClip() or the attachMovie() where you can declare the new instance name+the value of the loop but I was hoping to be able to expand beyond that to use with properties such as ._x
I'm looking for a way to set the properties with loops instead of having to physically type them out
i.e.
mc_1._x
mc_2._x
I hope this question makes sense and doesn't confuse anyone
How Do I Change The Menu Item Names? [flash File Attached]
I bought this template and I can't seem to figure out how to change the item names on the menu - they all say "Home" when I open it in flash 8 - you'll see what i mean when you open the file
Also where it says the date when you open it in flash it says "'hukl tyui ryui ty" so i m trying to figure out how to do those two things.
Thnx in advance for the help
(I know the file is big but please be patient and help the nooby) -lol
Download Here
Attaching Movies From Attached Movies
Hi I'm trying to attach a movie from another attached movie but having problems.
I'm generating a bunch of lockers using a for loop and they are being attached to an empty mc called lockergroup, passing the initobject so I can get locker numbers on the lockers.
Then when you click on one of these lockers I'm trying to attach a "large open locker" movie above all of the other generated lockers, but it's not going to the highest level no matter what I try to use (_root.getNextHighestDepth(), etc). I need to use attach instead of load so I can pass the locker number to the open locker mc. Anyone have any ideas on how to pass the locker number or bring the open locker mc to the front?
thanks
The Id's Of Attached Movies
if u have a for loop attaching movies to say, _root, it would look like this:
for(i=0; i<something; i++){
_root.attachMovie("movie", "movie"+i, i)
}
however, if u have a nested loop looking like this:
for(i=0; i<something; i++){
for(j=0; j<something2; j++){
_root.attachMovie("movie", "movie"+i+j, i*j)
}
}
with the first loop, i is a unique number each time, so each mc attached has a unique id. however, in the second example, if something and something2 are the same array, or at least are arrays with the same length, i dont see how to create unique id's, since there will always be matching pairs of i and j, such as 2-1, and 1-2 and so on. my solution has been to use really large random numbers, but somtimes there are two conflicting mcs that delete each other. how could i generate a unique random number every time, or a unique id somehow? thank you, i await your replies
Cant See My Attached Movies
Hi ,can someone pls tell me why this code shows nothing on playback; I was expecting to see a vertical line of mc instances on the leftish side of the stage.
Ok: theres an mc in the library called cell.
then there is this code in the first frame of the root movie
init();
function init(){
var ydiff= 0;
cells_array= new Array();
var max = 30;
for (k=0; k<max; k++){
cells_array[k]=attachMovie("cell","c"+k,k);
cells_array[k]._x=250;
cells_array[k]._y=0 +ydiff;
ydiff += 1;
trace(cells_array[k].y);
}
}//end init
- trace just gives 30 undefined's.?
Thanks in advance.
How Do You Target Attached Movies?
okay, so i am trying to use attachMovie to put a bunch of instances of the same MC from the library on the stage when my movie starts. the MC has a dynamic text field. i want each new instance to have different text. but i am having a terrible time trying to target the new instances.
anyone have any experience with this? i can't get it to work. either they all same, or none work. it would seem like this path would work:
_root.placeHolder.newName.textField
but no luck. any help would be appreciated.
josh
Positioning My Attached Movies?
Hi, trying to attach my movie 'transition' in the centre of my movie. done this before without probs but now i cant get it to move... wheres my code gone wrong?
on (press) {
this.attachMovie("transitions", "trans", 1);
trans._x = 97.3;
trans._y = 172.8;
}
thx for any help
lev
Attached Movies And Buttons
Hey Everybody,
I created a custom menu for a website with a sublinks menu that gets imported to the movie on a button's mouseover event. The problem is that I had to create an onMouseOut event so that the submenu didn't stay on the page. When the submenu is only a movie it works great, but I can't link to anywhere. When I create buttons within the movie it seems that the buttons take precedence over the movie object and the program thinks the onMouseOut event happened.
Here's some of the code.
Main button code:
on(rollOver){
loadMovie("images/screen_sub.swf","mv_submenu");
}
Movie Holder code:
on(rollOut){
unloadMovie("mv_submenu");
}
Basically I have an oversized movie holder that allows for standard mouse slop when the user is over the menus.
Like I said, if the submenu is only a movie then it works great, but that doesn't help me to link to different pages.
Thanks for your help.
Checking For Attached Movies
HI, can anyone tell me if there is a way to check a particular movieclip to see if it has any attached movies?
Cheers
How To Remove Attached Movies?
I am using the following code to create dots on a movie clip called mcMapHit:
Code:
stop();
var i:Number = 0;
mcMapHit.onPress = function(){
i++;
_root.attachMovie("mcTack","mcTack" + i,i,{_x: _root._xmouse, _y: _root._ymouse});
};
The dots are instances of a movie clip with a linkage named "mcTack". All is fine except that I do not know how to remove the dots when the user presses a close button (named mcClose) to close the parent movie clip.
I tried the following code (placed just after the code above) but it does not seem to do the trick:
Code:
mcClose.onRelease = function(){
for (var j:Number = 0; j < i; j++) {
mcTack[j].removeMovieClip();
}
_root.mcMapAppear.gotoAndPlay("close");
};
"mcMapAppear" is the name of the parent movie clip called on the root stage.
I'm pretty sure I am trying to refer to the attached mcTack instances incorrectly but am not sure how to do it.
Masking Attached Movies
I'm having problems restricting attached movies to only one area on a movieclip. I've attached the fla with the problem I am having (circle drop.fla). To start, the user selects the "Press to Start" button. Next, the user can drop any number of circles in the shaded box area. They can also scale the size of the circles as they drop them in the box by holding the mouse key down and dragging after each circle is dropped. The problem I am having is that if the circle is too big it expands outside of the shaded box. I want to restrict the circle to only being visible in the box area. However, I am having troubles figuring out how to restrict the circles to a mask (defined by the mcMap movieclip). I am able to mask one at a time, but as soon as another circle is dropped the mask stops covering the previous circle and only masks the most recent circle dropped.
Masks Over Attached Movies
Hi all
I have a bunch of attached movieclips and I want to have a mask (just a layer over top) in the main movie that will cover the attached clips, but the atached clips always appear over the mask. The attached clips are being assigned getNextHighestDepth, but not to the root.
How can I make sure the mask layer is always at the highest depth??
Addressing Attached Movies?
Hi,
i have a situation like this :
on the first frame of the root i have this piece of code :
ActionScript Code:
function createCar():Void
{
var car_mc = carAttach_mc.attachMovie("car", "car" + carCount, depthCount++);
trace(car_mc);
car_mc._x = carXPos;
car_mc._y = -car_mc._height;
car_mc.setValues(carTtl, carLength, carScale);
carCount++;
}
the creation works, and my new car appears on the right ._x position.
The movie that has "car" as linkage in my library HAS a function setValues, on the first frame of his root, and still this function is never called.....
Even stranger is this : i tried to hardcode this :
i added this line in the function
ActionScript Code:
_root.carAttach_mc.car0.setValues(carTtl, carLength, carScale);
and then the function 'setValues' really was called, but not when the function created 'car0', but on the second time the function got called, so when it created car1.
So the only thing that i can think about is that the problem could be that you can't call functions on attached movies, immediately after they are created.
Does anybody know a way around this??
thanks!
Deleting All Attached Movies
So I've used .attachMovie() to attach a bunch of movie clips.
What's the simplest way to delete them all at once?
I could add each clip to an array when I create them, and then cycle through the array and removeMovieClip() each one, but it occurs to me there may be a simpler way.
Remove Attached Movies
I have a movie called "my.fla" in which I attach some MC's.
I also have buttons that load swf's in a "container".
But when I test the buttons, the attached MC's in "my.fla"
keep appearing before the swf loads.
I tried EVERYTHING with removeMovieClip, but I can't get it
to work!!(The swf's I load also have attachMovie in them)
Code:
MovieClip.prototype.attach = function(base) {
base["content"+nr].attachMovie("shirt_"+nr, "clip"+nr, nr);
if (nr == tot) {
clearInterval(id);
}
nr++;
};
id = setInterval(attach, 400, this);
//button:
btn_1.onRelease = function() {
loadMovie("my_1.swf", "container");
};
Can someone help me with this?
thanks!
Attached Movies Issue
I have attached largewall_mc and the I make a second attached copy. Fine. But if I try to make a third copy of same largewall_mc I get just two mc when run swf... why? is there a limitation with this
this code works:
Code:
this.attachMovie("largewall_mc", "largewall_mc", this.getNextHighestDepth())
_root.largewall_mc._x = 475;
_root.largewall_mc._y = 50;
this.attachMovie("largewall_mc", "largewall2_mc", this.getNextHighestDepth() ["largewall_mc"])
_root.largewall2_mc._x = 275;
_root.largewall2_mc._y = 50;
this not:
Code:
this.attachMovie("largewall_mc", "largewall3_mc", this.getNextHighestDepth() ["largewall_mc"])
_root.largewall3_mc._x = 375;
_root.largewall3_mc._y = 50;
Remove Attached Movies
I have a movie called "my.fla" in which I attach some MC's.
I also have buttons that load swf's in a "container".
But when I test the buttons, the attached MC's in "my.fla"
keep appearing before the swf loads.
I tried EVERYTHING with removeMovieClip, but I can't get it
to work!!(The swf's I load also have attachMovie in them)
Code:
MovieClip.prototype.attach = function(base) {
base["content"+nr].attachMovie("shirt_"+nr, "clip"+nr, nr);
if (nr == tot) {
clearInterval(id);
}
nr++;
};
id = setInterval(attach, 400, this);
//button:
btn_1.onRelease = function() {
loadMovie("my_1.swf", "container");
};
Can someone help me with this?
thanks!
Attached Movies Not Working
Please can someone look at my code and explain why the attached movies when they are bigger than the stage go to the next line but tahy stay all in the same location
Code:
Stage.scaleMode = "noScale";
Stage.align = "TL";
var galXml:XML = new XML();
galXml.ignoreWhite = true;
this.createEmptyMovieClip("holder", this.getNextHighestDepth());
var gap:Number;
galXml.onLoad = function(yes) {
if (yes) {
var xmlRoot = this.firstChild;
trace(xmlRoot.childNodes.length);
_global.total=xmlRoot.childNodes.length
for (var i:Number = 0; i<xmlRoot.childNodes.length; i++) {
var photos = xmlRoot.childNodes[i];
//var leg = xmlRoot.childNodes[i].firstChild.firstChild.nodeValue;
var pic = xmlRoot.childNodes[i].lastChild.firstChild.nodeValue;
//trace(pic);
var pictures = holder.attachMovie("thumb_mc", "thumb_mc"+i, i);
pictures.empty_mc.loadMovie(pic);
/*
pictures._x = 0+(pictures._width+10)*i;
if (holder._width>Stage.width) {
pictures._x=0+gap
pictures._y = 150;
gap+=180
}
*/
if (i == xmlRoot.childNodes.length-1) {
trace(holder._width);
}
}
} else {
_root.info_txt.text = "there was an error loading the xml";
}
};
galXml.load("xml/gallery.xml");
the xml
Code:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<gallery>
<photo>
<name>Alexandre </name>
<img>images/small/alex_thumb_1.jpg</img>
</photo>
<photo>
<name>Angela </name>
<img>images/small/ni_thumb_1.jpg</img>
</photo>
<photo>
<name>Alexandre </name>
<img>images/small/alex_thumb_1.jpg</img>
</photo>
<photo>
<name>Angela </name>
<img>images/small/ni_thumb_1.jpg</img>
</photo>
<photo>
<name>Alexandre </name>
<img>images/small/alex_thumb_1.jpg</img>
</photo>
<photo>
<name>Angela </name>
<img>images/small/ni_thumb_1.jpg</img>
</photo>
</gallery>
thanks
Targetting Attached Movies
[Flash 8]
Hi,
I attached some movies based on an array pulled from an XML file. eg.
for (var k=0; k < accountArray.length; k++){
var thisAcc:MovieClip = _root.ledgerContent.attachMovie("accLedger_mc","ac countMC"+k,_global.cDepth);
Now I want to do a hitTest on each of them when a dragged movieclip is released. How do I put a variable into a target path so that I can create a loop for the length of the array? eg.
for (e=0; e < accountArray.length; e++){
if (draggedLoc == null){
if (ledgerContent.accountMCe.credit.hitTest(_root.dragable1.dragBut)) {
draggedLoc = "credit";
trace ("Dragged to "+accountArray[e][1]+" - credit");
} else if (ledgerContent.accountMCe.debit.hitTest(_root.dragable1.dragBut)) {
trace ("Dragged to "+accountArray[e][1]+" - debit");
draggedLoc = "debit";
} else {
draggedLoc = null;
}
}
}
The above doesn't work of course.
[F8]2 Attached Movies' HitTest
So, I have in my vertical shooter game a bullet and a flag (enemy) that are attached properly and fly up and to the left, respectively. I am able to delete both the flags and bullets when they go off screen, because I know how to say:
_root.enemy.onEnterFrame(){
this.deleteMovieClip();
}
The problem arrives when I want to connect the two. How would I code a hitTest between one of the bullets and one of the flags? I uploaded my fla here: http://www.megaupload.com/?d=H4LBGTHE
Remove Attached Movies
I have a movie called "my.fla" in which I attach some MC's.
I also have buttons that load swf's in a "container".
But when I test the buttons, the attached MC's in "my.fla"
keep appearing before the swf loads.
I tried EVERYTHING with removeMovieClip, but I can't get it
to work!!(The swf's I load also have attachMovie in them)
Code:
MovieClip.prototype.attach = function(base) {
base["content"+nr].attachMovie("shirt_"+nr, "clip"+nr, nr);
if (nr == tot) {
clearInterval(id);
}
nr++;
};
id = setInterval(attach, 400, this);
//button:
btn_1.onRelease = function() {
loadMovie("my_1.swf", "container");
};
Can someone help me with this?
thanks!
Attached Movies In Loaded Swf
Hi there
I am having a problem with load swfs into
my main movie. most of the swf have the attach
movie script in them and they work fine with played
on there own but with I load them into the main movie
the attach movie don't show up. what am I doing wrong
haven't been able to work it out
thanks for your help
mac-10
Clearing All The Attached Movies ? How
I got this
Code:
soundXml.onLoad = function(){
var nodes = this.firstChild.childNodes;
numOfsounds = nodes.length;
for(var i=0;i<numOfsounds;i++)
{
var t = home.attachMovie("button", "button"+i, i+1);
blah blah
all my movies load and all that, but then i have a differnt button that loads another XML.. so all i did was soundXML.load("different.xml"); but the problem is if there is less records in the new xml the old ones stay the same... how can i refresh.. or delete all the old ones right before loading the xml? please help..
Masking Attached Movies
Is it possible to mask movies that are attached to the stage with actionscript. I have a slide show of sorts and would like to mask one slide with some effect and have the other slide underneath show through. How would I go about doing that?
Using Variable Names To Load Movies
Okay in an mc on my main timeline on a speceified keyframe I have the following code:
Code:
loadMovie("scrollout.swf", "_root.left_intro.scrollOutCont");
current_Mov="people";
title="peopleTitle";
nav="people";
Then scrollout loads and plays and on different keyframes in "scrollout" I have the following calls to load movies based on the variables above.
Code:
loadMovie(title + ".swf", "titleCont");
loadMovie("Mov_" + current_Mov + ".swf", "_root.pictCont");
LoadMovie(nav +"_nav.swf", "navCont")
But I get an error message because my variables aren't being passed.
here's the error message
Code:
Error opening URL "file:///documents/%2A%2A6MX/working/.swf"
Error opening URL "file:///documents/%2A%2A6MX/working/Mov_.swf"
Error opening URL "file:///documents/%2A%2A6MX/working/_nav.swf"
So how can I pass variables from my main timeline to my "scollout" movie to ensure that the proper movie gets loaded?
thanks
Loading Movies With Button Names
Hello,
I have been struggling with this issue for a while now, which may seem easy as pie to most of you. My issue is with attaching movie clips with buttons. I want to make a button, give it an instance name and then attach code that goes something like this:
on(press){
movieHolder.attachMovie(this._name,this._name,0);
}
This does not work and never has. My solution to this has always been to put the button INSIDE of a movie clip, name the movie clip and then place this code down:
on(press){
_parent.movieHolder.attachMovie(this._name,this._n ame,0);
}
So my question is, is there a way of making a button load clips dynamically without incessantly placing them all in movie clips and bloating my library?
I have attached a file to demonstrate. Solving this would be great.
Controlling Attached Movies (should Be Really Simple)
so i have a simple:
PHP Code:
someVar=3;
for (i=0;i<someVar;i++){
attachMovie(varClipToPull;"clip"+i;i);
}
so this puts clip0,clip1,clip2,clip3 on my stage and i need to refrence those clips...
im having a slight problem remebering how i refrence thsese clips now.
ive tried
PHP Code:
clip[i]._visible = false;
or
PHP Code:
clip["i"]._visible = false;
and even (which is obviously wrong)
PHP Code:
"clip"+i._visible = false;
so, how can i control these clips?
thanks.
Delete Attached And/or Duplicated Movies
I have several attached and duplicated movies in a game that I am creating. I am building in an option to go back to the main menu in the middle of the game, but when I go back all of the duplicated/attached movies are still there. Is there an easy way to delete all movies in one shot rather than using the removeMovieClip().
Swap Depth Of Attached Movies
hi,
i'm trying to figure out how to swap depth of attached movies. sort of like in:
www.lovelydesing.com
under journals / karlek fran sverige
i have multiple buttons in the main timeline that attaches movies. i need to be able to drag them and swap depths. i can drag, but don't know how to swap depth.
please help!
thanks
RemoveMovieClip Is Removing All My Attached Movies :-(
function away() {
for (i=0; i<numMenuItems; i++) {
_root["blob"+i].removeMovieClip();
}
}
this.attachMovie(_level0.ButTopic, "HEADSET", "AnimHolder");
Okay I have a movie that loads from the library with the attachMovie cmd. Now I have a number duplicated MCs on this page as well that are made to dissapear with the "away" function.
However for some reason
Code:
AEG.onRollOver = function() {
_root.away();
};
Makes the HEADSET (or Anim Holder) dissapear as well
What is going on? My remove Movieclip is targeting mcs with the suffix of "blob" so why is it affecting my attached HEADSET movie :-(
Any help would be much appreciated
Moving Attached Movies In For Loop?
I'm trying to load a few movie clips beside each other. The below code is intended to move them an additional 127 pixels to the right.
code:
x = 83;
for (var i=14; i>8; i--) {
x += 127.1;
this.attachMovie("thumbnail", i, 0);
this[i]._x = x;
this[i]._y = 153.3;
}
The code appears to create and move them, but they all end up at the same coordinates, and therefore on top of each other about 800 pixels to the right (off stage). I've tried naming the movie clips differently and I'm out of ideas. Can anyone help? (Flash MX 2004)
EDIT: Changed [ php ] tags to [ as ] tags for readability. - jbum
Getting 'attached' Movies To Play In Sequence
Hi all - this is extremely embaressing to ask as I should know this - hard to believe I am a MM Flash 5 Cert Developer, but I have been out of the loop for about 2 years and with all the upgrades, and changes I feel a bit lost.
Recently upgraded from MX to 8, I'm developing some elearning material, but am finding it very hard to control my loaded movieclips.
I've got a shell fla into which I am loading/attaching movieclips from the library. I've got a couple of keyframes, on which I have the following:
KF1 - this.attachMovie("loadScreen_mc","loadScreen_mc",1 00,{_x:0, _y:0});
KF2 - loadScreen_mc.play();
KF3 - this.attachMovie("Interface","interface_mc",200,{_ x:0, _y:0});
KF4 - interface_mc.play();
FK5 - this.attachMovie("Objectives","Objectives_menu",50 0,{_x:10, _y:60});
FK6 - Objectives_menu.play();
I KNOW this is all wrong because it is not working, the maintime line is just playing each kf one after the other. And all I get is a mass of chaos on screen if anything.
I know this is basic 101, but I'm starting from scratch here with flash shell design and would appreciate any pointers or help in correctly loading and playing my clips - loadscreen first, then the interface and then the objectives.
God what a learning curve and what makes it worse is that I used to know all this!!
cheers
frank
How To Preload Dynamically Attached Movies?
Hi guys, hope you can help.
Basically i have a large game which is all coded and movies are added and removed when needed, as are graphics and sound. The stage is empty and the whole game code is on frame 1 of the root.
So my question is, how preload all of the content, and do i "need" to preload all of the content?
cheers in advance
chris
Dispatching Events From Attached Movies
OKi, I have the following problem. I have a movie clip with a button. When I click this button a movie is dynamically attached to the stage (movie1). This new movie recieves original name and is draggable. U can attach multiple copies, of course. There is another movie (movie2) that is also attached to the stage dynamically on click on another button and it is also draggable.
I want movie1 to dispatch events on move (actually on mouse press) and I want movie2 to recieve the event and move accordingly to the new location of movie1.
How can I do this? I tried placing the dispatch code in various places, but it just DOESN'T work.. ;(
Please help!!!
Can't Adress Movieclips In Attached Movies
Hi everybody,
i'm trying to use attachMovie to attach a button within another MC. The button contains another empty MC. I need to adress this empty MC to load an image into it. The button gets attached, but when i try to adress the MC within i always get "undefined"! Both of them are set to export to Actionscript in the library.
Heres my code:
Code:
newTN_button = this.attachMovie("thumb_button", "tnb"+i, i+1);
newTN_img = eval(newTN_button+"thumb_img_mc");
trace(newTN_img);
newTN_img.loadMovie(img.path);
i also tried to create an empty MC:
Code:
newTN_button = this.attachMovie("thumb_button", "tnb"+i, i+1);
newTN_img = newTN_button.createEmptyMovieClip("thumb_img", 1);
trace(newTN_img);
newTN_img.loadMovie(img.path);
but that wont work either!
What am i doing wrong? Thanks for any help!
Plauderer
Adding Functions To Attached Movies?
I was wondering if someone could explain the best way to dynamically assign onRelease functions to movie clips added to the stage with attachMovie.
I currently have a script which reads in data from an XML file which contains file names for images. The XML has 2 nodes one for thumbnail images and one for the corresponding larger images.
Currently the script dynamically attaches movie clips to the stage and loads a thumbnail into each one using a for loop.
I now need to know how to add a unique onRelease function to each thumbnail which will read in the path to the larger image and ultimately display it. I have found a work around where i get each clip to getDepth and use that value to retrieve the image name from an array however I'm hoping there is an easier way to do this.
Hope that makes sense.
Randomly Placing Attached Movies..
Here's what I have:
ActionScript Code:
var place:Number = random(200);
for (i=0; i<4; i++) {
_root.attachMovie("ae_mc2", "ae" + i, i);
//set the location
for(x=0; x<4; x++) {
_root["ae"+i]._x = i*place+x;
_root["ae"+i]._y = 380;
trace(_root["ae"+i]._x);
}
I don't want the attached movies to be placed evenly. I want the four clips to be placed along an x axis of which the limit is 530, at random positions as well as not overlap each other. I will eventually put this into a function so that new movies can be attached at certain points so I d
I've been through numerous attempts but I can't seem to get the code that utilizes a random number through each loop interation instead of the same random number for all?
In other words, how can I force a random number throughout each loop cycle?
Probably just numbed out..thanks
How To Put Actions On Attached Movies Through An Array
Hi all - I'm trying to use attachMovie to attach a series of movie clips to the stage, but via an array. I then want to assign each movie clip an action - lets say for example a getURL. But each movie clip would have a different URL. Each URL would be contained within another array.
I found this code on Friends of Ed which is very close to what I want to do, except the movie clips have already been set up in an array, whereas I want to use attachMovie to pull them onto the stage, give them a unique name and assign the URL to them:
var myLinks_array:Array = ["http://www.vivekmahbubani.com", "http://www.friendsofed.com/", "http://www.apple.com/"];
var buttonNames_array:Array = [myButton1_btn, myButton2_btn, myButton3_btn];
for (var i = 0; i<myLinks_array.length; i++) {
currentButton = buttonNames_array[i];
//This creates a unique id number for each button that corresponds to the index number of the links array
currentButton.id = i;
currentButton.onRelease = function() {
trace(myLinks_array[this.id]);
};
}
Anyone know how I should change the code to achieve what I want?
EDIT: I should mention I am also going to try and put a delay between the generation of each attachMovie.
Thanks all.
Positioning Multiple Attached Movies.
Okay here is what i have so far. (it works)
this coding is places on frame 2of a movieclip and is played to frame 3 then stopped with the randomly loaded movie stored on frame 3 (might be useful info, or maybe not.)
//Makes "e" random number within 1 - 6.
e = Math.ceil(Math.random()*6);
//adds the randomly called movieclip and positions it to the screen.
adde1 = _root.attachMovie("enemy"+e,"enemy1",1);
adde1._x=280;
adde1._y=200;
what i am having problems with is trying to load more then 1 movieclip to the screen with different co-ordanants.
i have tried
//Makes "e" random number within 1 - 6.
e = Math.ceil(Math.random()*6);
//adds the randomly called movieclip and positions it to the screen.
adde1 = _root.attachMovie("enemy"+e,"enemy1",1);
adde1._x=280;
adde1._y=200;
adde2 = _root.attachMovie("enemy"+e,"enemy2",1);
adde2._x=300;
adde2._y=180;
adde3 = _root.attachMovie("enemy"+e,"enemy3",1);
adde3._x=320;
adde3._y=160;
but with that code only the 1 movieclip gets attached (the bottom 1) what is the problem ? how do i have flash read them seperately andposition them seperately
thank for any help.
RemoveMovieClip Is Removing All My Attached Movies :-(
Code:
function away() {
for (i=0; i<numMenuItems; i++) {
_root["blob"+i].removeMovieClip();
}
}
this.attachMovie(_level0.ButTopic, "HEADSET", "AnimHolder");
Okay I have a movie that loads from the library with the attachMovie cmd. Now I have a number duplicated MCs on this page that are made to dissapear with the "away" function.
However for some reason
Code:
AEG.onRollOver = function() {
_root.away();
};
Makes the HEADSET (or Anim Holder) dissapear as well
What is going on? My remove Movieclip is targeting mcs with the suffix of "blob" so why is it affecting my attached HEADSET movie :-(
It's late and I want to go home, not hating flash. Thanks in advance for any advice.
Printing Attached Movies Using Bmovie
I have a movie called canvas that I am attaching movie clips to.
The clips can be on the edge of the canvas or half off the canvas.
The on-screen works fine as I can frame up the canvas underneth.
The problem is when I print using bmovie and target the #b frame.
The bounding box will not work because the attachMovie attaches the clip to all frames of the canvas movie, including the #b frame.
Any ideas on how to make the bounding box bound the attached movies?
Thanks
Calling Attached Movies From _root?
I am working on moving extreneous scripts from an attached movie clip instance to the main timeline. I need to call a movie clip within the movieclip that is attached. Here is what I have been using: the movie clip "optionButton" is attached to the movie clip "menuBar" which is on the main timeline. I want to call a movie clip instance within "optionButton" called "optionButtonBM," and also call a text instance within "optionButtonBM" called "mapSelection". The following is how i have tried to call "optionButtonText":
_root.menuBar[_root.optionButtonName].optionButtonBM.optionButtonText...
is this correct? It must not be, or my stuff would work! I have also tried to call "mapSelection" by using this code:
_root.menuBar[_root.optionButtonName].optionButtonBM.mapSelection...
Please email me a @ bjgrooven@hotmail.com with some help, or just post it here. Thanks, and FYI I am new ar flash to some extent so keep it simple if at all possible!
Thanks
HitTest With Multiple Attached Movies
I'm working on a chain reaction. I want to drop a car on a series of other cars that are in the scene as attached movies. How do I detect the hitTest not only from the first car, but all the other cars hitting all the other cars.
Can I do something like :
_root.car.hitTest(anything)
return the name of the thing that I hit?
Actionscript: Address Attached Movies
Hello,
I'm making a dynamic menu in flash, driven by a XML file.
I attach a movieclip using this code:
Code:
for (var i=0; i<items.length; i++) {
var item_mc = menu_mc.attachMovie("menu_item","item"+item_count, item_count);
}
I'd like to add a rollover effect using the mx.transitions class, but I don't know how to address the attached movie?
I tried this one but it doesn't work:
Code:
this.menu_mc["item"+item_count].onRollOver = function(){
...
}
Can anyone please help me out? Thank you very much!
Calling Functions Of Attached Movies
I am attaching a bunch of instances of a movieClip to my stage and I want to call a function in this movie clip that I'm attaching however I don't seem to be able to access the movieClips functions. Is there any known reason why this may be happening, something I don't know about attached clips? I'm doing something similar to whats below
Code:
myPointer = attachMovie("libraryName","myNewName",newLvl);
myPointer.doMyFunc();
I know the clip is attaching correctly because I can see it, but I can't seem to access any functions within the attached clip. I also know that "myPointer" is correctly addressing the attached clip because I can change the clips properties such as width and height.
|