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




Help Cant Pull Dynamic Links From A Text File Using Duplicated Movie Clips



I am trying to create a way to easily update a section of a website. I can dynamically pull image using an array from an external text file and load them with loadmovie, but i can not add any kind of onrelease to make them link dynamically. I'm kinda new to flash but I can't figure it out. I have included the filez I was working on.



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 06-16-2004, 04:38 PM


View Complete Forum Thread with Replies

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

Easy Question? Loading Dynamic Text Into Duplicated Movie Clips
I think I have an easy question for you (I haven't been able to find the answer for this yet on the boards or in the tutorials).

I am trying to create a dyanmic menu system via my XML document. The menu system, or button MC's, need to be duplicated and need to have dynamic text inserted into each indivdual button.

I have:

1.) Created a MC with a dynamic text box with a variable name of "navText"
2.) On my stage, I have given this MC an instance name of menuClip.

My problems:
1.) I can duplicate the MC's correctly but cannot get the text to display in the text areas.
2.) For debuging purposes, I removed the "duplicateMovieClip" call, let the lone MC sit on the stage, and I am able to pass information to the dynamic text field of the MC.

So...I know that logically something is working correct....I just need the text to show up when the MC is being duplicated.

Here is the AS:


Code:
function topNav(navNode) {
for (var n = 0; n<navNode.childNodes.length; n++) {
menuClip.navText = rootNode.childNodes[n].childNodes[2].childNodes[0].nodeValue;
menuClip.duplicateMovieClip("menuClip"+n, n);
this["menuClip"+n]._x = this["menuClip"+(n-1)]._x+this["menuClip"+(n-1)]._width;
this["menuClip"+n].choice = n;
trace(menuClip.navText);
}
};
Any ideas?

Links From Dynamic Text Fields To Movie Clips In Same Swf - Possible?
Hi

Has anyone ever figured how to have a text link in a dynamic text box trigger an action in a movie clip in the same swf file (or is that just asking too much?)

Dynamic Fading On Duplicated Movie Clips
Hi, I want to add a rollOver effect on my duplicated movie clips,

the way i usually do this is by adding the following code on the root time line

main_mc.onEnterFrame=function(){
if (main){
main_mc.nextFrame()
}else{
main_mc.prevFrame()
}
}

and then on the movie clip have this code

on (rollOver) {
_root.main=true
}
on (rollOut) {
_root.main=false
}

the problem being I dont wont to write the root time line code for each duplicated movie clip
is ther a way to write a loop for it???

I know this is long but ive tried the following and it dosnt work....

hope you can help

var teleNum = new Object();
teleNum.num1 = "Adam 07919053544";
teleNum.num2 = "Alan (01629) 650774";
teleNum.num3 = "Alan Mobile 07900491424";

//make loop to go though teleNum Object

teleNum.fillBoxes = function() {
for (var i = 1; i<=3; i++) {
//duplicate the movie clip and fill in text from teleNum
box.duplicateMovieClip("box"+i+"_mc", i);
_root["box"+i+"_mc"].box_txt.text = teleNum["num"+i];
_root["box"+i+"_mc"]._y = 20*i;
//attach fade to each movie clip
_root["box"+i+"_mc"].onEnterFrame = function() {
if (["fade"+i]) {
_root["box"+i+"_mc"].nextFrame();
} else {
_root["box"+i+"_mc"].prevFrame();
}
};
}
};
teleNum.fillBoxes();
_root["box"+i+"_mc"].onRollOver=function(){
_root["fade"+i]=true
}
_root["box"+i+"_mc"].onRollOut=function(){
_root["fade"+i]=false
}

Creating Dynamic Movie Clips From Text File
Hi,
I need to create movie clips from values in a text file.
I have variables 'destination_list' and 'ship_list' and its values in a text file. I create individual movie clips for each value in the 'destination_listand 'ship_list'.

Now the problem is that, 'destination_list' had 9 values and first 7 is not displayed and 'ship_list' displays correctly. What would be the problem ?

Code is given below:

//******** Destination Code Starts Here ************
destination_mc._visible =true;
destination_array = destination_list.split(",");
destination_length = destination_array.length;
// set the initial y position of the clip
yposition = 40;
// begin looping
for (i=0; i<destination_length; i++) {
duplicateMovieClip (_root.destination_mc, "destination_mc" + i, i);
setProperty ("destination_mc" + i, _y, yposition);
//destination_Clip.destinationName = destination_array[0];
set ("destination_mc" + i + ".destinationName", destination_array[i]);
yposition = yposition+30;
// destination_mc._visible =true;
}

//******** Destination Code Ends Here ************

//ship_Clip._visible=0;
ship_array=ship_list.split(",");
ship_length=ship_array.length;
yposition = 45;
for (i=0; i<ship_length; i++) {
duplicateMovieClip (_root.ship_mc, "ship_mc" + i, i);
setProperty ("ship_mc" + i, _y, yposition);
//ship_Clip.shipName = ship_array[0];
set ("ship_mc" + i + ".shipName", ship_array[i]);
yposition = yposition+30;
}

Changing Text In Duplicated Movie Clips
Hey guys,
I'm working on an animation that has a ton of titles doing the exact same movement (Slide in, fade out). I'm trying to find a way to make a movie clip that I can duplicate and change the text for each one, so I don't have to animate all of them manually. Currently, when I try to change the text, it changes all the other duplicated animations as well.
I know there is an easy way around this, I just can't figure it out.

Thanks.

-Dark4554

[ActionScript 2.0] - Changing Text Fields In Duplicated Movie Clips
Basically, my problem is this:
I want to duplicate a movie clip twice and then change the text fields in the newly created movie clips. The duplicating part works fine. The part where I try to change the text fields doesn't work so well. Here's my code:


Code:
//Create the arrays that contain the variables that I want to put into the text fields
arrItems = new Array();
arrQuantities = new Array();
arrDescriptions = new Array();
arrCosts = new Array();

arrItems[0] = "myItem1";
arrItems[1] = "myItem2";
arrQuantities[0] = "myQuantity1";
arrQuantities[1] = "myQuantity2";
arrDescriptions[0] = "myDescription1";
arrDescriptions[1] = "myDescription2";
arrCosts[0] = "myCost1";
arrCosts[1] = "myCost2";

intItemCount = arrItems.length;
for (i=0; i<intItemCount; i++)
{
//Duplicate movie clips
this.createEmptyMovieClip("item"+i, i);
this["item"+i].attachMovie("myItem", "item", 1);
this["item"+i]._x = -291;
this["item"+i]._y = 60 + 40 * i;

//Change text fields in newly created movie clips (the part that doesn't work)
this["item"+i].item.txtQuantity.text = arrQuantities[i];
this["item"+i].item.txtDescription.text = arrDescriptions[i];
this["item"+i].item.txtCost.text = arrCosts[i];
}
stop();
Can someone tell me what I'm doing wrong please?


Thanks so much for your time.
Rick

Please Enlighten - Movie Clips, JPG's, Dynamic Links
Hello Again,

The last message has fallen a bit down the list so I am posting this again in desperation.

I am trying to have my SWF load a jpg image dynamically then make the image a hyperlink to another website.

I am doing the following:

createEmptyMovieClip("container",1);
container.loadMovie("TestImage.jpg");
container._x = container._y = 150 ;

This all works fine. What I need now is to make the loaded image a hyperlink.

I have managed to make the Movie Clip open the other website by using getURL but that only worked when the movie loaded. I need to have the Movie Clip respond to a mouse click as an active hyperlink would do.

Have also tried:

container.onPress = function() {
container.getURL("http://theothersite.com", "_blank");
};

but that hasn't worked either.

If I am missing something simple please let me know I'm a doofus. If there is another thread that I have missed please point me to it. I don't mind learning from my mistakes but I can't for the life of me get this to work correctly.

Any assistance or even some bread crumbs to the solution would be greatly appreciated. Thanks.

Protius

Dynamic Text In A Duplicated Movie Clip
I'm trying to display a value in an array of duplicated movie clips. I removed the variable for each of the movie clips and replaced it with a constant to isolate my problem. I'm not sure what the proper syntax is for a reference in dot notation when part of the reference is a concatination. I thought brackets were the correct way to implement this (as shown below) and that works in some parts of my movie, but not in this case.

["block"+r+c].iValue = 5;
Does not work

block52.iValue = 5;
This works

Any suggestions?

Thanks

Dynamic Links In Duplicated MovieClips
hi there!
i have a project where i want to have different mcs generated with "duplicateMovieClip". but every mc is supposed to have its own link or action assigned.
i'm thankful for any ideas/ hints...
thanks and peace, kolt

Links To Movie Clips Inside Scrolling Text Boxes
how do I make a link to some movie clips out of some areas of text in a scrolling text box - if it's possible?

Loading External Text File Into Flash Using Links From Dynamic Text Field Link?
I am using a dynamic text field to load in .txt files with html tags. I have a couple "click here" type links that I would like to use to load a different .txt document into the same dynamic text field instead of a url link like it does default. Is this possible? I'm sure I could put a button over the text since its not long enough to need a scrollbar but I would like a more dynamic and flexible way to do this if its possible.

Thanks

Links From XML File Not Working In Dynamic Text Box
Alright, i have seen a couple other threads regarding this issue and they just don't seem to quite do the trick. So i was hoping someone could help me out a bit with my issue. I'm grabbing some information from an XML File:
(node ex.):
<entry date="Tue Jul 15 15:51:27 GMT-0700 2008">
<title>Alaska</title>
<short>AK</short>
<long><a href="http://www.alaska.com/">The link i want</a></long>
<visible>true</visible>
<location>1</location>
</entry>

This goes into Flash ok, but when i click on the link in the SWF file, nothing happens... Here's a snippet of action script that pertains to what i'm trying to do with loading the XML node into the textBox i want:
on (release) {
tNode = (this._name.slice(2, this._name.length))-1;
_root.map.curSel = this._name;
tSel = tNode
_root.tJobLG.tMsg1 = _root.xmlData.firstChild.childNodes[tSel].childNodes[0].firstChild.nodeValue;
_root.tJobLG.tText3.html = true;
_root.tJobLG.tText3.htmlText = _root.xmlData.firstChild.childNodes[tSel].childNodes[2].firstChild.nodeValue;
_root.tJob._visible = false;
_root.tJobLG._visible = true;
updateAfterEvent();
}

tMsg1(var name) is simply the title, and tText3(instance name) is the area that i would like the user to click on and be able to open a new page with the link. The info goes in just fine, But opening a new page is not happening... If this isn't enough code, let me know. There's a bit more...

Html Links From External Dynamic Text File
hi
does anyone know,

is there a way that text from an external note pad file can be made to include html links to alternate sites.

So that the client/user can type a web address into the notepad and it will it is published into flash it can be selected and clicked up on.


I have no idea at all?

Thanks
Michael

Addin EventListeners To Duplicated Dynamic Clips
Hi i am relatively new to AS3 and hence having trouble in understanding some of the basic functionality. I'm trying to add specific EventListeners for the instances of a duplicated Clip to navigate to specific urls. So at the moment I'm just able to add the same EventListener to all Objects of this type on the stage. I named these objects picture1,2,3 etc. when genereated dynamically and get their name in the output window when clicking each of them but i don't know how to add a Listener to an instance of the Object e.g. picture2.

I would appreciate your help!



Code:

public function CarouselMenu():void
{
var url:String = "http://www.thb-foto.de/3dgalerietest/";
this.urls = new Array(url+"img1.jpg",url+"img2.jpg",url+"img3.jpg",url+"img4.jpg",url+"img5.jpg");
pictures = new Array();

for(var i:uint = 0; i< urls.length; i++)
{
var picture:CarouselLoader = new CarouselLoader(urls[i]);
var clipName="picture"+ i;
picture.name=clipName;
var angle : Number = (Math.PI * 2) / numItems * i;
picture.posZ = Math.sin (angle) * radius;
picture.posX = Math.cos (angle) * radius;
picture.posY = 100;
pictures.push(picture);
addChild(picture);
}

addEventListener(MouseEvent.CLICK, ladeGalerie);

// should be the navigatetoURL Functions for each listener when it's working
function ladeGalerie(e:Event)
{
trace(e.target.name);
}
}

Duplicated Movie Clips Help
Question 1.
How do I duplicate movie clips that aren't in the frame but in the library? I went to linkage and exported it for actionscripting (I told it to export in the first frame) but it doesn't recognize them.

Question 2.
I use a variable called movie_num to keep track of my duplicated movie clips. Everytime a movie clip is duplicated, I add 1 to movie_num. When I try to alter a variable in a movie clip (let's call the movie clip "circle"), I would say in action scripting:
("circle"+ movie_num).variable_name = 1;
That would alter the last movie clip to be duplicated but it doesn't work. When I use that method for dragging or removing a movie clip, it does work. What am I doing wrong? Also, give me a better way if you have one (provide action script please).

Text File Pull To .asp
hello, all -- happy new year!

ok, i'm just trying to find out how hard it would be to have flash create a text file in order to have asp read it.

(we have a map with lots of counties, and each county is a button... we want to make the map in flash and then have flash create a basic text file which can then be read by asp in order to populate the subsequent results page. does that make ANY sense, whatsoever???)

thanks for any help!

cheers!

:: ellle ::

Text File Pull To .asp
hello, all -- happy new year!

ok, i'm just trying to find out how hard it would be to have flash create a text file in order to have asp read it.

(we have a map with lots of counties, and each county is a button... we want to make the map in flash and then have flash create a basic text file which can then be read by asp in order to populate the subsequent results page. does that make ANY sense, whatsoever???)

thanks for any help!

cheers!

:: ellle ::

Links In Dynamic Text To Control A Movie
Is it possible to have dynamic loading text, from a textfile, being rendered as HTML, that will send information to flash to play a certain frame?

what im trying to do is create some sort of dynamic scrollable menu, that contains links that are editable from a text file. these links will then direct flash to a certain frame in the timeline.

i.e. in the text box you scroll and click "frame102" and then flash skips to frame 102...
please help me!

Text And Links In The Html File, Apear In Movie
Hi

How can i make text and urls written in the html text to apear in the movie.

On this site you can see what i mean:

http://www.djdready-2.ch/same/discog...iscography.php


Code:
<object type="application/x-shockwave-flash" data="emff_standard.swf?src=bre-hea_mrmix.mp3" width="110" height="34">
<param name="movie" value="emff_standard.swf?src=bre-hea_mrmix.mp3">
<param name="quality" value="high">
<param name="bgcolor" value="#000000">
</object>
As you can see... they have a ? after the swf location. I have seen sites that uses this questionmark and some text and the text will apear in the flashmovie.

How can i do this in my movie?

Thanks in advance!

Talking To Duplicated Movie Clips?
I am having a problem communicating properly to MCs that are being duplicated when the user clicks an icon and drags them to a hotspot.

My question is, if I have an data array associated to the MC being duplicated, does or can the duplicated MC contain a unique instance of the data array set? and if so, if the dulicated MC is on _level0, can I send the mulitdimensional array to the server as one variable? Since, I'm going to have an array of duplicatedMCs that each contain a unique data array set.

Targeting Duplicated Movie Clips
Hope someone can help me. I'm trying to target individual MC's that are inside duplicated MC's generated by an array. Is this possible?

thanks for any help!

Ray Boehmer

E-Learning Developer
Cisco Systems, Inc.

HitTest For Two Duplicated Movie Clips?
i have this game where there are MC's being duplicated and positioned at random points...my question is how do i test if one duplicated MC hits another one? i cant just go if(this.hitTest(_root.something)) because i dont know what name exactly the _root.somethign will be...since it could be either _root.something1, _root.something2, etc...get what i am trying to say? thanks.

Controlling Duplicated Movie Clips
hi,

On the scene I want 2 insects.I scripted one insect movie,when you click it,it gets crushed.Then ý duplicate it but when ý click on the second movie clip ,still first one crushs.Can you tell me what to do to crush the second one?Sorry,this is the second message but I couldn't get any help from the first one.
Thanks

Targeting Duplicated Movie Clips
So I'm using the following actionscript to duplicate a movie clip 50 times:

i++;
duplicateMovieClip ("_root.flower", "flower"+i, i);

Is there a way to target these clips?

Basically what I'm doing is duplicating a movie clip of a flower-like object. Then, when it's been duplicated 50 times, I want to wipe the stage clean of all duplicated clips and start again. What can I do to remove all of these movie clips?

Masking Duplicated Movie Clips
I am duplicate a movie clip that is under a mask layer but the duplicates of the clip apear outside the mask. is there any way to specify what layer the duplicates belong to or to put them under the mask.

thanx dave

Masking Duplicated Movie Clips
I am duplicating a movie inside another movie that loads external images.

I want to mask over the images to show only portions for a menu.

I tried using two movies in the container movie, one for the images(works well) the other for mask(failure).


I need help Urgently Please....

Targeting Duplicated Movie Clips
anyone know how to do this....i've been trying really hard and failing.... pleeeeease help someone...i want to target a movie clip("grow") inside some of the duplicated movie clips and tell it to play...

on(keyPress"i"){
//variables
b = random(12);
i++;
a = "leaf" + i

//dupposition
_root.leaf.duplicateMovieClip(a,i);
_root.leaf._y = ypos[b]
_root.leaf._x = xpos[b];

}




on(keyPress"i"){

_root.leaf1.grow.gotoAndPlay("fall");


}

Controling Duplicated Movie Clips
please could some one help me as this has been bugging me for days now.. i have duplicated a movie clip with the following lines :

for (i=0; i<=nosBoxes; i++) {
_root.box.duplicateMovieClip("box"+i, 1);
}

Now what i can't work out is how to contol/position the newly created boxes..

Also do you know where i could get some decent tutorials on scripting interactive graphics, i can't find any anywhere!! Any help would be greatly appreciated.

Removing Duplicated Movie Clips
Please help me!

I've got a movie clip that is duplicated that I'd like to remove/ or make invisible through a button action. I can remove the original clip, but not the duplicates of it. Can anyone help me?

Thanking you kindly!

Removing Duplicated Movie Clips
Does anyone know how to remove mulitple movie clips at one time (like when a user clicks a button)?

I need to clear an area of duplicated movie clips, all with different instance names at different levels.

Since they are on consecutive levels, I was going to run a loop to remove them based on their level position, but I don't know how to target a movie clip based on its level.

Thanks!!!

Removing Duplicated Movie Clips
I have a movie clip that can be dragged and when released a duplicate movie clips clip is created. This is the script that I used:

on (press) {
startDrag(_this);
}
on (release) {
stopDrag();
_root.i++;
_root.draw.green_circle.duplicateMovieClip("green_ circle"+_root.i, _root.i);
}

Now I would like to create a button that removes all of the duplicate movies clips. I have tried this with no success:

on(release){
for (var j = 1; j<_root.i; j++) {
_root.draw["green_circle"+j].removeMovieClip();
}_root.i=0;
}

Any suggestions?

Dragging Duplicated Movie Clips
i have movie clips that i'm using as stamps in a drawing program. when you click once on the stamp it picks it up then when you click again it places the stamp on the board. there are some problems with it though that I dont know how to fix. the problems are...

the biggest problem... when you click on a different stamp, one of the previous stamps disappears. so if you put two pig stamp on the board, and then put a chicken stamp on the baord, one pig will disappear. i dont want to have a stamp limit, they should be able to fill the whole board with stamps if they choose.

once the stamp is placed on the board you can click on it again and duplicate and drag the already duplicated MC. i dont want it to do this. i only want them to have one chance to place it on the board.

heres the code im using:

on (press) {
this = this.duplicateMovieClip("pig2"+count, count);
count += 1;
startDrag (this);
}
on (release) {
stopDrag ();
}

i changed the name of the duplicate mc for each stamp, for example the chicken is named "chicken2".

any help would be appreciated, thanks.

Masking Duplicated Movie Clips (HELP)
I have an array of thumbnails that I create through duplicated movie clips and loading jpegs into the clips. I have more jpegs than I do space in the strip I am using to display them however and I wanted to create a mask for each of the thumbnails so they would only be visible in the center of the strip.


duplicateMovieClip(_parent.thumbStrip.ImageButtons , "ImageButtons"+i, i);
duplicateMovieClip(_parent.thumbStrip.mask, "mask"+i, (i+totalImages));
_parent.thumbStrip["ImageButtons"+i].loadMovie("Thumbs/"+ _parent.slideImage[i]);
_parent.thumbStrip["ImageButtons"+i].setMask(_parent.thumbStrip["mask" + i]);


When I run this, the movieclips are simply duplicated above the thumbnails and do not act as masking layers. I don't want the masks to be visible, I just want them to act as a window. I've searched the forums and the links I have found don't quite relate to this approach that I can tell.

Any suggestions as to what I am doing wrong, and is this question clear?

Targeting Duplicated Movie Clips
I'm duplicating a movie clip using the following code:

i = 1;
do{
my_mc.duplicateMovieClip("my_mc" +i,i);
i++;

}while (i < 50);

The next thing I want to do is line them all up side by side, so what's the best way to target all the duplicated movie clips so I can re-set their _x and _y coordinates?
Sorry if there are loads of posts on this already but my browser kept timeing out every time I tried to search.
Many thanks.

Duplicating Duplicated Movie Clips
yo...
i found this tutorial here in fk that teaches how to make a flame animation.
the flame animation duplicates a movieclip.

what i want to happen is make the flames rain down,

i'm lost for words right now... sorry if im unclear...
anyways i'll attach the .fla here.
thanks.

Problem With Duplicated Movie Clips
Hey guys,

i'm having a strange problem with a slide show i'm trying to make. Essentially, it will be a scrolling slide show that automatically centers every time you click on an object. that part works right now. However, I want the slideshow to "wrap around" - that is, if i reach photo 100, i want photo 1 to be shown next to it, and vice versa.

Currently, I have it as far as duplicating the movie clip and positioning itself correctly - however, the onEvent handlers do not work for the duplicated movie clips.

I'd like to think i know a decent amount about actionscript but I must admit this is kind of uncharted waters for me. If anyone could help me get flash to recognize the on(release) event on the duplicated clip, I'd be forever grateful!

How Do I Mask Duplicated Movie Clips?
I am making a paintball game and have created a paintball movie clip that grows to simulate it hitting the screen. The problem i am having is that when i duplicate it, all my masking stops working. Is there a way of duplicating it behind the mask?

This the code i am using for duplicating at the paintball

_root.shot.duplicateMovieClip("shotx"+count, count);
_root["shotx"+count]._x = _root.enemy._x;
_root["shotx"+count]._y = _root.enemy._y;
_root["shotx"+count]._xscale = 0;
_root["shotx"+count]._yscale = 0;
count += 1;

Moving Duplicated Movie-Clips
If I have a line and duplicate it and make the new name "line"+i. How do I make the _x of every "line"+i to be added by 5. It doesn't work for me or I don't know the trick, I use Flash MX if that makes a difference or not. I'll post the code of what I mean.


Code:
_root.onEnterFrame = function() {
for (i=1; i <= 25; i++) {
duplicateMovieClip(line, "line"+i, i);
}
_root["line"+i]._x += 5; // this is what I want to work but I don't know how
};

Masking Duplicated Movie Clips
hi,

i'm using duplicateMovieClip() to display a list of results and i'm trying to mask an area of those results.

the problem i'm having is that the mask doesn't work because the duplicated movie clips are created at a higher depth than the mask itself.

anyone have any ideas how to fix that?

thanks in advance,

alex =]

Removing All Duplicated Movie Clips
I have a whole bunch of different duplicated movie clips called "unit+_root.i". (like unit0, unit1, unit2... etc) and when they defeat this castle thing, it moves to the next frame. The thing i want is when it goes to the next frame, it will take off all of those duplicated movie clips i just made. can anyone help me?

Controling Duplicated Movie Clips
hi, i'm developing a shooting game, in which i am duplicating the bullet (ship) to shoot at a guy.

i have an array as you can see here.



Code:
for (i=1; i<=50; i++) {
_root.ship[i] = new shipparent();
duplicateMovieClip(_root.ship, "ship"+[i], i);
_root.ship2._x = _root.gun._x;
_root.ship2._y = _root.gun._y;
}
}


in stead of using ship2, i would like to use what ever is the next unused ship... and im not quite sure how to do this.

does any body else know?
thanks a bunch

How Do I Target These Duplicated Movie Clips?
i want to when i click a button delete all these 50 smoke movie clips from the movie... how?
unloadMovie(_root.smoke_mc+j")????


_root.smoke_int = setInterval(createSmoke, 50);
function createSmoke() {
for (j=0; j<50; j++) {
var newSmoke = attachMovie("smoke", "smoke_mc", 500+j, {_x:400, _y:400});
newSmoke._x = (random(5)+70);
newSmoke._y = (random(100)+185);
newSmoke._xscale = (random(20)+50);
newSmoke._yscale = (random(120)+50);
newSmoke._alpha = random(5);
newSmoke.gotoAndPlay(random(20)+1);
}
}

Loading Jpg In Duplicated Movie Clips?
hello there.

I am trying to make an easy upgradable thumbnail flash. the concept is, duplicate a movie clip x times in order to load x .jpg files in the duplicated movie clips.


my code is:
x=1;
mc.duplicateMovieClip ("mc"+x, x++ );

problem is that I cannot address the newmovie clips to be loaded specific jpg files.

meaning, when I use:
newclip="mc"+x;
trace(newclip);

..I get the filename that corresponds to the loaded jpg I want, eg, jpg filenames be mc1.jpg, mc2.jpg, mc3.jpg, etc.

but I can't use this using loadmovie, eg

newclip.loadmovie("mc"+x+".jpg");

How do I syntax the loadmovie function in order to get the results I want?

Duplicated Movie Clips And Hittesting
I'm attempting a tower Defence game.
I've used both the available tutorials, then built from there.


I'm up to finding a way in which you can not place a tower on another tower.

i know it can be done.

heres the code.


Code:
function new_tower() {
tower.duplicateMovieClip("tower_"+t, t);
_root["tower_"+t].delay = 1;
_root["tower_"+t].dmg = 33;
_root["tower_"+t].bulletspeed = 5;
_root["tower_"+t].timer = 0;
_root["tower_"+t].range_visible = false;
_root["tower_"+t].tower_range._visible = false;
_root["tower_"+t].placed = false;
_root["tower_"+t].radius = 18.5;
_root["tower_"+t].onMouseDown = function() {
if (!this.ctower.hitTest(_root.path1.g1)) {if (!this.ctower.hitTest(_root.path1.g2)){if (!this.ctower.hitTest(_root.path1.g3)){if (!this.ctower.hitTest(_root.path1.g5)){
with (this) {
placed = true;
}}}}}
};


Just the top third of the tower actionscript.

Anyway, the t value is ++'ed at the end.

I've been toying around.. but to no avail.

But yeah, how would i do it. I tried a few stupid attempts like if(!this(_root["tower_"+Infinity]))

ect.

Please help us out, thanks.

Controlling Duplicated Movie Clips?
<please delete thread>

Controlling Duplicated Movie Clips?
Okay, I was here just the other night discussing this (and you guys were alot of help!) and i just have some questions

I have this game I'm making, its kinda like the game Defend Your Castle (if you've ever played it)

Basically I have one movieclip of a stickman, and i have that stickman being duplicated using duplicateMovieClip. All these duplicated stickmen spawn on the left side of the screen, and start running to the right.

Here is the code on the frame:
------------------------------------
interval=setInterval(SpawnStick ,1000);
count=1;
depth=1200;
function SpawnStick(){
status=Math.round(Math.random()*2);
if (status==0){
name="stick"+count;
duplicateMovieClip("stick", name,depth++);
setProperty(name,_x,-31.7);
count++;
}
}
------------------------------------
//basically just a setinterval to call the function SpawnStick (to spawn new stickmen)

I just want the stickman to turn red when you shoot/click him once. The red version of the stickman starts on frame 7 of the movieclip

on the "stick" movie clip i have:
------------------------------------
onClipEvent(load){
shot = 0
this._y=random(175)+140;
}
onClipEvent(enterFrame){
this._x += 2;
}
onClipEvent(mouseUp){
shot++;
if (shot==1){
this.gotoAndPlay(7);
}
}
------------------------------------

The only problem is that when i click/shoot any of the stickmen, ALL of the stickmen that are on the stage turn red. I understand WHY this happens (all the duplicated movie clips have the same code on them) but I don't know how to fix it.

How can i individually control each duplicated movie clip? I just need them to turn red when i click/shoot them once.

If anyone could help, i would be eternally grateful

Removing Duplicated Movie Clips
HI There

I know this has been discussed before, but I was unable to resolve the following problem using the proposed answer. I am working on a Flash / ASP application for logging IT related requests. In order to display all requests logged by the current logged in user, I query the database, and return the results as arrays. Using the arrays, I create a set of duplicated movieclips using the following code:

ActionScript Code:
stop();

// hide the origional clips
RefID._visible = 0;
Subject._visible = 0;
DateLogged._visible = 0;

// split up the array by looking for the commas
ID_array = IDoutput.split(",");
Subject_array = SUBoutput.split(",");
DateLogged_array = LOGoutput.split(",");

// get the length of the array
ID_length = ID_array.length;

// set the start y position (x position depends on where you put it on the screen)
yposition = 70;

// looping everything
for (i=0; i<ID_length; i++) {
    // RefID
        duplicateMovieClip(RefID, "RefID" add i, depth);
        setProperty("RefID" add i, _y, yposition);
        RefID.RefID = ID_array[1];
        set("RefID" add i add ".info", ID_array[i]);
        depth--;
   
    // Subject
        duplicateMovieClip(Subject, "Subject" add i, depth);
        setProperty("Subject" add i, _y, yposition);
        Subject.Subject = Subject_array[1];
        set("Subject" add i add ".info", Subject_array[i]);
        depth--;
       
    //Date_Logged
        duplicateMovieClip(DateLogged, "DateLogged" add i, depth);
        setProperty("DateLogged" add i, _y, yposition);
        DateLogged.DateLogged = DateLogged_array[1];
        set("DateLogged" add i add ".info", DateLogged_array[i]);
        depth--;
   
    // Set the y position plus 25
    yposition = yposition+25;
}

The code above works fine. When the user clicks on the "RefID" movie clip, it must take him/her to the details of that issue. This once again works fine, but when I try to remove the movieclip, it only removes the first one, and the rest remains visible.

I tired the following code to remove the duplicated clips:

ActionScript Code:
stop();

for (i=0; i<ID_length; i++) {
   
    test = "RefID" add i;
    removeMovieClip(test);
}

Thank you in advance
O-Grrrrr

Masking Duplicated Movie Clips
I have a snow effect in my project and need to mask it. How can I do this?

Formatting Duplicated Movie Clips
Hi All,

I am using the following code to duplicate a movieclip (itemInstance) and get them to stack one below the other.

Code:


// get position of template movie clip
yPos = getProperty("itemInstance", _y);

// iterate over array elements
for (i=0; i<(names.length-1); i++) {
// clone movie clip and name it
duplicateMovieClip("itemInstance", "itemInstance"+i, i);
// set position
setProperty("itemInstance"+i, _y, yPos+i*108);
}


This works fine, but I want it to stack 10 vertically and then go right 300px (or so) and then go back to the top and stack another 10. And so on, like bricks in a wall.

Just so you know the number for 'i' is dictated by the number of names in a database.

Any help will be greatly appreciated - thanks

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