ActionScript 2.0 :: AttachMovie Addressing In A For Loop
Jun 25, 2008
Looking to convert the following attachMovie actions to a for loop. I get an error message running the following loop and I'm not sure what the correct syntax is. Takers?[code]
View 1 Replies
Similar Posts:
Mar 3, 2011
I am trying to create a pair of custom drop down menus (one for states, and then one for each states counties). I have an XML doc that contains all this info, which I am parsing out into an array(sc). What I would like to happen is when the user rolls over the states drop down arrow(stDropArrow_mc) that I run a for loop which attaches some movie clips to a states movie clip already on stage(states_mc), fills in the state name in a display text field(display_txt) within the attached movie, within the "states_mc" on stage(root timeline). so essentially(states_mc."NEW ATTACHED MOVIE CLIP NAME".display_txt.text) Here is a code sample that I am using...
[Code]...
View 1 Replies
Feb 24, 2005
i've got an attachMovie in a for loop, that creates a number of buttons, depending on how many names are in an array. as of right now i have the buttons created vertically, and im controlling the x value, like this:
allNames = attachMovie("menuButton",myArray[e],depth,{_y:allNames._y+allNames._height+5});
allNames._x = 520;
i'd like to do two things that this won't let me do:
a. have more control over the Y coordinate, so when the loop starts i can say 'start making the buttons at x: 520, y: 350, instead of them just starting at y: 0 like they are now.
b. have a way to check if the amount of buttons reaches five in height, if so, the array starts a new column at x: 600 y: 350. im trying to have it do that about 3 times, as the amount of buttons will vary from 5-15.
View 1 Replies
Mar 24, 2008
I seem to be having a bit of trouble with my code- specifically the attachMovie line in the for loop below. I have a series of movieclips with identifiers named "loc_1", "loc_2", "loc_3" ... which are supposed to load inside the scrollPane which is located on the root timeline. I think I have the problem narrowed down to the first parameter in attachMovie : mcMain.attachMovie("loc_"+i, "loc_"+i, mcMain.getNextHighestDepth()); If I change it to "loc_1" instead of "loc_"+i, it loads the movie clip.... Here's what the AS looks like:
[Code]...
View 1 Replies
Jan 29, 2010
I am having a bit of a nightmare with a site i am trying to build at the moment and would be most grateful for any help. I have a menu bar which is made by looping through an array of the menu options (and submenus) and then attaching a menuitem movieclip in each case (then setting the text). The menuitem movieclip contains a dynamic text field and also actionscript to draw the background depending on the current settings (colour, border etc).I have a variable in my root fla file called menuwidth and this is used within the menuitem movieclip to define the width of the menuitem. When i set this to one value it works absolutely fine and creates the menus accordingly. i can change this to whatever size i want (including calculating the size of the largest option and then setting it to that, to ensure all options fit).
I have been trying to code it so that the menu options can be different sizes (in the event of a horizontal menu) so that you can have one that is wider than another. The code has become quite long (due to submenu and other functionality) but in a nutshell it is:[code]Instead when i use the code above all of the menuitem movieclips end up the same width as tthe final one (so if there are 5 menu options and the starting length is 50 then the ending length is 75 then all of the movieclips are 75 wide). When i try and debug it and check the value of _root.menuwidth inside the menuitem movieclip it states that it is set at 75 every time with no variation at all.It is almost as if it doesn't run the attach movie commands until the loop has finished, at which point all of them execute (and _root.menuwidth has already increased to it's highest possible value), but i can't see how this would make any sense.Obviously there are a number of other options that could be at fault, but i am trying to whittle it down and would be most grateful if anyone could explain to me if the above logic holds true and that increasing the _root.menuwidth value within the loop just before callin attachMovie should cause each one to be progressively bigger?
View 2 Replies
Jan 29, 2010
I have a menu bar which is made by looping through an array of the menu options (and submenus) and then attaching a menuitem movieclip in each case (then setting the text). The menuitem movieclip contains a dynamic text field and also actionscript to draw the background depending on the current settings (colour, border etc).
I have a variable in my root fla file called menuwidth and this is used within the menuitem movieclip to define the width of the menuitem. When i set this to one value it works absolutely fine and creates the menus accordingly. i can change this to whatever size i want (including calculating the size of the largest option and then setting it to that, to ensure all options fit). This works great.I have been trying to code it so that the menu options can be different sizes (in the event of a horizontal menu) so that you can have one that is wider than another. The code has become quite long (due to submenu and other functionality) but in a nutshell it is:
for(var i=0; i<menulength; i++)
curr_item = curr_menu.attachMovie("menuitem","item"+i+"_mc", i);
}
[code].....
View 4 Replies
Sep 6, 2010
I have 3 buttons and when I click them the attach movies corresponding to them from the library should show up. Issue is with for loops. It stops at last number. What should I do or use for loop so that when I click my invisible buttons, movie corresponding to them show up? and only that movie show up, not anyone else.
buttonArray = [btn,btn1,btn2]; //mouse click button
movieArray = ["mypopmc","mypopmc1","mypopmc2"]; //movie name;
mArray1 = [mypop_mc,mypop_mc1,mypop_mc2,]; //movie instance name
//dynamic text instance for 3 movies are y1,y2 and y3
for(n=0;n<buttonArray.length;n++) {
[Code]...
How could I create the for loop so that with every mouse click it shows the corresponding movie and text in it. It should show only 1 movie at a time with 1 mouse click on the invisible button (I meant corresponding movie).
View 1 Replies
Nov 18, 2009
I've been modifying some code I wrote a while ago that simply loads and plays an external FLV. The original code works well as I can simply copy the swf into any folder and when run, it will play the FLV with the given name in that particular folder.
I decided to have a photo still over of the movie before it plays, so I modified the script and 'loader' to put in the external Jpg. If I test the swf it works fine. But when I install the code from a sub folder into a webpage via 'object', the Flash file trues to find the photo in the webpage folder not the sub folder where the swf originates and where both the FLV and jpg are?? Both the FLVplayback and Jpg loader address in the same way in 'parameters' of properties, yet the FLV plays and the jpg won't. I only discovered what exactly was happening on a hunch and copied a different photo into the main web page folder with the same name.
I have also rewritten it a completely different way using movieloader, but got exactly the same results. I know I could put the full web address of the jpg into the parameters, but then I have to modify it every time I use it. I'd really like to be to simply copy it into another folder.
View 3 Replies
Jan 9, 2003
I was wondering what you put in for addressing the duplicate MC?
View 10 Replies
Nov 7, 2004
I have the instance 'CONTENT_ldr' on the main timeline. Now I need to load an swf into it using AS when I press on the 'Illu_mc' button placed in my HomeMenu_mc.
Heres the script I have placed in my HomeMenu_mc:
this.Illu_mc.onRelease = function() {
this._parent.CONTENT_ldr.contentPath = "ILLUPROJ.swf";
};
View 6 Replies
Jun 11, 2009
I imported the flvplayback component on-stage in one frame and gave the instance a name of hv.If a button takes the movie to another frame, how do I pause the flv at that point
View 1 Replies
Oct 30, 2010
I have a flash banner in my website and it has some navigation links on it .
Because I have several different folders in my website I need address them from the root .
At the moment i use getUrl like this :
getURL("ArticleList/Default.aspx");But it doesn't work .
View 2 Replies
Mar 27, 2004
I have a movieClip, in it a button, in it another movieClip (activated on mouse over). When i rollOver it works normally, it stops at the 15th frame as it should. Now I have another 15 frames for the rollOut and i can't get them to play,
[Code]...
View 4 Replies
May 17, 2005
i have this on my buttons (movieclips):
on (rollOver) {
name=this._name;
path=this._target;
_root.push (name, path);
}
on the timeline i have the function:
_root.push = function (name, path){
trace(name);
name.gotoAndPlay("over");
}
on rollOver i want to dynamically pass a movieclips name to a function which controls that the movieclip should goto its frame named "over", but i cant get the adressing to work.if i trace the variable "name" in the example it gives me the moviename correctly. so i guess my syntax is wrong.the function doesnt work with the path variable either.
View 6 Replies
Mar 10, 2009
I've got a column of buttons that load dynamically with attachMovie, and are named in the for loop as "patentBtn"+i+"_mc" etc.
When I address them in the code like this:
Code:
patMenuHolder_mc.patentBtn0_mc.onRelease = function(){
gotoAndStop("Claims1");
patMenuHolder_mc.patentBtn0_mc.gotoAndStop("active");
[Code]......
View 11 Replies
Sep 10, 2009
I have three movieclip "buttons" within a couple of nested movieclips and I am unsure how to address them in actionscript. I have an event listener and a function for the rollover and rollout mouseEvents below
procedures_mc.p_dropdown_mc.p_body_mc.addEventListener(MouseEvent.ROLL _OVER, cursorOverButton);
procedures_mc.p_dropdown_mc.p_breasts_mc.addEventListener(MouseEvent.R OLL_OVER, cursorOverButton);
procedures_mc.p_dropdown_mc.p_face_mc.addEventListener(MouseEvent.ROLL _OVER, cursorOverButton);
function cursorOverButton(e:MouseEvent):void{e.currentTarget.gotoAndPlay("over");
e.currentTarget.addEventListener(MouseEvent.ROLL_OUT, cursorOutButton);}
function cursorOutButton(e:MouseEvent):void{e.currentTarget.gotoAndPlay("out");}
Within the movieclip buttons are labels over and out included in the buttons. When I rollover and rollout the mouse over the movieclip buttons they don't behave correctly. I am wondering if the e.currentTarget inside the function is the right address of the nested movieclip buttons procedures_mc.p_dropdown_mc.p_body_mc, etc.
View 2 Replies
Oct 11, 2009
So I've got this function to make a sprite walk:
[Code]....
But what do I have to do to get the function to adress various versions, such as
chibi.bluejeans1.rtleg._y = 4 + walk; chibi.bluejeans1.ltleg._y = 5 - walk;
so that I can address each type for walking accordingly, through something like
wlk(tunicpants1);
wlk(bluejeans1);
wlk(tuxedopants1);
[Code]....
View 1 Replies
Aug 4, 2009
I'm brand new at AS3 and having trouble targeting nested movie clips stored in my library. Here's my sample code:
[Code]..
View 0 Replies
Nov 27, 2005
I can't address the array i've created inside the movieclip from outside!
Array name is categories, inside the templates movieclip in _root; I press a button on _root to trace the array inside the movieclip using this code:
Code:
on(release){
trace(_root.templates.categories);
}
It gives me: undefined
View 9 Replies
Sep 1, 2006
I'm having a bit of a problem with this. I have a class- MiniMap which extends the MovieClip class.This class has a variable which is itself a movieClip, this movieClip is a small window which can be moved around on the map to select which portion of the miniMap will be shown in the bigger map.
How do I refer back a events on the class variables to effect the host class?
[Code]...
View 4 Replies
Sep 9, 2010
I'm successfully adding an external .swf file using the following code:
[Code]...
So - I'm loading the "graphic.swf" into a movie clip called "topClip" which is already on the stage in the main timeline. That works fine. But... then I'm having a problem addressing the loaded "graphic.swf" with a button (to lower it's alpha). I'm using this:
[Code]...
View 1 Replies
Oct 8, 2004
does anyone have a tip on how to "bind" events to dynamically created movieclips ?
[Code]...
View 4 Replies
Oct 18, 2010
I am trying to dynamically address different instances of the same movieclip by passing a string into the movieclip address, but apparently I don't know what I'm doing. I'm trying something like below:
var vsTargetName:String;
vsTargetName = "instance50";
vsTargetName + vsThumb.thumbHighlight.visible = true;
Is something like this possible? What am I doing wrong/what do I need to do to make that work?
View 3 Replies
Jun 30, 2009
I have a series of mc's I'm attaching from the library, with buttons in the main movieInside each of the attached mc's is a close button that needs to close the attached mc and launch a function in the main movie, but I'm having trouble addressing the button inside the attached mc from the main timeline.I've tried this:
Code:
calloutHolder_mc.attachMovie("mar01callout", "callout_mc", 0);
calloutHolder_mc.callout_mc.close_btn.onRelease = function(){
[code]......
View 0 Replies
Sep 18, 2009
what I'm trying to do is access the data of several movies clips, that are inside of several other movie clips:
MC1.insideMC1._visible=false (which works, but isn't dynamic)
but dynamically with a FOR loop. I've tried:
For(bullet=1; bullet<5; bullet++){
"MC"+bullet.insideMC1._visible=false (this does not work)
}
View 1 Replies
Apr 22, 2004
I have a problem with relative addressing... it's not about _root stuff, but how to open an html page from a Flash movie.The Flash movie is inside a Folder named "Dogs". And the html document is outside this folder, sitting in the main folder for the site.Usually if I call a movie from inside a folder I put a slash eg. getUrl("dogs/intro", "window")but i want to go in the opposite direction, from inside this folder to a file outside... does that make sense?
View 1 Replies
May 17, 2005
i have this on my buttons (movieclips):
[Code]...
on rollOver i want to dynamically pass a movieclips name to a function which controls that the movieclip should goto its frame named "over", but i cant get the adressing to work. if i trace the variable "name" in the example it gives me the moviename correctly. so i guess my syntax is wrong. the function doesnt work with the path variable either. i know this might be a stupid question. dont mind me, i'm a noob.
View 6 Replies
Nov 24, 2005
Is there (or what is the) best method to address duplicated movieclips? For example if you duplicate a number of movieclips (or attach or anything else) through a for loop and give them names like mc1, mc2, etc, how can you address them outside the loop? Especially if the number of times you duplicate the clips is read from a file which can change constantly. Example - an image gallery where you just add the files to your xml and they show up in the gallery.
View 5 Replies
Aug 9, 2010
Let's say I have a movie clip named MC in stage. The following statements work.
var clipName = "MC";
this[clipName].y = 100;
However, if I put a child movie clip (named childMC) inside that MC movie clip, I'm not able to address the child movie clip by the same fashion. I'll get an error.
var clipName = "MC.childMC";
this[clipName].y = 100;
Is there any way to address the child movie clip with dynamic name?
View 8 Replies
Oct 14, 2010
My Flash file provides a small number (say, 4) of user-selected �displays. Within each display, there are up to four link movie clips, each of which are (or should be) selectable. The displays have instance names of display0_mc, display1_mc, display2_mc, and display3_mc. I can address each display through an array var display:Array = [ display0_mc, display1_mc, display2_mc, display3_mc ]; as display[ 0 ], display[ 1 ], etc. Now, the four links within each display are named link0_mc through link3_mc. (Each of these is actually a movie clip containing a dynamic text field, link_txt, and a few other elements not relevant here.)
[Code]...
View 5 Replies