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




DuplicateMC Problem



i have a little problem with my code.

the thing i want to do is when i press a button it duplicates a MC and then makes 2 random numbers/letter on the MC's 2 textboxes.

here is a .swf with the stuff. the box to the left changes its values, but i want it to make a new box to right with the new values, and not change its own values.


http://www.oktv.se/hemsida/timo.sivonen/error.swf i want it to work like this:
http://www.oktv.se/hemsida/timo.sivonen/likethis.swf (i used if/else and stuff to make this swf, but i dont want to make it by using if/else)



Here's some code:

on (release) {
i = i + 1;
duplicateMovieClip (_root.block, "block" + i, i);
setProperty("block" + i, _x, _root.block._x+36*i);
setProperty("block" + i, _y, _root.block);


function do_random () {
letter_rand = random(90-65)+65;
number_rand = random(8)+1;

if (letter_rand == 81) {
letter_rand-=number_rand;
} else if (letter_rand == 88) {
letter_rand-=number_rand*2;
}
}

do_random(letter_rand,number_rand);


bn = "block" add i; // i suspect the error in these 3 lines
bn.letter = chr(letter_rand); // i suspect the error in these 3 lines
bn.number = int(number_rand); // i suspect the error in these 3 lines

}

when i press the button all it does is that it makes a copy of _root.block, but it doesn't change its values (_root.block3.letter / .number ) etc.

anyone got a tip how to solve
[Edited by roland_s on 08-26-2001 at 10:16 AM]



FlashKit > Flash Help > Flash ActionScript
Posted on: 08-26-2001, 09:39 AM


View Complete Forum Thread with Replies

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

DuplicateMC One After The Other - Not All At Once
Dear friends,

I use something like this for duplicating movieclips in a grid. But I was wondering how to go about duplicating each gridTile one after the other - not all at once.

// Columns
var gridWidth = 6;
// Rows
var gridHeight = 6;
level = -1;
phase = -1;
for (var i = 0; i<gridHeight; ++i) {
for (var j = 0; j<gridWidth; ++j) {
_root.level++;
_root.container.attachMovie("gridTile", "gridTile"+_root.level, _root.level);
gridTile = eval("_root.container."+"gridTile"+_root.level);
gridTile._x = (j*(gridTile._x+100));
gridTile._y = (i*(gridTile._y+100));
}
}

I've seen this done before (in masked transitions and such.) I would greatly appreciate it if someone could point me in the right direction.

Thanks!

/Flip

DuplicateMC() Help
Ok.... So i have this string that I am splitting up into an array, now I need to loop through that array and create/duplicate a MC for each [i] in that array. So far I have this, but its not making new MC's?


Code:
// Where "brand" is my array.... and "brandMC" is the MC I want duplicated

for (i in brand) {
xPos +=20;
yPos +=20;
brandMC.duplicateMovieClip("brand"+i, this.getNextHighestDepth(), {_x:xPos, _y:yPos});
trace(brand[i]);
}
///end array loop
But nothing happens???? The only thing I have in the brandMC is a dynamic textfield that I will need to figure out how to populate with the brand[i].value.

Any suggestions? Ultimately I am going to have them randomly move about the stage.

Thanks US!

DuplicateMC Problem - PLEASE Help Me
I am making a menu system that is dynamically updated from a text file and when a new variable in the text file is added (with a certain name), an item in the library is duplicated, the text variable is updated according to the category name, and is placed under the rest of the menu items, which builds the menu. But for some reason these menu items 'reset' after a couple of seconds when I test the movie. I'll try to explain this better:

Inside the movie clip that is duplicated, there is a button that detects mouseover and another movie clip that goes to a certain frame when the mouse is over on the button. All it does is fade into a different color. When I test the movie and move the mouse over the button, it starts to fade in, but all of a sudden (after about a second) it gets reset back to its original instance. I went into debug mode, and into the properties tab, and when I clicked on the movie clip instances that were giving me problems, the properties came up, but then they quickly disappeared after the same length of time, and at the same time the movie clip instance is 'reset'.

If someone could help me this would be very helpful and I would appreciate it very much.

Thank you.

Can't Talk To DuplicateMC
I am duplicating an mc on the stage. After that happens I am tring to talk to the duplicate mc but it doesn't work. I am not sure why this is not working but if anybody could help me out I would really appreciate it. Thanks in advance.
j


onClipEvent(load){
var bulletCount = 0;
}
onClipEvent(enterFrame){
bulletCount++;
duplicateMovieClip(_root.bullet, "bullet"+bulletCount, bulletCount);
_root["bullet"+bulletCount].gotoAndPlay(2); //doesn't execute
}

DuplicateMC Above _parent (elsewhere) ?
I would like to duplicate a clip from my source (eg _root.lib.sourceclip ) into another clip above the _parent(eg _root.otherclip)
but as far as I can tell this can't be done.

I can't use attachmovie, although I would love to, as 'sourceclip' is an external swf loaded into the lib clip. and you cant use attach movie outside the loaded movie.

any Ideas?

TIA

Cant Get This Duplicatemc To Work...
trying to make it so when i click on the stage 10 instances of a mc come up, with random x y alpha and xy positions, i can do the random stuff i just cant get the duplicate mc to work...

any help?

Loadmovie In DuplicateMC's
i've been tinkering with a script i got in ultrashock. i'm trying to figure out how to assign an onrelease function for each button. i 'd like each button to load a mc into a holder. this is really out of my league, but if i can get some direct, that'd be great.

heres the FLA

DuplicateMC And Levels
I am trying to load in a bunch of rows into an MC that is not on my _root. Can anyone tell me why, when I export, I don't see 6 rows, when rowNum = 6 (I only see my initial 2)?

My hierarchy is as follows: _root > main > rowN (where N is 1 to rowNum; all of these rowN's exist within main). This code I have on my _root timeline:


Code:
for (i=3; i<rowNum+1; i++) {
// start at row3 since rows 1 & 2 already exist
if (i%2 != 0) {
// if i is an odd number
main.row1.duplicateMovieClip("row"+i, i);
} else {
main.row2.duplicateMovieClip("row"+i, i);
}
setProperty("row"+i, _y, (i*70)-70);
}
Is it that my "main" MC starts out only 2 rows high, and can't be extended after the fact? Thanks for any and all help.

What's Wrong With My DuplicateMC?
OK same old problem. i have 2 MCs called ship and bullet. i want to duplicate bullet, then give it the same rotation and position as ship, then send it on it's way.

i've been through all the tutorials and posts i can find and i'm still not getting it, the tutorials have too much else going on and the code i need is hidden away in layers inside MCs in other MCs...

this is the best i could come up with, i know it's pathetic.


if (Key.isDown(Key.SPACE)) {
duplicateMovieClip ("/bullet", "bullet"+i, i);
_root.["bullet"+i]._x = _root.ship._x;
_root.["bullet"+i]._y = _root.ship._y;
i++;
}

this is all inside the only frame in the ship movie clip.

any help would be great.

cheers

DuplicateMC Problem
i am having difficulty with duplicateMovieClip. I have 12 project buttons, each of which calls a security box (for a name + password) movieclip for a duplicate when pressed. Each security box has a 'close' button. The problems are these:

please see http://www.nomae.com for a demonstration of the following errors. i have made only the first project button (upper left) active for this demo >

1.) the first time a project button is pressed, the duplication works fine and the close button works, too. However, if the same project button is pressed again - no duplication!

2.) if the 'portfolio' button (just beneath the project buttons) is pressed and then the 'projects' button is pressed (thus returning the 12 buttons) the original project button works again!

project button code (which causes a 'security box' to appear):

on (release) {
security_01.duplicateMovieClip("project_01",10);
security_01._x = -283;
security_01._y = 10;
}

the following closes the security box alright:

on (release) {
this.unloadMovie();
}

consequently, the following code did nothing:

on (release) {
this.removeMovieClip("project_01",10);
}

any help is appreciated. thanks.

DuplicateMc And SetMask Fn's
hi. this doesn't work.

Code:
on(rollOver){
for(n=1; n<=9; n++){
maskmc.duplicateMovieClip("maskmc"+n,n*10);
maskee.setMask("maskmc"+n);
this["maskmc"+n]._x = 100;
this["maskmc"+n]._y = n*20;
this["maskmc"+n].gotoAndPlay(2);
}
}
on(rollOut) {
this["maskmc"+n].removeMovieClip();
maskee.setMask(null);
}


8 links, vertical every 20px. code in on invis buttons over each links. onrollover, i want a mask to appear at the same _x and _y as the button, then play, and go away on rollout.

how should it be scripted?

Calling DuplicateMC's?
I need to be able to call each duplicatedMC. This is the problem I am having. Code is as follows:

on (release){

i=1;i++;
timeOf = timeBox.getValue();
typeOf = type_radio.getData();

_root.typeOf_mc.duplicateMovieClip(timeOf+typeOf+i , i);

Any ideas??

SetMask & DuplicateMC
I am attempting to create a mask from a MC that I am duplicating and I can't get it to work.

I a one frame MC labeled "transition" with two layers. On one layer I have an MC that is a long line that fades up. For the actionscript on the second layer I have:

for (i=0; i<80; i++){
duplicateMovieClip("transition","transition"+i,i+1 00);
setProperty("transition"+i,_y,random(400));
}


Then in the root movie I have another MC labeled "pics" with one picture in it. Below this layer I have another picture that i want to display after the mask.

In my actions frame I have _root.pics.setMask(_root.transition);

It looks like the transition clip with the fading line is just showing the mask in a frozen position, it isn't going through the fade-up process and it is only duplicating a few times. I want line that fades up to duplicate across the scene to slowly reveal the picture underneath.

[F8]duplicateMC Depth
How can I get the depth of a duplicateMC to go the back so it dosn't get in the way of gameplay with this code?


Code:
onClipEvent(enterFrame){
_root.blood.duplicateMovieClip("blood"+i, i, {_x:this._x, _y:this._y});
}

DuplicateMC Vs AttachMC
Hello,

In my swf I have an mc which contains a few seconds of embedded video. I want to have many instances of this clip on the stage at a time.

Is it more efficient to place each clip on the stage using attachMovie, or to place 1 on the stage with attachMovie, then use duplicateMovie?

Thanks

Duplicatemc Slider
I'm looking through the forums, not having too much luck!

Anyone know anyway of adapting the tutorial on VOLUME SLIDERS so that it could affect the duplication of an MC rather than increase the volume of a sound?

For example, if the slider is on '0', there are no instances, but if the slider is on '100', there are loads. Not 100, that would be stupid now wouldn't it...

OnEnterFrame - DuplicateMC
I have duplicate a mc several times. Now I want to attach to every duplicated mc a onEnterFrame function.
What I'm looking for is a shorten method for:

_root.MC0.onEnterframe = function;
_root.MC1.onEnterframe = function;
_root.MC2.onEnterframe = function;
_root.MC3.onEnterframe = function;
_root.MC4.onEnterframe = function;
_root.MC5.onEnterframe = function;
etc etc etc (this all works btw)


to something like this
for (i=0; i < gewenstaantal; i++){
_root."MC"+i.onEnterframe = function;
}
THIS DOESN'T work

Hopefulley somebody can help

AS Attached To DuplicateMC
I was wondering how you can attach some actionscript to a duplicated movie clip.

DuplicateMC Question
ok, I want to make a game were coins fall from top and I need them to be duplicated. However, I can't make a copy of it without having the original deleted. Whenever my coin reaches certain point of the movie, I want another to fall but without the first one dissappearing. Here is the code I'm using:

In the main timeline:

Code:
dupMovie = function () {
i= i + 1;
circle.duplicateMovieClip("circle"+i, i, {_x:Math.random()*300});
}
In the coin mc inside the main mc:


Code:

onClipEvent(enterFrame){
_y +=6;
if(_root.circle, hitTest(_root.barrera)){
_root.dupMovie();
}
}
It duplicates but eliminating the one before... what's the problem?

AS Attached To DuplicateMC
I was wondering how you can attach some actionscript to a duplicated movie clip.

LoadMovie, DuplicateMC, And Array... Oh My
I was aiming high on this one, and I've hit the wall. Here's the scenario.
In an attempt to create a dynamic photo gallery... I've converted my jpg's to swf's, stored the movie names(pic1.swf, pic2.swf, etc.) into a variable "pic" in a txt file(&pic=pic1.swf~pic2.swf, etc) I split the variable with ~ therefore pic[0]=pic1.swf,pic[1]=pic2.swf, etc... so far so good.
I've got a movie clip named photo inside a movie clip named gallery with and instance name of picture, I would like to create a loop that would have a duplicateMovieClip(picture) and loadMovie pic[], loading the next swf "pic" from the array, adjust the x position at the end of the loop so that the images dont load on top of one another, so far no good.
In a test to make sure my variables loaded correctly and each movie was in it's propper position within the array index, i created a series of buttons each with a on release loadMovie directly addressing each pic[0],pic[1], etc... no problem. It's the loop that has got me stumped.
When I get home I could post it to be looked at, but I just wanted to get any suggestions... if there are any.

sorry so long winded on this one, thanks in advance for any help.
This board is the best flash learning tool on the web.
[Edited by gomez88 on 01-22-2002 at 11:40 AM]

DuplicateMC + LoadMovie Combination
onClipEvent (load) {
var maxNum = 5;
var num = 1;
for (a=1; a<=maxNum; a++) {
for (b=1; b<=maxNum; b++) {
_root.box.duplicateMovieClip
(""+num, num);
_root[""+num]._x = a*60;

num++;
}
}
}
i use this action to duplicate a MC called "box" and give them numbers as names. on the box mc the is following code

onClipEvent(load) {

num = this._name;
pictarget = "_level0.box";
pictarget = (pictarget+num);
picpath = "images/picture";
picnum = this._name;
picext = ".jpg";
pic = (picpath+picnum+picext);
loadMovie (pic,pictarget);

}
// the outcome is like this
"loadMovie ("images/picture1.jpg",_level0.box1);

what the problem is, i have to have a MC called box+number so i use the following code

onClipEvent (load) {
var maxNum = 5;
var num = 1;
for (a=1; a<=maxNum; a++) {
for (b=1; b<=maxNum; b++) {
_root.box.duplicateMovieClip
("box2"+num, num);
_root["box"+num]._x = a*60;

num++;
}
}
}

it seems that only one duplicateMC action works so it will load only one picture.

LoadVariables & DuplicateMC Problems
I have two problems with Flash Action Script:

1. I have something like this:
on(press){
user = "subs.php?email=" add _root.email;
loadVariables(user);
gotoAndStop(2);
}
assigned to flash ui component (i think in ver 5 its just a button). I have two frames for it 1 with form and 2 for "thank you for filling form". But this code doesn't work - it works with getURL instead loadVariables, but I don't want to open any new window just to send Variable to php script. What is wrong with it?

2. duplicateMovieClip:
loadVariables("variables.txt",this);
arr = forarray.split(";");
for(i=0;i<arr.length-1;i++) {
nazwa = "button" add i;
buttonTmp.duplicateMovieClip(name,i);
eval(name)._x=80+20*i;
eval(name).number=i;
}
it simply replicates buttons but the buttons disappear when in next frame of MC I use stop(); Why such thing have place?
And the last problem - is it normal that button in duplicatedMC have no other states than UP? I cannot probably duplicate buttons?

Maybe I miss some things reading tutorials so maybe you can help me. Thx

Making A DuplicateMC Independant
Ok, so I have this MC, named "Bullet". This MC is duplicated on "pistol" and this works fine. But, what does happen is the "bullet" MC is rooted onto the pistol MC. So what happens is the bullet stays attached to the gun. What do I have to do to make the bullet seperate from the gun?

Is It Possible To Change The Color Of A DuplicateMC?
Hi,all flashers!
I'm having problem with some duplicateMCs whose color I'd like to change with the color object methods.
The original MC has two animated nested MC and I'd like to change the color of these two nested clip relative to the duplicateMC. In fact, I've created a color object and seemingly the path to the two nested MCs is correct, but the result is that the color doesn't change and besides, the corresponding nested MC inside the duplicated MC does't longer follow the animation, but is stacked at the origin.
Could anyone of you suggest any solution?
Thanks a lot!

Performance - DuplicateMC Vs. Flat Gif ?
I have a night sky with stars, which are not animating but are static vector graphics(bascially a dot).

Will my movie take a performance hit if I create the my starfield with a 'For' loop duplicting say, 700 stars and placing them at random(at which point the loop stops)... as opposed to creating the night sky in photoshop as a gif or jpeg?

thanks for any ideas.

Problem In DuplicateMC In Component
hi,

can anyone help me how do i create a duplicate MovieClip in component. Any help is appreciated.

Thanx

[F8] Loading Name Attributes Into DuplicateMC's
Hi,

first of all i'm posting my question in this section because the part that i'm stuck is focused on AS side rather than XML.

I have a working scrolling portfolio with many rows that are generated duplicateMC method. In each row there are unique thumbnails that are pulled from diplaypic attribute.

I also want to add some lines into that loop that i've written in order to display the names of the pictures corresponding to their thumbs.

While I may not be clear enough, i'm c/p my code down here.

Experts or advanced users would get my problem quickly so i'm not giving further explanations.

My aim is to be able to display the names of the pictures at the right side as soon as the list of thumbs is generated. I have no problem diplaying the thumbs.


PHP Code:



import mx.transitions.Tween;
import mx.transitions.easing.*;

var url = "some URL";
var urlvid = "some URL 2";
var mydepth = 0;
// XML building
var listem = new XML();
listem.ignoreWhite = true;
listem.onLoad = function(success) {
    if (success) {
        GeneratePortfolio(this);
    } else {
        trace("Error loading XML file");
    }
    // no success? trace error
};
listem.load(url+"PHP file that generates the XML output");

function GeneratePortfolio(listem) {
    var portfolioPictures = listem.firstChild.childNodes;
    spacer = 43;
    for (var i = 0; i<portfolioPictures.length; i++) {
        var currentPicture = portfolioPictures[i];
        
        // thumbwrap adlı scrollpane içinde lilcon anime mc'ler duplicate edilir her thumb için.
        thumbHolder = thumbwrap.lilcon.duplicateMovieClip("image"+i, i);
        
        // yeni oluşturulmuş olan thumblar için yerleştirme
              // I should be able to attach the names of the pictures
        thumbHolder.image = currentPicture.attributes.disppic;
        thumbHolder.video = currentPicture.attributes.relvideo;
// that line below pulls the "name" attribute of each picture from XML
        thumbHolder.myname = currentPicture.attributes.firstname;
        
        thumbHolder._x = 3;
        thumbHolder._y = 4 + spacer*i;
        thumbHolder.loader_mc.loadMovie(url+"flags/"+currentPicture.attributes.disppic);
        
        /* I HAVE THE MAIN PROBLEM IN THIS PART. SOMETHING IS WRONG OR INCOMPLETE WITH THIS PART mynamebox is a MC attached from library which contains dynamic text field.

        _root.thumbwrap.lilcon.tempMC = attachMovie ("mynamebox", "mynamebox" + i);
            _root.thumbwrap.lilcon.tempMC.name_txt.text = thumbHolder.myname;
            _root.thumbwrap.lilcon.tempMC._x = thumbHolder._x + 50;

            */
        
        /*thumbHolder.thumbtitle.text = this.myname;*/
        
        setProperty(thumbHolder.loader_mc, _xscale, 90);
        setProperty(thumbHolder.loader_mc, _yscale, 90);
        setProperty(thumbwrap.thumbwrapBorder, _height, spacer*portfolioPictures.length + 8);
        
        _root.thumbwrap.lilcon.loader_mc._x = (_root.thumbwrap.lilcon._width/2) - (_root.thumbwrap.lilcon.loader_mc._width/2) + 20;
        
        thumbHolder.onRollOver = function() {
            thumbHolder.thumbtitle.text = this.myname;
            myname_txt.text = this.myname;
            this.gotoAndPlay(3);
        };
        thumbHolder.onRollOut = function() {
            thumbHolder.thumbtitle.text = null;
            myname_txt.text = "";
            this.gotoAndPlay(11);
        };
        thumbHolder.onRelease = function() {
            myname_txt.text = this.myname;
            
            trace(urlvid+"videolar/"+this.video);
            
            _root.yeniEkran.yeniEkranIc.conmid.myplaya.contentPath = urlvid+"videolar/"+this.video;
            _root.yeniEkran.yeniEkranIc.conmid.myplaya.bufferTime = 5;
            _root.yeniEkran.yeniEkranIc.conmid.myplaya.play ();
            
        };
    }
}

next_btn.onRollOver = function (){
    next_btn.gotoAndPlay(2);
}

next_btn.onRollOut = function (){
    next_btn.gotoAndPlay(11);
}

next_btn.onPress = function():Void{
    if(thumbwrap._y <= -260){
            stop();
        }else {
            var twMove:Tween = new Tween(thumbwrap, "_y", Strong.easeInOut, thumbwrap._y , thumbwrap._y-260, 1.4, true);
        }
};

prev_btn.onRollOver = function (){
    prev_btn.gotoAndPlay(2);
}

prev_btn.onRollOut = function (){
    prev_btn.gotoAndPlay(11);
}

prev_btn.onPress = function():Void{
        if(thumbwrap._y < 0){
var twMove:Tween = new Tween(thumbwrap, "_y", Strong.easeInOut, thumbwrap._y , thumbwrap._y+260, 1.4, true);
        }else{
            stop();
        }
};


stop();


/*
import mx.transitions.*;
import mx.transitions.easing.*;

var handle:Object = new Tween(icerik, "_y", Strong.easeInOut, 293, 0, 0.8, true);
handle.onMotionFinished = function(){
    loadMovie("urun02.swf", "_root.yeniEkran.yeniEkranIc.conmid");
}

*/




This is urgent. I appreciate any help.

THANK YOU ALL.

Parameter Passing To DuplicateMC
I have a little Movie Clip off to the side named "thumbPrint".


PHP Code:



duplicateMovieClip(thumbPrint, "tThumb"+someLevel, someLevel);
setProperty ("tThumb" + someLevel, _x, 0);  //--WORKS OK!
setProperty ("tThumb" + someLevel, _y, ySpot); //--WORKS OK!
setProperty ("tThumb" + someLevel, imgName, imgName); //--PARAM TRACES undefined
this['tThumb'+someLevel].imgName= imgName; //--PARAM TRACES UNDEFINED 




What is another syntax to pass a variable to a duplicated movie clip on the fly??

thanks!

Having A Trouble With Duplicatemc And As' Movement..
hi i'm trying to do a simple thing where, a parent circle is following the mouse and as it enter's a new frame a new child cirlce is duplicated based on the parent.. and the child is then moved to a fixed position via. ascripting.. the child circles are suppose to stay at the same place.. they do stay in the same place - in reference to the parent circle.

i want the child circles to be at a fixed position in reference to the _root..

here's a flash mx src i made.. anyone have any suggestions?

thanks so much

btw ignore the _ds file, its just a mac osx thing.. ><

PROBLEM With MASK And DuplicateMC
Hi all. I'm just trying to FIX a little problem. SO I have this code into my MC
Code:
onClipEvent (load) {
centro = _root.barra1._y;
larghezza = _root.barra1._height;
destra = centro + larghezza;
sinistra = centro - larghezza;
_root.maskera1.swapDepths(3)
_root.barra1.duplicateMovieClip("barra2",2);
_root.barra2._y = destra;
}

onClipEvent (enterFrame) {
mouseY = Math.round(_y-centro)*+1;
mouseY = Math.round(mouseY/_root.fattore);
_root.barra1._y += mouseY;
_root.barra2._y += mouseY;
}
So. With this scritp I move my BAR (barra1) from Bottom to TOP with CONTINUE motionand I have a LAYER UP whit MASK FORM. So.....when the script CALL DUPLICATEMOVIECLIP "barra2" This take a position UP my MASK. I have try with SWAPDEPTHS command....within TIMELINE, within MC, but I can't move UNDER the MASK "BARRA2"

Anyone have a solution? Thank you so much!

N3m3s1s

Reverse DuplicateMC _x Direction
This code is loading the duplicated mc to the right of each other. How do I instead load it to the left. I guess that if the first mc's _x is 0, then it loads the next into the negatives.



ActionScript Code:
posBut = 200;
function init():Void {
        for (i=0; i<_parent.headerbar.menuArray.length; i++) {
                _parent.headerbar.mcButton.duplicateMovieClip("mcBut"+i,i);
                _parent.headerbar["mcBut"+i]._x = Math.ceil(_parent.headerbar.posBut);
                _parent.headerbar["mcBut"+i].nr = (_parent.headerbar.menuArray.length-i)-1;
                _parent.headerbar["mcBut"+i].mcTxt.txt.htmlText = _parent.headerbar.menuArray[(_parent.headerbar.menuArray.length-i)-1].getMenuName;
                _parent.headerbar["mcBut"+i].mcTxt.setColor(_parent.headerbar.menuTextColor);
                val = 10*(_parent.headerbar["mcBut"+i].mcTxt.txt.textWidth+_parent.headerbar.butWidth);
                _parent.headerbar["mcBut"+i].mcBut._xscale = val;
                _parent.headerbar["mcBut"+i].mcBut._width = Math.ceil(_parent.headerbar["mcBut"+i].mcBut._width);
                _parent.headerbar["mcBut"+i].mcTxt._x = Math.ceil((_parent.headerbar["mcBut"+i].mcBut._width-_parent.headerbar["mcBut"+i].mcTxt.txt.textWidth-10)/2);
                _parent.headerbar.posBut += Math.ceil(_parent.headerbar["mcBut"+i]._width);
        }
}

GetTimer Problems With DuplicateMC
Hi All, this should be pretty easy...

I've got a 2 frame movie.

1st Frame has the following code attached:

now = getTimer();
if (now > 10000){
gotoAndPlay(2);
} else if (now < 10000){
Stop();
}

2nd Frame:

Stop();

My first frame has an MC that duplicates itself. MC actions:

onClipEvent (enterFrame) {
count = 1;
while (count<20) {
_root.box.duplicateMovieClip("boxx"+count, count);
_root["boxx"+count]._x = random(550);
_root["boxx"+count]._y = random(150);
_root["boxx"+count]._xscale = random(150);
_root["boxx"+count]._yscale = random(150);
_root["boxx"+count]._alpha = random(100);
count += 1;
}

}

I want the movie to stay on frame 1 for 10 seconds while it duplicates itself, then stop and go to frame 2. As it stands it never leaves frame 1. Any ideas? I've attached the file...

Thanks in advance!

DuplicateMC Inside DuplicatedMC
can you duplicate MC inside MC that is already duplicated.
for example:
MC contains subMC

MC is duplicated to MC1, MC2

and then duplicate MC1.subMC to MC1.subMC1 and MC2.subMC1

DuplicateMC, I Lost My Head....
hi,


Can't figure out what the problem is...


ActionScript Code:
for (i=0; i<3;i++){
    thumb.duplicateMovieClip("thumb"+i, i);
    ['thumb'+i]_y = i*108;
}


I won't change the _y attribute.

PLZ HELP

Sliding Photos On Stage Using DuplicateMC
Howdy

I have a number of photos I want to slide on to stage pause 5 seconds then slide off and continue doing this until a stop button is clicked.

Here is my code to duplicate the mc's.
for(i=1;i<=totalPhotos;i++){
thisPhoto=photos.duplicateMovieClip("photo"+i,i);
//photos are named photo1.jpg,photo2.jpg etc
thisPhoto.loadMovie("photo"+i+".jpg");
}

The code I'm using for the slide on is this:
this._x += (endx-this._x)/3;

So my question is, how do I get each photo to slide on, wait for 5 secs then slide off? I guess a for loop would be the way but I'm stuck as to how to use it. I'm using MX.

Regards

Multiple DuplicateMC In One Loop? - Help Needed
Very simple question but I cannot see any solution to this. I want to be able to duplicate two movieCLips in one loop but for some reason my actionscript doesn't work and I cannot figure out why.

Here is the whole script. Very simple, but it only duplicates the last MC. Can anybody see what is wrong with my code?


Code:
counter = 0;
while (counter<10){
myMC_mc.duplicateMovieClip("myMC_mc"+counter, counter);
_root["myMC_mc"+counter]._x = counter*50;
mysecondMC_mc.duplicateMovieClip("mysecondMC_mc"+counter, counter);
_root["mysecondMC_mc"+counter]._x = counter*50;
counter ++;
}

DuplicateMC + Adding Text Inside MC
Hi! I have been stuck with this code for som hours now and I can't really get the hang of it.
I believe the problem lies in the 'xmlMC[i].foliotext.htmlText += "..."'
Please take a look

Code:
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
child1 = this.firstChild.childNodes;
for (var i=0; i<child1.length; i++) {
link=child1[i].attributes.weburl;
title=child1[i].attributes.hdline;
date=child1[i].attributes.date;
desc=child1[i];
child2 = child1[i].childNodes;
duplicateMovieClip ("xmlMC0", "xmlMC"+i, i);
_root["xmlMC"+i]._y = i*50;
xmlMC[i].foliotext.htmlText += "<a href=""+link+"" target="_blank">"+title+" </a>"+date+"
"+desc;
for (var ii=0; ii<child2.length; ii++) {
images=child2[ii].attributes.url;
xmlMC[i].foliotext.htmlText += "<img src=""+images+"">

";
}
xmlMC[i].foliotext.htmlText += "

";
}
}
else {
xmlMC0.foliotext.htmlText= "xml loading error. Please try again later.";
}
};

myXML.load("xml/index.xml");

stop();
Ps. Don't mind that every textfield will get the same text. Dealing with that later... Ds.

DuplicateMC + Adding Text Inside MC
Hi! I have been stuck with this code for som hours now and I can't really get the hang of it.
It writes out nothing to my textfields. The movieclip is named "xmlMC0" and the textfield "foliotext".
I believe the problem lies in the 'xmlMC[i].foliotext.htmlText += "..."' Please take a look

Code:
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
child1 = this.firstChild.childNodes;
for (var i=0; i<child1.length; i++) {
link=child1[i].attributes.weburl;
title=child1[i].attributes.hdline;
date=child1[i].attributes.date;
desc=child1[i];
child2 = child1[i].childNodes;
duplicateMovieClip ("xmlMC0", "xmlMC"+i, i);
_root["xmlMC"+i]._y = i*50;
xmlMC[i].foliotext.htmlText += "<a href=""+link+"" target="_blank">"+title+" </a>"+date+"
"+desc;
for (var ii=0; ii<child2.length; ii++) {
images=child2[ii].attributes.url;
xmlMC[i].foliotext.htmlText += "<img src=""+images+"">

";
}
xmlMC[i].foliotext.htmlText += "

";
}
}
else {
xmlMC0.foliotext.htmlText= "xml loading error. Please try again later.";
}
};

myXML.load("xml/index.xml");

stop();
Ps. Don't mind that every textfield will get the same text. Dealing with that later... Ds.

Loaded Swf W/ DuplicateMC Method Not Working
Last edited by Beanszinni : 2005-08-14 at 09:48.
























I have a menu swf that creates a list of items via duplicateMC. The swf works fine by itself, but when I load the swf via loadClip() into a MC from another swf, the duplicateMC method doesn't seem to work...could it be an issue with depths...?

Please advise.

Thanks

Masking Multiple Clips With SetMask And DuplicateMC
Hi guys. Since setMask can't be used to mask multiple clips (as you can do easily with masking layers), I figured I'd just duplicate the original mask and do an additional setMask. So I thought:


Code:
text_mask_mc.duplicateMovieClip(text_mask2_mc, text_mask_mc.getDepth());
shine_mc.setMask(text_mask_mc);
solid_mc.setMask(text_mask2_mc);
But that does nothing, the maskees just sit there and so does the original mask-to-be.

Maybe I'm just sleepy, but I'm missing something. Thanks for your help!

Pixel Font Blurs On DuplicateMC Call. Why?
I am using a pixel font with some MC I'm duplicating, but they are not staing on-Pixel. I've verified the settings of each MC making up the duped MC, and all are on-Pixel.

Anyone know why after the seventh one or so, they MC buttons blur. It's driving me nuts

Here:
http://www.bleedingtree.com/idologic...ompSmall1.html

"Please select demo" > "CPanel" > "rvskin" will load the buttons

This is the dupMC function:
"function labelLoad(){
labelRemove();
ystart = b._y;
for (n=1;n<_root.num;n++) {
duplicateMovieClip("b", "b" + n, n);
setProperty("b" + n, _y, ystart + n*21
);
this["b"+n].demoTitle.demoTitle.demoTitle=_root.menuLoad["demoB"+n];
this["b"+n].demoTitle.demoTitle.demoSection=_root.menuLoad["demoA"+n];
this["b"+n].demoName=_root.menuLoad["demoC"+n];
}"


Thanks

DuplicateMC, Having Real Trouble Duplicating 2nd Object (MX 2004)
Hey, I'm currently making a ship shooting game (apparently so is everyone, heh) and I'm having real trouble trying to duplicate a second movie clip from a first (of sorts). I'm using Flash MX2004 on Win XP Pro.

Basically, the weapon is electric of sorts, so when the shot connects with an enemy, I want it to play a MC that contains a small lightning explosion, but because of the rate of fire of the weapon, I want to duplicate it because having it keep replaying halfway through looks a little naff. Not to mention, if I'm having trouble duplicating these at this stage, I got much else to duplicate later on, with four enemies on the screen that's alot of bullets and mini-explosions, lol.

Here's my code:

On the stage:

stop();
_global.counter = 0;
_global.you_weapon = "Impulse";
//Using a global counter that increases every enterFrame. For duplicating anything and giving it a unique name. The weapon is the weapon identifier.

In the ship's clip events:

onClipEvent (load) {
reload = 0;
}

onClipEvent (enterFrame) {
counter++;
if (reload > 0) {
reload--;
}
if ((Key.isDown(Key.SPACE)) && (reload == 0)) {
if (you_direction == right) {
if (you_weapon = "Impulse") {
duplicateMovieClip("_root.weapon1ar", "wp"+counter, counter);
_root["wp"+counter]._x = (this._x+35);
_root["wp"+counter]._y = (this._y-14);
reload = 3;
}
}
}
}
//This all works fine with duplicating the shots, but the problem is trying to duplicate the blast, as below:

In the shot's clip events.

if ((this.hitTest(_root.enemy1)) || (this.hitTest(_root.enemy2))|| (this.hitTest(_root.enemy3))|| (this.hitTest(_root.enemy4))) {
duplicateMovieClip("_root.blast_impulsea", "bl"+counter, counter);
_root["bl"+counter]._x = (this._x-15);
_root["bl"+counter]._y = (this._y);
_root["bl"+counter].gotoAndPlay(1);
removeMovieClip(this);
}

//I can't seem to spot a problem, but when all the shots connect with an enemy, either the same mc is replayed or the one before it is then destroyed or something :-S.

Any help at all would be greatly appreciated :-).

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