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








Please Explain This Script In Small Piece Of Cake (_focusrest AND _name) Thanx


Please explain this script in small piece of cake (_focusrest AND _name) thanx a lot.




FlashKit > Flash Help > Flash ActionScript
Posted on: 09-06-2001, 10:02 AM


View Complete Forum Thread with Replies

Sponsored Links:

Piece Of Cake
I have a movie in the "over" and in the "down" frames of a button (two different movies). When you click the button it plays the "down" movie like it should but then it plays the "over" movie again on release. How do I remedy this.

View Replies !    View Related
Another Piece Of Cake, But Not For Me
need html code to control the size and menu items of the browser window (I`m talking about the first browser window that pops up when you log on the website, not the url opened within the flash movie)...
please help me, all the scripts I found didn`t work

[Edited by kubko on 09-21-2001 at 10:58 PM]

View Replies !    View Related
Piece Of Cake, Right? RIGHT?
This would be one of those questions that is very easy and quick anwserd by you expert guys....

How does the load movie script works...
I want to have a movie loaded into the main movie but I want to give it an exact size and let it play....
Do you understand??

Another question is....
I have got a button when you scroll over a movie clip plays and when you press it the other movie clip (from first question) has tpo play but then the button movie clip won't play...

I KNOW I KNOW i don't work with actionscript but can anybode explain to me how I fix these problems with zction script..
If you don't understand me please say and i will clear myself up a bit (I'm not a star in English because I live in The Netherlands)

I'm waiting for a reply... thank you...

Aram

View Replies !    View Related
C'mon This Should Be A Piece Of Cake For U
I'm reposting this questions, because I think the sollution most be easy. So I'll try again.

I've got some AS that shows text from a .TXT file in a Dynamic Text field, with scrollbar etc.... The FLash movie is on an HTML page.

Is there a way the manipulatie the ActionScript variable (loadVarDoc) that tells the rest of my Actionscript which .TXT file to get? For instance with JavaScript? (I want to incude de same movie an each HTML page, but show differte text on eacht page)

My Code:
loadVarDoc = "assets/swf/past.txt";
loadVarsText = new loadVars();
loadVarsText.load(loadVarDoc);
loadVarsText.onLoad = function(success) {
if (success) {
to the
scroller.text = this.var1;
} else {
scroller.text = "Data Not Found...";
}
};

View Replies !    View Related
Send Variables To ASP? Piece Of Cake, Eh?
Hi all,

I know how to pass variables from input fields in Flash to an ASP page, but what if the variables come from Actionscript? For example, I'd like...


var1="Greetings all of you fine people!";
var1=var1+"<br><br>Have a great day, and make sure you send prayer for peace.";


... to pass to an ASP page by clicking a button and display properly, like...


"Greetings all of you fine people!

Have a great day, and make sure you send prayer for peace."


All I'd need to do in ASP is add <%=request("var1")=>, but how do I send this from Flash?

View Replies !    View Related
Please Explain What This Piece Of Script Mean
Hey all,

I came across the following piece of actioscript. I have no idea what it's doing.
//================================================== ============

BLB.onRollOut = (BRB.onRollOut = (TRB.onRollOut = (TLB.onRollOut = function () {
DRG = false;
})));
//================================================== ============

BLB,BRB, TRB, and TLB are all movieclip.

I know that BLB.onRollOut = function(){[code]} means treating BLB like a button object that does what's specified in the [code] on roll out.

What I don't understand is the nesting that's going on here. Does it mean applying the same action to all 4 mc or have all of them activated at the same time?


Thanks!

View Replies !    View Related
Can You Explain This Simple Piece Of Code
I understand all expect on line
All comments are mine so you can check this too


onClipEvent(data){
//for every element in array _root.new
for(value in _root.dummy){
//if value is diffrent than start
if(value ne "start"){
//add element "value" to array myArray
_root.myName.push(value)
// I AM LOST
_root.myValue.push(eval(value))
}
//if value is equal start
if(value eq "start"){
//give _root.start value of element start
_root.start = eval(value);
}
}
_root.total = _root.myName.length;
}

View Replies !    View Related
Small Piece Of Code Help Please
Hi, I have to following snippet:

_root.MyMovie0._y -= 10;
_root.MyMovie1._y -= 10;
_root.MyMovie2._y -= 10;
_root.MyMovie3._y -= 10;
_root.MyMovie._y -= 10;

I want to replace the "MyMovie"-values with an array. I did the following but it doesnt work.

for (i=0; i<Descriptions_length; i++) {
_root.this["MyMovie" + i]._y -= 10;
)
Anyone an idea?

cheers
Patrick

View Replies !    View Related
Translate Small Piece Of Code From C++
this is a piece of c++ code:

PHP Code:




// Apply Lenard-Jones potential force to Craft2
void DoAttractCraft2(void)
{
Vector r = Craft2.vPosition - Craft1.vPosition;
Vector u = r;
u.Normalize();
double U, A, B, n, m, d;
A = 2000;
B = 4000;
n = 2;
m = 3;
d = r.Magnitude()/Craft2.fLength;
U = -A/pow(d, n) + B/pow(d, m);
Craft2.Fa = VRotate2D( -Craft2.fOrientation, U * u);
Craft2.Pa.x = 0;
Craft2.Pa.y = Craft2.fLength / 2;
Target = Craft1.vPosition;
}







how do you translate it into as3?

View Replies !    View Related
Need A Small Piece Of Actionscript - Dynamic Text
I'm not new to Flash MX, I've been using it for years, but I've only ever made animations because I've just never been any good at scripting games. However, I recently came up with a pretty decent game idea that only requires two small pieces of actionscript (one of which I already have).
The bit I already have (as you probably know from reading it) is to edit the value in a dynamic text box:

Code:
name.text = number(name.text)+number("1")
This I have tested and know works fine (the '+' can also be replaced with '-' or '=', easy)
But I need another bit. I need some actionscript that will work as a trigger (like "on(press){") and I want the trigger to be (in human speak) "instantly, once name.text has a value of (more than/less than/equal to) X".
All I got so far is
Code:
if(anything.text == "1"){
That does work ok but it requires an extra trigger above it and I don't want another trigger, it all has to happen instantly.
I know I don't make much sense some times, I'm just not very good at putting words together for things like these.
Either way, whether you understand or not, your help would be appreciated.

View Replies !    View Related
Explain A Small Amount Of Script...
Hi-
i was doing a tutorial to help me understand the duplicateMovieClip() method, and i need some help with a portion.. I got this script to work:
code:
_root.box.onEnterFrame = function() {
n = 1;
while(n<300) {
_root.box.duplicateMovieClip("box"+n,n);
_root["box"+n]._x = random(550);
_root["box"+n]._y = random(150);
_root["box"+n]._alpha = random(100);
_root["box"+n]._yscale = random(150);
_root["box"+n]._xscale = random(150);
n++
}
}


the part i dont understand is where i'm setting the properties of the newly duplicated clips. for example,
code:
_root["box"+n]._x = random(550);


can someone explain the part inside the brackets? It looks like an array of some sort, but i just wanna make sure i understand this before i move on..

thanks,
-myk

View Replies !    View Related
Can Some1 Please Explain _blank,_self,_parent,_top In Small Words?
I am a somewhat intelligent man. I know how to fill out an application at McDonald's I can write my name etc.etc. , but when it comes to those _blank,_self,_parent,_top they are like Criptonite for Superman.

I understand blank opens a new page.How about the rest. Can you help me please.
ThanX a bunch. Lots of great karma coming your way.
T.

PS but explain like you're explaining to your grandmother.

View Replies !    View Related
Flash CS3, Downloading A Library Piece By Piece
When I make a new clip in a library ,or a new sound, I have an option to export it in a first frame. If I turn off that option, how can I export it later using actionscript? The problem is that a huge sound file, for example, would normally download itself before preloader has a chance to show up. So this is not a question of how can I download another file, but how can I choose which part of a swf to download first?

I hope that I don't sound too confusing.

View Replies !    View Related
Large FLA - Need To Preload Piece By Piece... Help?
I'm taking over a project that another person was doing and they laid it out in on large timeline timeline.jpg (195.79 KiB) Viewed 281 times

View Replies !    View Related
Can Anyone Help? There May Be Cake.
I have this deceleration script plugged in to two mc's. on the mc being controlled (in this case moved) I have:

onClipEvent (load) {
_x=-94.6;
finalX=137.5;
_y=148.8;
finalY=148.8;
}
onClipEvent(enterFrame){
_x += (finalX - _x)/5;
_y += (finalY - _y)/5;
}


Then on my mc that acts as a button to control the above mc, I have:


on (release) {
_root.mc_b.finalX = 137.5;
_root.mc_b.finalY = 148.8;


The problem is that the mc moves when the movie is loaded, rather than on the release of my mc w/ button. I just want one mc to tell another (on release) to move (look animated) to a desired x, y coordinate.

I must be placing something wrong in the above script. Can anyone help????

Thank you, Thank you

View Replies !    View Related
Cake Mixing Game Help
Heh, Im such a n00b when it comes to writing my own code xD I want to make a cake mixing game. You drag and drop up to 3 ingredients into a pot and if you get the right combinations then it goes to a frame with a cake on it. I could probably write the code myself if someone could steer me in the right direction
Oh, and I have flash MX ;-; I should be getting CS3 soon though

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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);
}
}

View Replies !    View Related
_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

View Replies !    View Related
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

View Replies !    View Related
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.

View Replies !    View Related
._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??

View Replies !    View Related
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.

View Replies !    View Related
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!

View Replies !    View Related
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

View Replies !    View Related
_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 !!

View Replies !    View Related
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

View Replies !    View Related
[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.

View Replies !    View Related
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);
}

View Replies !    View Related
_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!

View Replies !    View Related
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"

View Replies !    View Related
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

View Replies !    View Related
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??

View Replies !    View Related
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.

View Replies !    View Related
[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

View Replies !    View Related
._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?

View Replies !    View Related
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.

View Replies !    View Related
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?

View Replies !    View Related
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.

View Replies !    View Related
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.

View Replies !    View Related
_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.

View Replies !    View Related
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?

View Replies !    View Related
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?

View Replies !    View Related
[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

View Replies !    View Related
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]

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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.

View Replies !    View Related
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.

View Replies !    View Related
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.

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved