ActionScript 3.0 :: Parsing Together Movieclip Names?
Feb 19, 2010
In AS2 you could parse together movieclip names so that you could do things like this - Let's say you have a movieclip (clip1) inside a clip (clip2). You could do:
name1 ="clip" + 1;
name2 = "clip"+ 2;
and then when referencing the lower clip you could do: _root[name2][name1]._alpha = 50;
That doesn't seem to work in AS3, even if do something like
clip2[name1].alpha=.25;
I'm probably referencing the objects wrong, but can anybody shed any light on this? I'm having trouble parsing together paths and object names and it's driving me nuts.
View 3 Replies
Similar Posts:
Jun 13, 2009
How can I know the label of diferent node names parsing xml? I'm using something like
this is the xml structure
<bd>
<tabela label="design"/>
<familia label="familias"/>
<tabela label="produtos"/>
</bd>
[Code]...
View 5 Replies
Nov 9, 2010
How can I reliably iterate through a MovieClip for every child?
I'm working on a game and a great way to lay out my levels is inside a MovieClip, with each frame being a new level. The problem is that when I move on to frame 2 or 3 and try to iterate through the MovieClip's children, I'm getting a different number (less) than is actually on that frame.
I think it's because the instances from the previous frame are being carried over to the new frame.
A simple solution is to create a new MovieClip for every level instead of a new frame inside each MovieClip, but this isn't the most scalable solution (say I want to remove a level or add a level between other levels, etc).
View 3 Replies
Jul 3, 2009
I am creating objects (MovieClips) which have properties in the form:
obj1.property1 = "T-shirt";
obj1.property2 = productID;
obj1.property3 = Size;
obj1.suboption1.property1 = Small;
[Code]...
View 5 Replies
May 18, 2009
I have an array that houses the names of six movieclips. I randomly select three of them. I am trying to get my randomly chosen movieClips to do what I want them to do. I have tried the following code to get the first to fade in:
[Code]...
But it does not work. The trace comes back with the full movie clip name ex: mcTom, but even though that value comes up in the trace, the AS doesn't see it as a movie clip. Any thoughts on how I can correct this?
View 4 Replies
Feb 23, 2010
I am trying to get the instance name that i gave to a dynamically created movieclip the movieclip was created using var zebra_mc:Zebra = new Zebra(); //creating a new instance of the zebra class The movieclip was then added to the stage using a for loop, as it was contained in an array. Each time a movieclip is added to the stage it is then added to another array (existingObjects) I then need to iterate through this array and pull out each objects names. I have tried using existingObjects[i].name, which returns "instance140" and existingObjects[i].toString, which returns functionFunction(){}, very useful. and existingObjects[i] which just returns the object.
View 2 Replies
Aug 1, 2005
I've got this code but apparently the reference to the button doesn't work since i get an AS error upon execution.
PHP Code: [code].....
I've already tried without the brackets but that yields the same result.
View 3 Replies
Apr 16, 2011
In the second line of code below, I'm attempting to add the string "banner" to a variable called "btn_2". When I do this, I receive a "type coercion failed".
Code:
var btn:MovieClip = MovieClip(e.currentTarget);
var btn_2:MovieClip = MovieClip(e.currentTarget + "banner");
View 14 Replies
Jun 13, 2009
I need to write a function that retrieves the instance names of movie clips without knowing what those instance names are.
Here's the scenario:
The timeline reaches a frame which has a movieclip with an instance name of "bigClip"
bigClip itself holds a number of movieclips, each with its own unique instance name. On the enterFrame of bigClip, I want to retrieve all the instance names that are on bigClip and put them in an array.
View 2 Replies
Jul 8, 2009
I have an array of data that I'm using to create thumbnails and labels I'm using "Loader" to load the thumbnails (sample code below) but what I'm wondering is how I can make the name of the loader dynamic so that each child gets named "image1, image2, ...". I tried adding "[i]" after the "image" for each item in the code but it complained about missing semicolon before left bracket.
var image:Loader = new Loader();var target_image:URLRequest = new URLRequest("images/" + xmlData.Product[i].id + ".png");image.name = "image_"+[i];
image.load(target_image);
[code].....
View 3 Replies
Jan 31, 2011
I am trying to create a function, wherein depending on the numeric value of a certain variable, a particular movieclip is loaded into a holder movie clip.This is how I would want the code to work...excuse the syntax as I am not very familiar with Actionscript 3.
if(count1 == 1){
if(count2 == 2){
holder.addChild("nameofclip"+count1+"secondpartofname"+count2);[code]...
Also, can I create classes dynamically in a similar manner?
View 2 Replies
Dec 3, 2007
When I want to loop through instance names like: "tile1", "tile2" etc. I use a code like this:
PHP Code:
for(var i=0;i<=10;i++){
this["tile"+i]._x=300;}
But when I put these MC's inside an MC (which I've named: "ground") for some reason this code:
PHP Code:
for(var i=0;i<=10;i++){
_root.ground.this["tile"+i]._x=300;}
doesn't work. Is there a way to loop through all the objects inside a movieclip without giving each one an instance name?
View 4 Replies
Jun 29, 2008
var c = mainSubThumbs.SubThumbsHolder[materialType].subthumb_mc[id] what i have obviously doesnt work. materialType and id are my variables that I want to be added onto these mc instances..
View 9 Replies
Oct 17, 2011
I'm looking to get some information on something I've been wondering about for a while now. Is it possible to call a dynamic movieclip? Here's an example: I have 30 movieclips all named sequentially: A001, A002, A003, etc. I want to make a listener to dynamically know if I've clicked any one of the 30, but also know which of the 30 I've clicked.
You know, to avoid writing 30 variations of a listener. (not to mention that I have 5 categories to do this for, meaning there are 150 in total) Perhaps what I would need out of it would be the number value, as well. To perhaps place that in a variable after it has been recognized, so I can use it in the function.
View 13 Replies
Nov 8, 2010
Is there a way to obtain a reference name of each item on the stage. A reference name that can be then used to manipulate the object? (and how would one do that if successful in obtaining the name?)
As an example that is not working for me, if I drag to stage two movie clips and dynamically include 5 additional movie clips at runtime, this [code]...
View 2 Replies
Apr 30, 2009
In the AS2 days you could create an array and add a bunch of Mc names to it like so
Code: Select allarray("clipA","clipB","clipC", etc..)
Then you could use this array to reference clips dynamicly or on stage to do stuff.I was trying to do the same with AS3 but came across a problem I've not found an answer to yet. I created the following code:
Code: Select allvar letterArray:Array=new Array("A","B");
var buttonArray:Array = new Array();
//
[code]....
Now with the line:
Code: Select allvar currentButton:MovieClip = buttonArray[i];
I get: Type Coercion failed: cannot convert []@369e8581 to flash.display.MovieClip.but if I remove that line, it works. My problem is that I need to make it a "var" of type movieclip before I can assign a listener to it. Why can't I build an array of movieclip names using:
Code: Select allbuttonArray.push(["button"+letterArray[i]]);
I have seen arrays in the past that contain:
Code: Select allarray(mc1,mc2,cm3, etc...)
but notice that it's just using the name of the clip and not array("mc1","mc2","mc3", etc..)
View 6 Replies
May 1, 2011
I am writing a program where I have used multiple movieclips (boxes) that are put into a grid using a nested for loop.
Each movieclip is in an array and I want to give them names (box1, box2, e.t.c) but when I try to trace() them i get this in the output: "[object gridBox]".
[Code]...
View 4 Replies
Jul 31, 2009
I have this movieclip that i made in flash. How would I go about duplicating it and giving its parts instance names using AS3?
View 3 Replies
Apr 18, 2011
i made a custom class where i would like to create x instances of a movieclip. But the following doesn't work:
[Code]...
I keep getting the error: Scene 1, Layer 'Layer 1', Frame 1, Line 5 1119: Access of possibly undefined property Collector through a reference with static type CustomClass.
View 3 Replies
Jan 14, 2009
i'm having a problem with a for loop.i have this code:
ActionScript Code:
var pontos = new Array("boca_mc","esofago_mc","estomago_mc","delgado_mc","grosso_mc");
toAlpha();[code]....
when i call the function toAlpha, everything goes fine, but when it calls toSolid, the movieclip names (this[pontos[i]]) are undefined... i traced i, and i is ok.
View 3 Replies
Sep 12, 2009
The movie I'm creating will have many movie clips on each frame and each will have a mouseover tooltip.I have the code set so that I can mouseover a defined movie clip and I properly get the tooltip.[code]This works, where n1 is the instanced name of the movie clip.What I want is to be able to define a variable "whichNav" that will dynamically change to a movie clip instanced name when I mouse over that movie clip, then I can replace "n1" in the above code with "whichNav" and not have to remake the above code for every movie clip in the frame.For example, I could have movie clips instanced as n1, n2, n3, n4... ect. I want a variable that will track which movie clip I have my mouse over, and input that variable into the above code to create the tool tip for each movie clip.
View 3 Replies
Feb 16, 2011
Is it possible to create one or several instances of a movieclip from the library with variable names
my1_mc
my2 _mc
.........
my5_mc
so that I can make a function that will use the name of any of these movieclips.
View 4 Replies
Aug 26, 2010
We've got an Illustrator file with something over 1,000 layers. We're trying to import this into Flash and keep the layer names intact, such that they become the names of the movie clips that are imported for each layer and can be used programmatically. (It is a diagram and arrows, boxes, etc all have callout names that will eventually allow them to link to a database.)As near as I can tell, the Import dialog will NOT pass this info across between the two parts of the dialog.
View 1 Replies
Aug 16, 2011
I have a virtual on screen keyboard for a touch screen interface. I get the name of the key (Q, W, E, etc) by calling event.currentTarget.name Now each button is a movie clip with a small animation and I need to know which key is pressed so it can call the relevent movieclip..Below is the code:
[Code]....
View 1 Replies
Mar 10, 2012
I have an Arrays that contains the names of MovieClips:
Code:
var MyMCs:Array = ["A","B","C","D","E"];
The actual MovieClips names are "MC_A", "MC_B", etc..., I use this method so I reuse the same Array for multiple tasks, I simply add what ever it's needed to the name to match the task at hand. On this case I add "MC_".
Then I have multiple Arrays, with the same names of the values of MyMCs. The values of each these Arrays are the names of buttons that are inside the movieclips of MyMCs:
Code:
var A:Array = ["RR","TT"];
var B:Array = ["YY","UU"];
etc...
I could add a listener to a button this way:
Code:
MC_A.YY.addEventListener(MouseEvent.CLICK, DoSomething)
My problem is that i want it to be done dynamically, using the Arrays values in a loop to add Listeners to the all buttons. The loop system is not a problem for me... my real problem is in the dynamic attribution itself.
Here is what I have:
Code:
//'i' and 'j' have previously been created
for(i=0; i<MyMCs.length; i++){
for(j=0; j<this[MyMCs[i]].length; j++){
[Code]....
I know that this is correct since I tried them separately and I can trace the proper values.
I know that my problem is in the "this" since I get an error message stating:
1084: Syntax error: expecting identifier before this.
I suppose it should state something else... I tryed with "root", "parent", "child", "MovieClip"... with no luck...
View 2 Replies
Mar 20, 2011
I started a thread about a reference to a symbol House, in the output window, which was: House_1. A lot of people said some useful things about that. All day I've been thinking about it, and I came to the conclusion that I don't understand things, at a very basic level.
Consider:I make a movieclip which I give the Symbol name Drawer. (I don't export it for AcitonScript.)On the stage I manually place two instances of this Symbol. The first one I give the Instance Name drawer (in the properties panel). The second one I leave nameless.Now if I trace the names of both these clips, by
trace(this.getChildAt(0).name);
trace(this.getChildAt(1).name);
the output window gives me
drawer
instance2
Now I know that the so-called "instance name" which I gave in the Properties Panel (drawer) is, in reality, a variable name which Flash gives my first instance behind the scenes. And instance2 is a name that Flash gives my second instance. What exactly the nature of that name is, I do not know.My point is: both names (drawer and instance2) are the .name property of these movieclips. Otherwise I could not have traced them through asking for the .name property, in the above. Yet only the first of these two can be manipulated:
drawer.x can be set;
instance2.x can (as we know) not be set.
But...why? What is the real difference between these two kinds of names? How can they both be the .name property of their underlying movieclip, yet be of such a different nature? What IS the nature of the instance2 name? If it's a String, how come the .name property of one movieclip can be a variable name, while the .name property of another (but identical) movieclip is a String?
I've searched every bit of web page on the net I could find. But it looks as if nobody addresses this issue. We all just work with it - but it makes no bloody sense. A name property = a name property, you'd think. Whether Flash set it or I set it should not make a difference. The x property of a clip, for example, does not change in nature according to who set it - me or Flash.So, again, just to emphasize the problem: how can a property (the name property) of a movieclip change in NATURE depending on who set it? After it's been set, shouldn't the name property of a clip be of exactly the same nature as the name property of another clip?
View 8 Replies
Apr 13, 2009
I have a couple of questions that I hope someone can answer. I have this ActionScript that reads the XML file into the flash movie. The poblem is this: The XML is in this format:
<listitem name="TEST" url="rtmp://000.000.000.000/">
<stream len="-1" name="Test" start="0"/>
<group name="Testing"/>
</listitem>
[code]....
View 1 Replies
Feb 26, 2010
i get a syntax error when everything seems to be in the right place, out..home.swf
PHP Code:
stop();
var xmlLoader:URLLoader = new URLLoader();
[code]........
View 8 Replies
Oct 5, 2010
I want to get id from this [URL] get this id in as3 and use this id in xml and show the message in text field.
[Code]...
View 4 Replies
Sep 26, 2008
This is my first day to try and use XML to display dynamic text in Flash. My skillset is weak with AS3 and Flash, but I found some tutorials online and I have managed to successfully display the first record in mytest.swf. However I also seem to have all records displaying in each dynamic text box as well. My loop isn't stopping after each record. It's reading everything. And dumping the results into each text field.
I need to only display each record individually. Once I accomplish that, I will need to include some form of navigation. Lets say buttons that perform a NEXT, PREVIOUS, LAST, FIRST type function. Then lastly, I'll need to include some type of search navigation option by item number. I assume that I'd have to have a second screen that links to my primary results screen with an input form for the item number.
[Code]...
View 3 Replies