ActionScript 3.0 :: Getting The Correct Instance Name Of A Button?

Jan 27, 2011

I'm using a loop to generate and position a bunch of movieclips on my stage and another to add mouse eventlisteners to them, turning them into buttons.

All this works fine however when i attempt to trace the instance name of the button pressed, output is firing "instance40" or "instance41" etc.

how do i get the correct instance name? I'm attempting to get at the value of the textfield held within the movieclip i.e. trace(evt.target.value_txt.text); however this is resulting in errors.

Is there a standard procedure for generating buttons in a loop? I'm not understanding why my buttons aren't tracing the correct instance names or why i can't access the movieclips contents, specifically the value of the dynamic text field?

Code's below, if anyone wants to see the whole code, or FLA, give me a shout.

ActionScript Code:
var eggs:Array = [];
for(var i:uint = 0; i < 24; i++){

[Code].....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Getting Correct Instance Name With Arrays?

Apr 14, 2010

I'm new to Actionscript 3.0 and flash and I'm trying to make a simple drag and drop project that using externalinterfacecall will have javascript check or uncheck a value on a webpage when an image is dropped into a certain box. I'm trying to give myself a solid string to pass through to the javascript however when I do this one way, I get a stack overflow that is as follows :

Actionscript Code:[code]........

View 3 Replies

ActionScript 3.0 :: Create An Instance At The Correct Position?

Oct 22, 2010

basically, I am trying to create an instance at the correct position. I understand that I will have to utilize globalToLocal() and/or localToGlobal() to get relevant positions, but for some reason, I can't position the instance at the correct location. here is the codes:

parent class:

Code:
//create bullet
bulletList.push(new Bullet(100, 100));
addChild(bulletList[bulletList.length - 1]);
Bullet class:

Code:
x = localToGlobal(new Point(pX, pY)).x;
y = localToGlobal(new Point(pX, pY)).y;

pX and pY are the arguments for the Bullet Class. When I do this, it is shifted over 100, so the absolute position being x = 200, y = 200, and the local position being x = 100, y = 100.

View 4 Replies

ActionScript 3.0 :: Test To See If The Class Of An Instance Is The Correct One?

Apr 13, 2009

How can I test to see if the Class of an instance is the correct one? Say I have two Custom Classes, Circle and Square. How would I make it so that if the class of instance one is Circle, a specific function is carried out?

View 1 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 :: Movieclip Name Is Undefined "despite Having The Correct Linkage And Instance Name"

Feb 8, 2004

I'm trying to attach a movie clip to the main stage using:

[CODE]...

However, it ain't showing up. Trace said the movieclip of that name is undefined, despite having the correct linkage and instance name. Anyone know why a movieclip might be MIA?

View 4 Replies

ActionScript 3.0 :: Get The Depths Of All The Blocks To Be At The Correct Levels At The Correct Times

Dec 30, 2009

I'm trying to get the depths of all the blocks to be at the correct levels at the correct times so that the 3d effect is maintained. I've tried many things, but have had little success. All the instances of the blocks are stored in an array, but since it's adding them in accordance with when they're added to the stage, it doesn't help me locate them to swap depths. Is there a way to arrange them by location on the board?

View 4 Replies

ActionScript 3.0 :: Change Mc Properties From Mc To Button Correct?

May 14, 2010

I have 4 mc's that are acting as btns inside an mc on the main timeline...[code]there are 3 other mc/btns and all come up at different frames in  mainbranch_mc (mainbranch_mc is on the main timeline)
 
first question, if I add the above codes to each mc at the beginning or end of mainbranch_mc I get a null error, so the only way I do not is if I add actions to the frames the buttons start in. (is this correct?)

second question, since btn mode is true I do not need to change the mc properties from mc to button correct?

last question, since newolivefour_mc and the 3 other btns (which I did not list are all inside the branch_mc timeline) how and where do I code so the btns when released to getURL's.

View 3 Replies

ActionScript 2.0 :: Target Is Correct, But Button No Works?

Apr 13, 2005

this.menu_buttons_mc.menu_01_mc.menu_01_btn.onRele ase = function ()
{
trace ("this.menu_buttons_mc.menu_01_mc.menu_01_btn.onRe lease CALLED");

[code].....

View 3 Replies

ActionScript 3.0 :: Get Link Command To Correct Button?

Jan 20, 2010

I have a total of 11 buttons each named b1, b2, b3 etc. I used to have it so when the a button is clicked, the button was recognized as to which one it was through an array and string and switch statement (I will show you below). But now I have to introduce something in the middle and so I am not sure how to make it work any more.

Code:
public function addButtonEffects():void {
//the buttons used to lead to onButtonClick as you can see here
//but now I need them to lead to closeShutters and from there go to onButtonClick
b1.addEventListener(MouseEvent.CLICK,onButtonClick);

[Code].....

View 7 Replies

ActionScript 2.0 :: Target Is Correct But Button No Works

Apr 13, 2005

I used as usual: this.menu_buttons_mc.menu_01_mc.menu_01_btn.onRele ase = function ()
{ trace ("this.menu_buttons_mc.menu_01_mc.menu_01_btn.onRe lease CALLED");}; But problem ist : it works only for one btn. Why? Try click the second flake from above and see AS layer please. I think it would be easy for you but diffic. for me.

View 3 Replies

ActionScript 2.0 :: Button Is Not Being Placing In The Correct Position When Set The X And Y Values?

Jan 15, 2011

My buttons are not being placed in the same position as my other buttons are on another page? I copied the same x and y cordinates as the other page..but they are still not being placed in the same position..why is this?

View 2 Replies

Actionscript 3.0 :: Roll Over Area Of A Button Not Correct When It's Rotated?

Jul 5, 2010

I have a project that includes 22 buttons that appear and disappear from the stage depending what the user is doing. These 22 buttons are text converted to movie clips. They are all rotated slightly (between 5 and 30 degrees depending where they are on the stage). BUT...hen you ROLL OVER them the mouse thinks the button is in a different location to where you see it. I realized the cursor reacts as if the button is no rotated at all; so the cursor changes to the hand, and the buttons change colour when you are near but not over the button and then you move over it and the cursor returns to an arrow thinking its rolled out.

View 1 Replies

ActionScript 2.0 :: Text File Var Decides Which Button Is Correct

Aug 14, 2002

I was wondering if anybody would have some input on this. I have three paths in my movie, p0, p1 and p2 (instance names). These paths are buttons and when I click on the right button I will get a message saying congratulations, if I click on the wrong button I will get a message saying wrong path. The catch is, a text file will contain the info on which button(path) is the correct one. The text file will contain, p1=true&, nothing else.

View 5 Replies

Professional :: Drag A Word Onto A Picture And Then Hit A Button That Says If Its Correct Or Not Or Something Similar?

Aug 7, 2010

good tutorial for drag and drop quiz style? I have managed to actually create the drag and drop but I need it for a quiz (as quiz templates are no longer available past CS3) so need it to tell the user if they are correct or not i.e. drag a word onto a picture and then hit a button that says if its correct or not or something similar.

View 4 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 :: View / Edit Button Symbol's Instance Name After Have Made Button Symbol?

Nov 5, 2011

How do you view and edit a button symbol's instance name after you have made the button symbol?

View 3 Replies

ActionScript 2.0 :: Get Instance Name Of A Button?

Nov 9, 2006

on (rollOver) {
butID=1;
butName=this._name;
trace(butName);
}

the third line, is that not it?? When I trace I get nothing. Why do buttons have to act weird...

View 3 Replies

ActionScript 2.0 :: Get The Instance Name Of The Button?

Oct 7, 2004

I want the following to happen: when I press my button, it should get the instance name of the button. I have the following code:

within the instance/flash actions window
on(release) {
PressButton();
}

[Code].....

I keep getting "undefined" as my answer. Furthermore, if I put trace(this._name) I get nothing (as in I get black on the output window). However, if I put in a string within the trace (such as 'Hello'), it works. So, assume everything works but the whole NamesButton._names part.

View 9 Replies

Flash :: Change The Text Of A Button Instance Without Affect The Other Button Text?

Feb 20, 2012

How can I change the text of a button instance without affect the other button text? I belive an AS aproach would solve it but I don't know how to do it.

View 1 Replies

.FLA - How Does The Button Instance Appear As The Caption In The Text Box

Mar 19, 2009

I am trying to learn Flash and as soon as I think I am in good shape, comes along this "curve ball". Take a look at the .FLA from this site ([URL]) How in the world do the alpha buttons get their captions? I understand the numeric ones, but alphas completely baffle me as there is no code (that I can find) that sets them. I have deleted all of the Actions, I have deleted virtually everything there is, and I still can't figure out how does the button instance appear as the caption in the text box.

View 6 Replies

Only One Instance Of Same Button Calling Function?

May 17, 2009

I have 4 instances of the same button on a single layer in a timeline of the mc 'coverflow_mc' named 'ThatsMe_btn_a' to 'ThatsMe_btn_d' ie same button, same position.. it just changes instance name on 4 keyframes. Why does it call the function fine for button a but not for b,c, or d? There is a stop on each of these frames and I can see from the swf that it is stopping at the correct frames.
 
function thatsMe() {
right = new Sound();
right.attachSound("right");

[Code]....

View 3 Replies

ActionScript 1/2 :: XML Text Into Button Instance?

Jun 30, 2009

I have created seven buttons in flash called "button1" through "button7" within each button is a text box. Is there a way to load XML text into each text box within the button instance?

View 4 Replies

ActionScript 2.0 :: Instance Name Of A Pressed Button

Jun 25, 2009

On a button I have this action: [ocde]On press I need to know the instance name of pressed button.I tried [code]

View 0 Replies

ActionScript 3.0 :: Can't Access Button With Instance Name

Sep 14, 2009

In my timeline I have a button, with an instance name of view_only_button. On my actions layer, I have code that is attempting to add a listener for a MOUSE_DOWN event. The frame that has the button is the same as where the actionscript is going, but of course it is two different layers. When I try accessing the variable by the code below, I get the error:

Error #1009: Cannot access a property or method of a null object reference.

ActionScript Code:
view_only_button.addEventListener(MouseEvent.MOUSE_DOWN, viewOnlyDownHandler);
function viewOnlyDownHandler(event:MouseEvent):void{
//Code to execute inside of the event call
}

When commenting the addEventListener line out, the error goes away. I am unsure why this would issue an error

View 7 Replies

ActionScript 3.0 :: Giving A Button An Instance Name Via Xml?

Sep 27, 2009

I am creating my first AS3 flash site and i am using a menu which gets links from a .xml file

[Code]...

View 4 Replies

Modify Text In Button Instance?

Apr 30, 2009

My library has an instance of a button symbol which brings up a popup with more information when clicked. All i want to do is change the display text of the button instance. From what i've read i thought i could just double click the instance and modify in the properties but there is nowhere in the properties to change the text.

View 2 Replies

ActionScript 2.0 :: Getting Instance Name Of Button When Clicked On

Sep 8, 2009

I am trying to sort out someone else's project and am not used to AS2. There are nine people in a folder called peeps. I want to load a swf into a modal on the page based on the instance name of the button clicked on. How do I get the instance name? I put ? around where the selector should go, not sure what should be there.

Code:
peeps.?button?.onRelease = function() {
var peepName = this._name;
trace(peepName);
getURL('javascript:loadVid(cmsflash/'+peepName+'.swf);');
};

View 4 Replies

ActionScript 2.0 :: Cannot Give Button Instance Name?

Sep 10, 2010

I'm trying to give a button an instance name. The button is situated in the library, and i suppose that's why I cannot give it an instance name (which is really necessary.)It 's in actionscript 2.

View 3 Replies

ActionScript 3.0 :: Recording Button Instance Clicks

May 26, 2009

I have about 10 buttons on the page. When you click one of the buttons, there is a popup (which is closeable). The user is meant to click all buttons (and open all of the popups) before they can move on (before the next_btn becomes visible). So far I just have a counter type of code in place (when you click a button one gets added to the counter), but you could just click on the same button 10 times and the next_btn will become visible. I cant figure out how to specialise the counter. I want the user to click ALL of the different buttons before they can click the next button and move on..

View 4 Replies







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