ActionScript 2.0 :: Retrieve Instance Name Of Dynamic Button?

Jan 20, 2006

I need to retieve the instance name of a button but cannot do it the same with a dynamic button the same as I can with a component button.For a built in component button the below code would output _level0.buttonName, however for a dynamic button i have created it only outputs _level0.

on (release) {
trace(this);
}

how to get the instance name of dynamic buttons?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Unable To Retrieve Instance Name?

Jul 13, 2009

I will try to state this simply.  If required I can post my code.  I have created a class that extends the MovieClip. It is basically a retangular shape, with a color and a label that can be set via the "properties" concept. The label.text property is public.
 
I create a "new"  object of this item (more or less a button) depending on reading an xml file.
 
If the file has 3 names (titles like "Lesson 1", Lesson 2" etc).  I create a new "button" for each name in the xml file.
 
so I can get 3 instances of the object on the stage.  Which I get.  I create each new object like this:
 
var link:linkBase;
var menu:linkBase;
 
I use a for loop to read the xml data, and create the instances:
 
for ....
 
menu = new linkBase();
// i try to give it an instance name like the
menu.name = xmlList[i].name // name = "Week1", "Week2", "Week3", etc
 
i push the menu object into an array like this: nav_button.push(menu), in the for loop.
 
I can draw the three objects on the stage. I have a stage listener that will trace the target name if I click on the instance. I get "null" if I click off the button. My problem is that I get the target name for only the second and third instances, and not the first. If I comment out the menu.name line, and click each instance on the stage, I get "instance9", instance12, instance15.  So I know there are three objects there.
 
I can do something like this to get a name on the first instance: nav_button[0].name = xmlList.week, or hard code a string like "Week1".
 
But I want to be able to do this in a loop of some sort.  I am trying to create a user friendly name for each instance, so I know what I am clicking on, and take action depending on the name "week1", "week2" etc.
 
what I am missing in terms of naming a instance on the stage?

View 3 Replies

ActionScript 3.0 :: Retrieve Instance Name Parent Challenge

Jan 16, 2010

An external application sends an instance name to flash over TCP/IP.I have code that parses out the communication and retreives the instance name (not it's absolute path).I then need to retreive the instance name's parent in actionscript. The instance name that gets sent is a child of specific movieClip, there are several movieclips on the stage. I need to know it's specific parent name..the code is placed on the main timeline.

View 3 Replies

ActionScript 1/2 :: Get Instance Name From Button To Display In Dynamic Text Box

Apr 30, 2009

I have a website i designed which contains buttons that navigate the user to different points on the timeline using frame labels. when they get to the appropriate frame label, they are presented with a movieclip containing two layers. The bottom layer is a map, and the upper layer is a collection of printer buttons that have a tooltip component on them that show you detailed printer info on mouse over and takes you to the printer remote ui on release. each button has a unique queue name for the appropriate printer as its instance name (ex. itm100_btn). Here's the jist... I want to be able to place a dynamic text box near the printer button and using action script have it display the printer queue name automatically simply based on the button its targeting, or even placing the dynamic txt box inside the printer button mc. See, on some pages, there are like 24 printers... I DREAD having to put all these names in manually as there are like 150 printers total

View 7 Replies

As3 :: Access Dynamic TextField In SimpleButton Instance (button Symbol) By It?

May 6, 2010

I created a button (button symbol), inside this button symbol there is a vector shape which will change colours in mouse over and a dynamic text field. i want to use this button symbol in more than one locations in my stage. so i need to change the label of these instances (by changing dynamic text ). but i can't access the dynamic text in as3 using following code,

btnsample.txtbtnlabel.text = "button label"

this code is working fine for a movie clip symbol but not for a button symbol.

View 4 Replies

Flash :: Change Texts In The Dynamic TextFields In SimpleButton Instance (button Symbol)?

May 6, 2010

this may be a basic thing, but i couldn't find an answer by serching internet. I have created a simple button - Istance name = "btnsample"and there are two layers layer 0- button design with rollovers - layer 1- dynamic text field - instance name = "txtbtnlabel"btnsample.txtbtnlabel.text = "new button label;but it's giving followin error :-119:Access of possible undefined propety txtbtnlabel through a reference with static type flash.display:simpleButton.

View 2 Replies

Flash :: Play Movie Clip Instance Inside Of Button Instance?

Apr 16, 2011

I placed a movie clip instance inside a button, and I want this movie clip to play when the button is released. I'm using this code on the frame containing the button:

function playMovie(event:MouseEvent)
{
this.theButton.theMC.gotoAndPlay(3);

[code].....

View 2 Replies

ActionScript 2.0 :: Unable To Retrieve Dynamic Input Field Data

Jan 4, 2010

I'm trying to retrieve an input value from a dynamically created input text fields ("qtyWant_txt"). I want to play that value back into an array ("QtyWant"), which is tied to a form. When the form is submitted, it'll grab the value in the array. My problem is that I'm unable to retrieve the value in the input field prior to passing it to the array.

[Code]...

View 1 Replies

ActionScript 3.0 :: Dynamic Hit Testing Against Dynamic Instance Names?

Jun 22, 2010

Ok, Background. I have two objects both of which im spawining in though code. We will call them bullets and wolves. They have their own .AS files which tells them everything they need to know about themselves. I figured i would do most of the hit testing on the bullet.AS file, hit testing against the wolves as there were going to be a set number of wolves but not a set number of bullets.o, I named them by running a loop and putting the linenewWolf.name = i.toString();Yes, new wolf is a declared variable, and i is the name of the variable that makes the loop run. I also have a test in it, and it works fine.

However, The hit testing is where i come into an issue. Remember, its on a seperate .AS file. The wolf maker and namer is on the main flash page.The hit testing function isif(this.hitTestObject(a)){i changed up my variable name to run a second loop. first variable name is "i" and the second variable name is "a"And for some reason i get a type error 1034, which from what i understand is an error that you get when two instance names are the same. Also, If possible, i would like to add letters to the name of the object, but im not sure if flash will let me as i belive the code would look something like this

View 1 Replies

Flash :: Can't Retrieve An Equivalent To Selected Button On Spark

Feb 27, 2012

I can't retrieve an equivalent to selected button on spark .

A bit of code:

_selectedBtn.selected=false;

View 2 Replies

ActionScript 2.0 :: Objects - XML - Creating A New Instance Of An Object That Uses An Identical Name To An Older Instance Delete The Previous Instance?

Mar 20, 2009

Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?

View 1 Replies

ActionScript 3.0 :: Dynamic Instance Name?

Mar 23, 2011

i have an array. a random choice is made from that array.

ActionScript Code:
var myArray = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9);
var randomSelection = Math.floor((Math.random() * myArray.length));

[code]....

View 9 Replies

ActionScript 3.0 :: Creating Dynamic Instance Name?

Jan 13, 2010

I have the following code:
 
var page1:Branch = new Branch();
page1.y = 124;
addChild(page1);
 
I want to have the value "page1" to be dynamic, along with "Branch".  Since there's a number of templates (up to 20), Branch is one of the templates.  So it would be nice to use one instance creator.  Also, I'm not sure how to get "page1" to be a dynamic value.
 
The closest to this that I've been able to find is:
 
star1sp.addChild(this["star"+star1Num]);
 
except that it doesn't fully address what I want to do.  I tried adding in a bunch of "this[load_page]" and "this["page"+curpage]" to my code but had no success.  I'm still on the prowl for the answer but wanted to put this out there.  It's something I've tried to figure out for some time.

View 11 Replies

ActionScript 3.0 :: Dynamic Instance Name From MovieClip?

Feb 16, 2009

I have problem. I work in Actionscript 3.0. I have add Movie Clip to stage by this code:

for (i=1;i<=33;i++){
var mcPipeShell = new pipeshell();
this.addChild(mcPipeShell);
}

my purpos is , after I add 33 instance of movieclip from custom class pipeshell. I want to access to each of them later such as control play head of each movie clip, and access variable entirer movie clips.

View 7 Replies

ActionScript 3.0 :: Dynamic Class Instance By Name?

Oct 14, 2009

i have a simple ClassB which just draws a rect:[code]And in my other ClassA i am trying to instantiate ClassB by its name - string "ClassB" with following code but that doesn't work:[code]I keep getting following error so i must be missing something?[code]

View 6 Replies

ActionScript 2.0 :: Tweener With Dynamic Instance Name

Jul 28, 2010

I've just come across a problem when using the caurina Tweener for AS2. It works fine with an absolute instance name, for an object on the stage; however as soon as I try to use a dynamic instance name - it stops recognizing simple properties like _x and _y, returning this Output message:

## [Tweener] Error: The property '_height' doesn't seem to be a normal object property of menu1 or a registered special property.
## [Tweener] Error: The property '_width' doesn't seem to be a normal object property of menu1 or a registered special property.
## [Tweener] Error: The property '_y' doesn't seem to be a normal object property of menu1 or a registered special property.
## [Tweener] Error: The property '_x' doesn't seem to be a normal object property of menu1 or a registered special property.

Here is a code snippet:
ActionScript Code:
_root.currentitem = 1;
_root.xpos = 0;
_root.ypos = 0;
Tweener.addTween(["menu"+_root.currentitem], {_x:_root.xpos, _y:_root.ypos, _width:85.0, _height:85.0, time:_root.clicktime, transition:_root.clicktype});
All other tweens work fine. There are objects on the stage with instance names of "menu1", "menu2" etc.

View 1 Replies

ActionScript 3.0 :: Dynamic Instance From Variables?

Mar 9, 2010

Im looking to have something along these lines, different variables that build the path to the object so that I can have it change dynamically.I'd like to have something like:

function foo(e:MouseEvent):void {
var1.var2.var3+_button.gotoAndPlay(2);
}

[code].....

View 1 Replies

ActionScript 3.0 :: Dynamic Array Instance Names

May 28, 2009

This should be simple but I can't come up with or find the answer anywhere. All I want to do is create a series of Arrays with instance names generated on the fly. I then want to reference these later. I have a "for" loop with a variable "count" that I want to add to a base name of rowArray and use the result to create an Array. I would think that it would look something like this:

[Code]...

View 2 Replies

ActionScript 2.0 :: Flash8 : Dynamic Instance Naming Of MC's?

Jun 5, 2009

I have 4 Mc's on the stage, and they have instance names 'mc1' - 'mc2' etc.The MC's have links in them (they are kind'a navigation items) and i need to change the functions of the 'rollOver, and mouseDown events', but keep the MC's the same.The MC's are referenced by instance name and given functions in the first few frames of he movie. for example

---------------
mc_1_0.onRollOver = function() {
if (_root.mc_1_0._currentFrame == 1) {

[code]...

Now, what i want achieve is to change the instance names of the MC's (mc_1_0 for example) so that when the user interacts with this MC on the stage, they are taken to locations of my choice (and the actions of another MC), by switching the instance names. IE, i want to change the instance name of 'mc_1_0' to 'mc_2_0' at runtime, BUT i want to do it with a variable from a .txt file.i would need to start with a script that looks for the MC with a certain instance name

-- look for instance mc_1_0, and then change the instance name to 'mc_2_0'

The effect would be that the user would instigate the same actions, regardless of which of the two MC's they rolled over.Maybe i could call the instances initially 'MC_1_Temp' and 'MC_2_Temp' etc: and then i would need a script to change them to 'mc_1_0' and 'mc_2_0' at runtime.SO in the text file i would need something like this

--------------------------
&MC_1_Temp_name=mc_1_0&
--------------------------

this way the behaviour of the MC on the stage wil take on the functions of another MC.should i be looking at something like this placed on the MC.....

onClipEvent(load){
//make this instance called - var = MC_1_Temp_name
}

View 3 Replies

AS3 :: CS3 - Change Dynamic Text In Correspondence To Instance Name

Jul 14, 2009

I'm making an activity where you drag and drop text (in mc's) into a specific column. There are two columns, the left is for workplace responsibility the right side is for personal responsibility. I've made the actionscript so that I can drop multiple targets into any of the correct spaces they're supposed to go to and I want the text to appear in that particular spot.

At the moment I have dynamic text, and when the text/mc is dropped into the box I have the code (textOne.text=event.target.name) - and so the instance name shows, but since you cant have whitespace in the instance names its not formatted the way I want it.

I tried using:

Code:
if(event.target.name==teamPlayer_mc){
textOne.text = "Team Player";}

But that doesn't work..

View 1 Replies

ActionScript 2.0 :: Dynamic MoveClip Instance Can't Reference?

Nov 15, 2009

I have a script on frame 1 that onRelease of button should tell dynamic MovieClip instances which have been added by attachMovie on frame 2 and 3 to go to a particular frame , here's the code:Frame 1:numdests is set to 2pagesAmount is set to 4

btn_submit.onPress = function(){
for (var i = 0; i<numdests; i++){
for (d = 1; d < pagesAmount + 1; d++){

[code].....

View 9 Replies

ActionScript 3.0 :: Dynamic Instance For A MOVIE CLIP

Nov 7, 2008

I am creating dynamic Movie Clip using as3, but I don't have any idea about dynamic Instance name, how I can assign Instance name for a movie clip.

View 1 Replies

ActionScript 3.0 :: Put A Dynamic Text With YourGuessText Instance Name?

Apr 12, 2010

In flash IDE i put a dynamic text with yourGuessText instance name. I need something like: if user not enter something to this field trace("need enter something");

[Code]...

View 10 Replies

Actionscript 3 :: Dynamic Instance Variable Name / Concatenation?

Feb 18, 2011

I have an array of project type codes like this:

project_types_array[0] = "p"

project_types_array[1] = "exp"

and a corresponding set of movie clips, exported for actionscript, with names:

type_p
type_exp

I want to somehow dynamically attach a movieclip on the stage according to the project type that exists in the array. I could just do something like this:

[code]...

View 1 Replies

ActionScript 3.0 :: Call Movieclip From Dynamic Instance?

Sep 16, 2009

How would you add a listener to an object inside of a movieclip that is in the library and as not been placed on the stage yet? Or, could you tell it to listen for when it does go on stage if it does come on the stage and when it comes on the stage to add an eventlistener to a movieclip inside of that?

View 3 Replies

ActionScript 3.0 :: Tween Class - Dynamic Instance Name?

Oct 12, 2009

I have been search for a few days for literature on dynamic instance name in referring to movieClips already on the stage. Each movieClip was set and displayed using the addChild(); and have a set instance name for reference ex. my_mc_x (x = number 1 - 10) I wanted to access these clips whit a tween

var image_assoc:String = ("my_mc_" + num);
trace("Instance Name: " + image_assoc);

I have tried the following

fadeTween = new Tween(this[image_assoc],"alpha",None.easeNone,0,1,1,true);
fadeTween = new Tween(this[image_assoc].name,"alpha",None.easeNone,0,1,1,true);
fadeTween = new Tween(getChildByName(image_assoc),"alpha",None.eas eNone,0,1,1,true);

dynamic reference to objects on the stage from a string that creates the object name to effect the instance of that object.

View 6 Replies

ActionScript 2.0 :: Dynamic MoveClip Instance Can't Reference

Nov 15, 2009

I have a script on frame 1 that onRelease of button should tell dynamic MovieClip instances which have been added by attachMovie on frame 2 and 3 to go to a particular frame , here's the code:

Frame 1:
numdests is set to 2
pagesAmount is set to 4

[Code].....

Currently the movies that are added using AttachMovie don't move when button on frame 1 is pressed.

View 0 Replies

ActionScript 3.0 :: Adding A Dynamic Number To A Instance Name?

Jan 11, 2010

My name is Bryan i am 17 years old and i'm from the Netherlands. As i am trying to become a web design and developer i decided flash was a MUST to know, so i started trying flash and messing about. Now i'm trying to get into Action script 3.0 deeper. Currently i am trying to fix an externaly (XML) loaded image gallery for my self, except i'm a little stuck right now.Up to now all my code has worked. I've got 3 UILoaders set up for 2 jobs: Loading thumbnails (2 of them) and the other is for loading a 'full' version. I got that working. Except if i get huge images like a wallpaper etc. it screws up the size, so i set scaleContent to true.

- Set all the images dynamicly, with that i mean it loops trough all the thumbnails and gets the first 2, it dumps them into the UILoader wich is already the part i am failing at XD

- Check for the width and the height of the image (wich i either will include in the XML document or can i use something like: XMLData.image[ *number here* ].img_thumb.width (as a example)?

- Check if these are less than the UILoader's size and if they are less dissable scale content, if they are more enable it

So as i said im already failing at trying to dump the images in the thumbnails.I've got the following setup:

Root document has a MC: mc_content.
Inside mc_content we have: loader_image (full size of the image loader)
loader_thumb1 and loader_thumb2.

So what i want:

- Load the XML (works)
- Set some limits using variables (works)
- Start a for loop (works)
- get the thumbnail for the current image number (wich is a variable set and maintained in the for loop) (works)
- load the image into the loader_thumb *insert current image number here* (fails)

here is my current XML function:

ActionScript Code:
// Function that is called upon loaded complete
function xmlLoaded(event:Event):void{
// get the XML Data from the file

[code]....

View 2 Replies

ActionScript 2.0 :: Dynamic Text And Instance Names?

Jan 7, 2011

I have a series of instances with a dynamic textbox in them....The instances are simply named p1, p2, p3 etc...

I want the dynamic textbox to show the instance name if possible..

View 3 Replies

ActionScript 2.0 :: Dynamic Text Box In It With The Instance Name Of 'news_txt'?

Aug 4, 2005

I have created a movie clip that has a dynamic text box in it with the instance name of 'news_txt' I have set the Movie Clip linkage identifer to 'newsItem'. What I am looking for is to have this movie clip be replicated depending on how many news items are in my xml doc.

[code]...

View 12 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved