ActionScript 2.0 :: Loop With XML - Duplicate Some Main Button MovieClips For Each <dept> Node
Aug 25, 2004
What Im trying to do is duplicate some main button movieClips for each <dept> node. When pressed these main buttons then show a second set of buttons for as many <menu> nodes there are. In the actionScript the displayMainButtons function is used to loop through the XML and display the Main buttons. With the other 2 display functions (displayFirstButton and displaySecondButton) Im displaying another button for each <menu> node. These too works just fine, but the problem with writing it this way is that I have to write another display function for as many <dept> nodes there are. Id like this to be written so it loops through it in one function so I can add as many <dept> nodes with as many <menu> nodes as I'd like without going back into the AS code to add more display functions. And as you can see, I had to do the same to delete the buttons.
View 1 Replies
Similar Posts:
Feb 18, 2010
I have a for loop that adds 5 movieClips to the stage at a random position every time I click the enterBtn, what I want to do if the enterBtn is click again remove the movieClips previously generated and leave only the new ones on the stage.
Oh, the number "5" in my for loop will be dynamically created so it may be different if the enterBtn is click again (I just used 5 for simplicity).
enterBtn.addEventListener(MouseEvent.CLICK, calculator,false,0,true);
function calculator(event:MouseEvent):void {
for (var i=0; i<5; i++) {
[Code]....
View 3 Replies
Feb 11, 2011
Trying to loop though my XML data and assign to text fields. Not get a specific error but I am pretty sure it has something to do with the way I am referencing the data and assign it to the .text box. I am also having issues with getting the length of my xml so I know how many times to loop.first a summary of my XML:
<Worksheet>
<Row>
<Data>Last Name</Data>[code].....
View 4 Replies
Feb 18, 2009
I have an AS that reads a PHP generated xml file. I've got it to get mysql db info just fine. Only problem I'm having is it keeps getting the <item> field from the first node.
Here's my XML:
Code:
<birthdays>
<month>January
<item>ronnie7211 - 01st</item>
[Code].....
As you can see the output is all wrong. I should be reading the <item>s under the <month>February</month> node.
View 3 Replies
Oct 6, 2008
I'm having an issue grabbing xml node attributes through a multidimensional loop.Here is the Actionscript:
Code:
-------------------------------------------------*/
var FourPlayerXML:String = "videoPlayer.xml";
[code].....
View 4 Replies
Feb 23, 2006
im loading in a xml doc and it loop in the xml doc depeneding on how many node are in it. and attaches the nodes to a mc. the mc has three text fields in it. im trying to move that mc called t over 50px on _y.Code: as of right now they load on top of each other. does anyone know how i would go about doing that?
View 12 Replies
Feb 7, 2008
My nested loop works fine, but I don't know how to call out a node or set of nodes in my code. Here is what I have
knobCC = [];
knobCCC = [];
var hardware = this.firstChild.childNodes;
[code]......
View 2 Replies
Jan 15, 2009
I am designing a flash game and I am having a bit of trouble with the Actionscripting, I wondered if you might be able to help me? I will try and explain how the game should function and I attach a JPG that shows the rough layout as well, hopefully from that you may be kind enough to point me in the right direction.
How it should function The idea is you have a glass that you control, left and right keyboard arrows control left and right movements and it only moves on the _x axis and the _y axis always stays at it's current value, this works fine and I have managed to add actionscript to the glass movieclip to do this, the movement also has gravity and friction which means the glass slides on a little even when you move to go the other way.
Using the Glass you need to collect falling object movieclips, there are two types, good and bad. When you catch the good it adds to your score and when you catch the bad it deducts from your score.
The falling objects need to be random and I have successfully managed to get 1 movieclip to fall by using actionscript code and also I have managed to set the _x position as random each time , the actionscript to do this has been applied to the falling object.
[Code]...
View 3 Replies
Mar 4, 2007
im having problems with a nested loop. i found some post here, but they didn�t help me. i need to extract the individual values from a nested xml node. i simplyfied the xml.
this is the code:
[Code]....
View 1 Replies
Mar 15, 2009
I'm trying to hitTest two duplicate movies clips. One is a bullet and the other is an enemy. I have them properly duplicating, but I cannot figure out how to detect a collision between the two. I've trying everything I can think of, and so far I've only been able to get the hitTest working between the original enemy and the bullet duplicates.Here is the code for duplicating the enemy:
Code:
bb++;
duplicateMovieClip(_root.target, "t"+bb, bb);
[code].....
View 2 Replies
Mar 24, 2011
I have created an external class for a particular movieclip and I would like to link a duplicated version of this movieclip to the same class file.
Problem is I can't seem to do it. Even if I state the class as the BASE class of the new movieclip and create another random class name for it.
Is there a way I can get around this so I can assign my duplicated clip the same class name ??
View 9 Replies
Jul 23, 2006
I've created movieclips that duplicate and swap depths but I can't seem to get them to rotate. I want the mc to rotate when the rotate button is clicked. I have created a button file that executes the rotate function properly but I can't make it swap depths like the others. How can I get all of the functions into each object?
View 2 Replies
Feb 29, 2012
I'm currently trying to make a cross-hair shooter game with an additional onstage character so that you not only shoot the AI, but also dodge using the arrow keys. The problem is, I have a code saying that if the AI hits the player unload the player, the AI, and the AI duplicates. The player and the AI are unloaded, but the AI duplicates are not! I tried fiddling with the code but just can't get it to work.
[Code]...
View 3 Replies
Jul 3, 2006
I have yet another "I die-problem", not so drastic this time, though. I've only tried to solve it for two hours or so,it's killing me Well, as usual, I end up here, at the Kirupa forums.. and of course, l end up emptying the coffe-machine at work.. *runs for more espresso* It's an issue regarding the duplicateMovieClip function. I know how it works, and I know how to duplicate MovieClips using the function, however, I do have an issue figuring this out: Now, explained roughly:I have a MovieClip which contains yet another MovieClip. I want to duplicate both the MovieClip and it's child, but I want it to stay inside the parent MovieClip, just as the original MovieClip contained the original child.
View 13 Replies
Aug 4, 2007
i found this file a while back ("dynamic_rotation") and i would like to rewrite it to place all the code in the _root on it's own layer.the duplicated squares don't move.here is the original code on the mc:
onClipEvent (load) {
y=100;
Angle_Inc=12;
[code].....
View 11 Replies
Feb 29, 2004
I'm trying to make a bit stream across my page when you mouseover a button. The bit stream can be quite long, so I wouldn't think to do it by hand. I'm wondering how I would go about making the stream start out, and how I can get each bit to follow the other right behind it. (They're about 10 pixels wide) I can get the for loop to duplicate the clips, but I can't seem to get them in order.
View 5 Replies
Apr 11, 2011
that how can i duplicate a movieclip to as much numbers i want through out the stage using actionscript2. i have searched lots of posts in sites but i can't get it
View 6 Replies
Aug 9, 2005
I have a for-loop that creates instances / duplicates of a movie clip that works like a charm:
[Code]...
Then I position each instance- and I fill an array with the number ("pg"), because: I also have the option to switch to a different view and at that point I want / need the MoveClips to disappear. So I have a function tied to the switching that goes through a loop for all instances of the movieclip copies (using the array with the IDs from the example above) and remove them.
[Code]...
View 1 Replies
Apr 8, 2007
I was wondering how to have collision detection between two differente duplicated movie clips. For example, a duplicated bullet hits a duplicated bird, how do I make it so that it detects collision when the duplicated bullet(bullet+x) hits the duplicated bird(bird+x)?
View 3 Replies
Apr 9, 2008
I will have 5 type of buttons. Each type I will duplicate (+1) at some condition. Each button is sharing a same functions, just some difference in value and positions. Button type's name:bug1, bug5, bug10, bug20, bug50
[Code]...
View 4 Replies
Mar 27, 2008
i have a loop calling in the length from a xml file, how can i duplicate the text field, since this function does not exist?
for (var j:Number = 0; j<=section[0].nTitle.length; j++) {
this.createEmptyMovieClip("mNav",this.getNextHighe stDepth());
mNav.createTextField("tSub",this.getNextHighestDep th(),100,100,100,20);//places it at x:0 y:0 size 100x20 pixels
[Code].....
View 1 Replies
Aug 5, 2006
I've got 4 menubuttons: homeBut, aboutBut, portBut and contBut that I'm adding a rollover command to. If I write all of it out as below it works correctly. Obviously this isn't the way to do it so I've used an array and for loop to duplicate this process. However, when I compile the .fla the rollovers don't work. I thought I had my head around loops, vars and arrays but apparently not.
Below is the bloated, redundant code that works followed by the array/loop code that doesn't.
// Main Menu: Rollover
/*this.menuMC.homeBut.onRollOver = this.menuMC.homeBut.onDragOver = function() {
this._parent.homeTxt.gotoAndStop("on"); };
this.menuMC.aboutBut.onRollOver = this.menuMC.aboutBut.onDragOver = function() {
this._parent.aboutTxt.gotoAndStop("on");
[Code] .....
View 2 Replies
Oct 5, 2007
got some code working to duplicate a movieclip, but what I'd really like to do is obviously randomise the movieclip's x position so that it spreads across the stage, rather than stacking in the same position as it is now.
Code:
for (i=1; i<11; i++){
duplicateMovieClip("alien", "alien_new_"+i, 22-10, i);
}
View 4 Replies
Feb 18, 2004
I'm using a loop to duplicate a MC named MCbutton, which is all good.
[AS]
for (i=1; i<=this.total; i++) {_root.MCbutton.duplicateMovieClip(["MCtest"+i], 1+i);
trace(_root.MCtest1);
[Code]....
Can't i duplicate a Clip inside another Clip??
View 5 Replies
Jan 12, 2012
I have this current simple setup:
- MOVIECLIP1, with more than 30 run-time drawing shapes that modify on enterframe.
- and MOVIECLIP2, wich should contain an exact copy of MOVIECLIP1 drawed data.
The point is that MOVIECLIP2 will be as a "reflection" or "shadow" of movieclip1. I won't need to do any interaction with it, only apply filters. Is there anyway that this can be possible - rather than having to draw the same shapes twice on both movieclips?
View 4 Replies
Jun 25, 2003
how can I adjust the _x and _y area positioning of this set of duplicate movieclips? 710 x 143 are the dimensions I would like the duplicateMovieClip to take place, but it is not the positioning. How can I fix this?
[AS]
duplicateMovieClip (flower, "mc"+i, i);
setProperty ("mc"+i, _x, random(710));
[code].....
View 11 Replies
Sep 2, 2009
I have a bunch of copies of the same MovieClip that are dynamically created I want them to be stopped when the swf first starts.When I click on one of them I want that particular one to play.I think that I've figured out how to play a single MovieClip with event.currentTarget.play(); but I am stuck on how to stop all the clips from the start.I thought I could just use a instanceName.stop(); in my for loop, but no go.[code]I'm an artist working on a piece where I am cataloging sound recordings from people (eventually recorded live from the site... but that's a battle that I'll deal with in phase 2 and after I have a bit more actionScripting under my belt).I just wanted to explain myself a bit since Kglad, Ned, and dmennenoh have helped me a bunch through the development of the project.If your interested you can check out some of my works on my website.I know,I need to update the site, but its more fun to work on new projects.
View 5 Replies
Aug 5, 2004
how to communicate with those clips specifically to make them draggable and also to change the _rotation with Key.Right, Key.Left.
View 7 Replies
Aug 5, 2004
I found the tutorial on duplicating movieclips, especially the line-by-line translation of the code. how to communicate with those clips�specifically to make them draggable and also to change the _rotation with Key.Right, Key.Left.
View 7 Replies
Jan 17, 2012
I Have a flashmovie thats almost done and will soon hit the internet, but I want to add some animations into the website it�s two gears that I�m about to put at the bottom of the page and when a button releases in the main flashmovie the two bottom gears will turn a few frames and just stand still.These three movies are all separate (main movie, first gear and second gear).
It's a homepage designed in HTML and flash that has this "main flashmovie" in the middle of the screen, the size is about 1500(width)X800(height). And the gears is about 800wX200h placed at the left and right side bottom of the page. Dont worry the site is easy to apply to any screen resolution.I have been looking everywhere for any soul out there who suffering from the same problem but no success. Is it possible to script a button in the main movie to launch two separate movies in their own contents?
View 2 Replies