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




Mc._name Property Is Readonly ?



In fact: I duplicate an mc in rows and columns, and want to change their location (_x,_y),
my problem is: I want to change also their name

mc1_mc move to mc2_mc._x and viceversa
firstName = mc1_mc._name;
secondName = mc2_mc._name;
// renameing
mc1_mc._name = secondName;
mc2_mc._name = firstName;
// but this part is not working

In flash 6 exist the setName function, or is a readonly property?



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-06-2004, 01:25 PM


View Complete Forum Thread with Replies

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

Mc._name Property Is Readonly ?
In fact: I duplicate an mc in rows and columns, and want to change their location (_x,_y),
my problem is: I want to change also their name

mc1_mc move to mc2_mc._x and viceversa
firstName = mc1_mc._name;
secondName = mc2_mc._name;
// renameing
mc1_mc._name = secondName;
mc2_mc._name = firstName;
// but this part is not working

In flash 6 exist the setName function, or is a readonly property?

Readonly Property Of TextInput?
Hi. I've got a small question.
Is there a readonly property of a TextInput?
(not just .enabled)
And how do you do it then?

Thnx a lot.

Grtz, SoulaX

Anyway To Set The _name Property Of A MC?
Wondering if it's possible to set the _name property of a MC that is an instance of a component, based on one of the component parameters.

_name Property
Hallo !!
I have a movie clip named _root.star which has this script:
if(this._name == star){
....(make Action1)..
}
When i click on button1 its script says that:
on(press){
_root.star._name = "Charlie" or _root.Chalie i don't know

so the clip "star" stops making Action1 ...isn't it?

Now if i click on button2 i want that the former clip "star" ,
which now it's called Charlie as I clicked on button 1, gets the name
"star" again so it could execute the Action1;
if I say:

_root.Charlie._name = _root.star

it doesn't work !!!!

please help me !!

_name Property For This Keyword
When you are using the keyword this inside of an event handler it refers to the object that triggered the event.

For example if OnLoadInit of a sound object is triggered you can say

this.play();

Is there any way of returning the instance name of this the way you can get the name of a movie clip

ie somemovieclip_mc._name

It is probably not that simple. If there is a solution it probably needs several lines of code.
However, it would be worth while for a lot of debugging purposes.
Any help would be greatly appreciated.

New MX Button._name Property Problem
I've spent hours and hours trying to solve this. I can usually find answers to my questions by searching the existing posts, but this time I can't find any reference to this.

I have a button called Gbutton. It has an instance name of Abandonment. I also have an xml file from which I want to get an expression and load it into a dynamic text field.

This is the line of code that I have been trying to use to get the correct expression from the xml file:
if(terms[i].id == Gbutton._name)

Gbutton._name is supposed to return the instance name of Gbutton, but it doesn't.

If I manually insert the instance name like this:
if(terms[i].id == Abandonment)
The entire thing then works perfectly.

I would really appreciate any help. I have several of these buttons, and I'd hate to have to hard code the instance names into each related actionscript.

Thanks a bunch,
Debbie

Stupid Button Not Tracing Property _name, WHY
hi

its rather simple
i have a button with this code

on (release)
nombre=this._name;
trace(nombre);

i want to show the button instance name in the output box
Its that simple
but it doesn't work
WHY?!!!

Need A Quick Answer... _name Property... Can It Be Changed At Runtime?
Seems like it should be, but I can't get it to work.

anyone have an idea?

myMovieClip._name = "newname";

does not seem to work.

_name Property Changing But Not Changing
I am working on an application where a user can select a movieclip that has been dynamically placed on the stage and then choose Send to Front or Send to Back (compared to the other objects on the stage with it).

As part of this process I am renaming the instances using code that basically looks like this: setProperty(myMovieClip, _name, newMovieClipName);

Using the debugger I noticed something unusual. In the properties tab the _name property changes to the newMovieClipName value I am assigning it. But the target it shows remains unchanged (_level0.container_mc.myOldMovieClipName).

I think this is causing problems elsewhere when I try to target these movie clips. Does anyone know how to completely change an instance's name, or is this just the way it works? Any insights are appreciated.

Using Sendandload To Populate A Readonly Textfield?
What i am after is the following:
1 user fills in a form
2 one of the fields represents xCoord and yCoord
3 both fields are readonly and can be filled in by pressing a link which pops-up the flash file.
4 Click on the flash map, will send a xCoordinate and y coordinate to the form
5 user sees the values of the coordinates in the readonly textfield
6 if the user is satisfied he submits the form.


The as code and php file works correct when i save the coord vars directly in a mysql db. But i want to show them first in the form textfields???

Using php and i tried

Code:
<tr>
<td>X</td>
<td><input name="xCoord" type="text" id="xCoord" readonly value="<?php echo $_REQUEST['xCoord']; ?>" size="5" /></td>
</tr>
Any advice??

Should I Use _name?
I have 4 MC's in 4 layers in frame 1. I have 4 buttons that activates them (tell target and so on...) Until here works fine.
Now, what I want is that once a movieclip is started, it has in its own timeline a stop action. It should remain there until another button in pressed to start another MC and tell this movie wich is already on stage to continue to its end.
When the new MC starts that one which was first on stage should go on for a frame labelled "final" to end and come back again to its first frame waiting for to be activated again. The problem is that I assigned each MC to its own button, and that is fixed, but I don't know which MC is going to be previously on stage, depending on what the user choose before, I cannot know that in advance.
I thought that if I change in every MC its instance name to something like "onstage" while is stopped and then change it again to its original name to be recognized by its button could work, as a way to name the movie that is in stage, no matter which of the four MC's is.
If this is a good idea, I don't know the correct sintaxis. And would be very thankful to any suggestion.
I will also place my .fla in this address:
http://www.xs4all.nl/~sram/bolassimple.fla
maybe is easy to visualize what I am trying to do...
I am quite begginer with Action Script so maybe you'll find some funny nonsense.

Regards and thanks, GLO

This._name As Var
Hi


I'm looking for a way to have the instance name of movieclip be used as a variable.

The mc in my case, is a checkbox, and I'd like to avoid making multiple unique checkboxes/mc's.

Currently I'm doing (inside the mc):

_level0.nameOfMyMovieClip = true;

but I rather prefer something like:

_level0.this._name = true;

I've looked around for this, and I came across examples like blah"&var&" but to be honest, I can't see the logic behind this. So I'm lost.

Thanks a lot for your help

This._name ?
I want a MC to execute a set of actions depending on his actual name, this is to check his name and to test the actionscript. but it doesn't work. can you please tell me whats wrong?

onClipEvent (enterFrame) {

// if the name is movie...

if (this._name == movie) {

// then play
movie.play();

// if not...

} else {
hello.gotoAndPlay(10);
}
}

_name
How do I do the following: I have a MC with a bunch of jpgs inside and I want to find out their names.

I've done it befor but can't remember how

Cheers

This._name ?
Hello, there!

first frame code:

_global.test_function = function() {
test_button_name = this._name;
trace(test_button_name);
};


first frame button code:

on (release) {
test_function();
}


I DON'T GET THE NAME OF THE BUTTON. WHY ?????

gea

The One Before This._name?
Hi guys.

If i have a button within a movieclip, and i use "this._name" i get the name of the button (which is right)

But how would i get the name of the movieclip that its in? like a path to the button that was pressed?

Cheers guys.

._name VS Name
Hi ,
I am developing an application on flashcom. When I try to edit some flashcom component, I found some strange in the script.
In the connect function of AVPresence, there is code like:

this.username = username;
var pmc = this.component;

// CONFUSE these 2 lines
pmc._name = this._name;
pmc.name = pmc._name;
// CONFUSE

pmc.prefix = "FCAVPresence." + pmc.name + ".";
this.component = pmc;
this.component.soName = this._parent._name + "presence";
this.component.connect(nc);

is it difference about .name and ._name???
what is the difference??

This._name Problem
Hi all!!

This may be a bit easy...but......

If the actionscript on a button says:

variable = this._name;

will the 'variable' have the value of the button's instance name??

thanks!

Weird This._name Bug
maybe it's because i had no coffee today but have a look and tell me what is wrong, cause i can't find it..

selected should be "a" when i click on the big grey mc containing a button and then when i go to the next frame and click on the square it should be "b" but no it's still a ...aagghhhh help me please

www.ziemon.nl/test.fla

This._name To Variable
Hi,

I working on a movie where I have frame labels: clip1, clip2, clip3 for the length of the movie in their respective frames.
Im using a menu handler function that goes to the name of the frame label on release using name._this like this:

_root.gotoAndStop(this._name);

this is the code that calls the function:

clip1.onRelease=myFunction;
clip2.onRelease=myFunction;

My question is how do I get this._name into a variable--that is remove the "clip" part and leave the number as a number?

Thanks,
Yvette

[F8] This._name Does Not Work?
Hi guys,


I'm trying to get the name of the button im pressing.


Before, if i did this:

on(release){
trace(this._name)
}

It would come up with the name of the button, i.e "button1", or if the button wasnt named, somthing like "instance394"

But for some reason, now, nothing comes up.

Can somone help.

Many thanks.

Button ._name?
trying to use button._name to grab the instance name of the button that was pressed, but it keeps returning the parent movieclip instance name? Any ideas as to what's going on?

Code:
on(press){

trace(this);

trace(this._name);
}

_currentframe._name?
I'm sure this has been answered before, but I'm having trouble finding the same topic exactly. Is it possible for actionscript to understand anything like this:

if(someMC._currentframe == "Some Frame Label String"){
do...
}

-OR in other words-

is there a way to ask for "_currentframe._name" ?

thanks!

Getting Mc _name On Collision
how do you get the _name of a MovieClip when two Movieclips collide without knowing the movieclips name before

example
if this.hitTest.Anything
get._name

neither of those commands are real so i was wondering how you would go along doing this "getting MC _name on collision"

Movie._name
Perhaps the answer is obvious, forgive me I'm a beginner.
I drew interactive maps, rolling over a region calls a function which displays the area name, changes its color...
Currently I'm using movieClip handler to call my function and know which movieclip is active.
I'm wondering it is possible to know which movieclip (movieClip name) have been clicked or rolled over without embeding code in each instance?

Maybe using a Mouse.addListener and movie._name

Thank you for your help

This._name Problem
hi
i want to know the command to know the instance name of an object.
I was told it was this._name , but it doesn´t work...any ideas??

Correct Use Of Mc._name?
Hi,

I get a huge object via a webservice. In this object all elements have a guid (unique id). Its a 16 char something long string (e9fba23f-126f-463c-bb74-1ec3cc95a5f6) and is a common way to set id on visual objects in .Net anyway. My question is now if I should use this guid to set the instance name for all my visuals that represent these .net objects (instead of "mc" + i in the attachMovie)? I hope you understand what I'm talking about even if it's not the best explanation I've written... Any pro and cons you can think of?

Thanks in advance.

[AS] Button._name
What I have are a bunch of buttons inside of a movie clip. When I select one of the buttons on the stage I can apply actions to when it is released. I have this button loading a seperate swf file and updating a dynamic text box. All of this works fine, but when I use 'this._name' to call the instance name of the button, it is calling the movie clip instance name in which the button resides instead.

Why is this and how can I access the button's instanced name?

Here is the actionscript on the button.


ActionScript Code:
on (release) {
    _root.Invsbl_MC_Smll.loadMovie(this._name+"/Solutions.swf");
    _root.Industry.text = "Industry - "+this._name;
}


And as of this point in time, I can not convert all the buttons into movie clips. Any suggestions?

Thanks,
Yeah_Dawg

._name Vs .variable?
Can someone tell me the difference between textField._name and textField.variable?

I know the definitions, _name is an instance name and variable is the variable associated with a textfield, but why both? What benefit does having both give you?

And why is it if I set a variable name on dynamic creation, my textfield ends up wiping its text to display the path to the textfield instead?

For Loop To Trace This._name
I have a series of buttons that all perform the same function.

Can I use a for loop instead of calling on each button rollOver?

i.e.

There are 4 buttons (btn1,btn2, btn3, btn4)
for (var n:Number = 1; i<= 4; n++) {

button= eval ("btn" +n);
button.onRollOver= function (){
trace(this._name);
}
};

Or do I have to do it long hand:

btn1.onRollOver= function(){
trace(this._name);
}
btn2.onRollOver= function(){
trace(this._name);
}

ect.

Movie Names _name Help
I have a problem I am sure is very simple to someone in the know how.

I have several swf files loaded into my movie and I want to dynamically create a button that will point to a URL based on a movie that is loaded .
For example in layer 2 the user has a choice of 3 movies; 'movieA' 'movieB' and 'movieC'. I need the button to work out the name of the movie loaded in level 2 and assign it to a URL string, so the button will produce something like this:

getURL("load.asp?movie=MOVIENAME", "_blank");

I have played around using movie._name with no luck.
Any ideas?

If(_name == Btn1_mc) Problem
Hi.

I want to have a single button c&p'd and change the name of the it in the properties (btn1_mc, btn2_mc, etc). I have an invisible button (mc with 0 alpha). I currently have the following frame code.

invisBtn.onRollOver=function(){
if (this._name == "btn1_mc") {
trace("You clicked on button 1");
}
else {
trace("You clicked on another button");
}
}

I plan on changing this in the future so I can have a multiple if/else thing where depending on the name of the object (btn1_mc, btn2_mc), it would play from a certain part on the timeline. But it doesn't seem to be picking up the right name. When I roll over any of the buttons (even the 1st button) it says, "You clicked on another button". I can't figure out why.

I've tried removing the "this", and tried using the code as on(rollOver) object code. I can't seem to get it working.


Any help would be SO appreciated.

Get The Class Parent _name?
Hi,
I'm making a custom class, and does anyone know a way to get the name of its parent?

Example:
var InterestingName:SomeClass = SomeClass();

How would i get the string "InterestingName" from within the class?
Thanks.

_name Of HitTest() Clips
I've been trying to find a way to find the _name property of a movie clip a certain other movie clip is collided against but can't.  Does anybody know?

[FMX] _name.substr Problem Help
Hi everybody I have a problem loading external movies.This is the situation. I have 6 buttons on the main stage: (btn_home, btn_about, ..........btn_contact) and I have an equal amount of external movies with the same names except of the prefix "btn_" Those movies should be loaded in a container on the stage (name container) I have the following function to control the buttons and to load the external movies:

ActionScript Code:
for (var i in this) {
 if (this[i]._name.substr(0, 4) == "btn_") {
  setButton(this[i]._name);
 }
}
function setButton(clip) {
 var clip = eval(clip);
 clip.onRelease = function() {
  if (_root.currMovie == undefined) {
   _root.currMovie = this._name;
 this._parent.container.loadMovie(this._name+".swf");
  } else if (_root.currMovie != this._name) {
   if (this._parent.container._currentframe>=this._parent.container.midframe) {
    _root.currMovie = this._name;
    this._parent.container.play();
   }
  }
 };
}

But when I press one of the buttons, let's say btn_home, the container wants to load the swf btn_home.swf while it should load home.swf without the prefix btn_. I was sure the code:

ActionScript Code:
_root.currMovie = this._name;

was the right one to get rid of the prefix btn_

I presume that it has someting to do with a substr., but I don't know where and how to implement it in my code.

Anybody who can help?

Thanks in advance

HitTest Can Identify The _name Of The Clip?
I´ve been using hitTest for awhile.

I need this for a game: when my clip hits another clip is there a way to know the _name of that clip instead of just getting a TRUE statment?
Im moving a clip on the stage with _x and _Y (im not using drag, so i cant use _droptarget) and i need to know the name of the clips they touch.

any idea? I hope ive been clear enough!

[swf width=150 height=50]http://200.26.70.70/testmartin/firma_foros_flash.swf[/swf]

Fetch _name (?) Of Loaded Swf From A Certain Level
Heya,

I'm looking for a bit of code on how to get the name of the loaded movie into a certain level. It's for a dubblecheck, to see if the correct movie is loaded into that level.

something like:

if(_level4._name == moveID) {
...
}

But that doesn't work. Anyone got a solution?
Gracias, Mediamonkey

Identifying MC Instance Or Parameter _name?
I have three radio buttons (movie clips), instance names: a01a, a01b, a01c, grouped as a movie clip instance named q01.

The clip parameter _name values of the three buttons are red, blue, yellow.

I need to identify either the instance or parameter _name property of one of the 3 button mc's.

I just haven't been able to work out the syntax structure.

e.g.

//-------THIS IS FROM MACROMEDIA TUTORIAL (IT WORKS)
onClipEvent (mouseDown) {
if(hitTest(_root._xmouse, _root._ymouse, false)) {
for (item in this) {
rButton = this[item];
if (rButton.getState()) {
trace ("You selected "+rButton.getLabel());

//-------THIS IS MY ATTEMPTED ADDITION (IT DOESN'T WORK)
if (getProperty(_root.q01.a01c,_name) == "yellow"){;
trace ("You selected " + _root.q01.a01c.getLabel());
score = Number(score)+20;
}
break;
}
}
}
}

Thank you.

Button._name Returns Object?
Hi. I am trying to utilize mybutton._name in my flash application.When I trace
code:
trace(myButton._name)


it returns
code:
_level0.myButtonName


What is with the _level0 i am not able to use my buttons name because of that.
I tried using array access around it such as myButton[_name] etc but I cannot seem to return the name.


Hope that makes sense jamesloacher.

Calling From An Array Using _name Variable
Hello,

I've run into a snag with actionscript and cannot figure out how to do what I'm trying to do, and I don't really know if it's the right way to do it. I'm using Flash 8 and actionscript 2.0. I've looked on this forum and all over online and cannot figure out how to do this, and I was hoping somebody could help me out. Here's the scenario:

I have two movie clips, we'll call them MCA and MCB. The first movie clip, MCA, is a blank movie clip that contains multiple arrays and duplicates MCB a specified amount of times. MCB contains a button and a dynamic text field which has the value of ButtonText assigned to it (under the var input box in the properties menu). Like I said, MCB is duplicated a bunch of times, and each time its name is set MCB+a number (e.g. MCB1, MCB2, MCB3 ...) each time it is duplicated. What I'm trying to get the dynamic text box to display the first value an array into the text box. The Array names in MCA correspond to the movie clip name of MCB.

Actionscript on MCA:


Code:
onClipEvent(load){
MCB1 = ["value1","value2","value3","value4"]
MCB2 = ["value1","value2","value3","value4"]
MCB3 = ["value1","value2","value3","value4"]
MCB4 = ["value1","value2","value3","value4"]
}


ActionScript on MCB:

Code:
ButtonText = _root.MCA._name[0];


So if the movie clip name is MCB3, I want it to get the first value of the MCB3 array. However, the value assigned to ButtonText is returned undefined, and I'm assuming because the _name variable actually returns a string value and cannot be processed into a target path. if I make the script of MCB the following:


Code:
ButtonText = _root.MCA.MCB3[0];


Then it works and the dynamic text field displays the first value of the MCB3 array. However, I can't put the actual array name because as the movie clip is duplicated, there needs to be an array that corresponds with that movie clip only.

So, after that explanation, is there a way to do it with a the _name variable? Or is there a different way that would work to create a path name that would call a variable of an array in a different movie clip?

Thanks for any help you can offer, if I wasn't clear enough feel free to ask me questions.

Target Group With Unknown _name?
I've got a script that create MCs on my stage.

they all have a similar instance name, excpet the end is different.
Now, when sometihng happens I want all these MCs to gotoAndStop a frame in their timeline.

How do I call this???

This is what I would get:

ActionScript Code:
_root.theMC_100_90.gotoAndStop("changed");
_root.theMC_101_92.gotoAndStop("changed");
_root.theMC_102_95.gotoAndStop("changed");

But "100" and "90" are always going to be different.

How do I call al of them at once?

Is there a way to say:
If the start is _root.theMC_... then add .gotoAndStop("changed")
Or a smarter way?

Button._name -- Doesnt Work
Hi,

I am using Flash MX 2004, Falsh Player 7 and AS version is 2.0
I want to get my buttons instance name when clicked on it, how do get that.

Script written on my button:

on(release) {
trace(this._name) //my alert window displays blank
};

Any idea y i am not getting it

-------------
aShIsH

Determining MovieClip._name From MouseClick
I want to get the name of a movieClip when it under a mouse click, but I don't want to attach any code to the movieClip. Can anyone suggest a way of doing this?

I am creating a simple colouring game, but I want it to be easy and quick to change the pictures that are being coloured, so I wanted to avoid adding any code to the movieClips that are being coloured.

I don't think hitTest will do the job and I am not sure that droptarget is much good either is there any other way of doing this?

[Flash 8] MovieClip._name Problem HELP Please =]
i'm stuck with something.
Is it possible in AS2.0 to code something that would be said like this in plain english :
"move the movieClip who's name matches the value of that string" ?
I'm trying to act on movie clip's depending on the value of a string.
I might be trying to change movie clip names at runtime ... I'm pretty lost here
any help is more than welcome

safe x

Button._name -- Doesnt Work
Hi,

I am using Flash MX 2004, Falsh Player 7 and AS version is 2.0
I want to get my buttons instance name when clicked on it, how do get that.

Script written on my button:

on(release) {
trace(this._name) //my alert window displays blank
};

Any idea y i am not getting it

-------------
aShIsH

Determining MovieClip._name From MouseClick
I want to get the name of a movieClip when it under a mouse click, but I don't want to attach any code to the movieClip. Can anyone suggest a way of doing this?

I am creating a simple colouring game, but I want it to be easy and quick to change the pictures that are being coloured, so I wanted to avoid adding any code to the movieClips that are being coloured.

I don't think hitTest will do the job and I am not sure that droptarget is much good either is there any other way of doing this?

Using This._name To Load Text File Variables
n00b question here

i've managed to get a dynamic text box to display the instance name of it's parent MC (infoa, infob, infoc...):

on (release) {
gotoAndPlay(2);
txt.words = this._name;
with (anim) {
play();
}
}

But how can I get the text box to display the variable of the same name which is in a .txt.

Where should i put my loadVariables and what should it say

what i need is 64 instances of cubeMC, but when you click on one it displays the text according to which instance you click. The text (which has var: words) is inside txtMC (instance name txt) which is in cubeMC.

any help appreciated

MovieClip _parent._name.onPress Problem?
I have one movieclip with many instances of it that i am using as buttons, they all have dif instance names obviously. This is done so i can go "link_01.textV.text = "blah", and textV is the instance name of a text field within the movieclip.

Now i want to make it more dynamic so i dont have to have

Code:
link_01.onPress = function() {
//blah
}
link_02.onPress = function() {
//blah
}
link_03.onPress = function() {
//blah
}
link_04.onPress = function() {
//blah
}
ect..

instead inside the single movieclip i can write

Code:
_parent._name.onPress = function() {
blah
}
Now, any idea why that will not work?

i dont know flash at all, im just diggin my way through this. So.. any idea?

StartDrag And _name Questions (easy Stuff)
Is there a difference between:
startDrag(this);andthis.startDrag();?

Also, I see references to using _name from time to time, but I haven't found anyplace that really explains what that is or how you use it. Anyone?

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