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
Similar Posts:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Nov 20, 2009
how do you access a button inside a movie clip by instance name? i want to add an event listener to the button.
i tried:
Code:
myMovieClip.myButton.addEventListener(MouseEvent.MOUSE_DOWN etc......
and got no errors but at the same time it didnt respond to my event listener
View 4 Replies
Jul 31, 2011
I created a button on the stage and made it a movie clip and called it's instance name "play_btn" then i made a document class "main.as" and a second class "play button.as". How is to access the instance name in the play button.as file like this...
public class login_page extends MovieClip {
public function login_page() {
play_btn.addEventListener(MouseEvent.MOUSE_DOWN, onPlayDown);
} public function onPlayDown(evt:MouseEvent):void {
trace("Test");
}}
And then I want to call the function in the main.as.. but the general problem is that I want to access the instance name "play_btn" in the "playbutton.as" file. I tried to link it to the class but i get this error: 1120: Access of undefined property play_btn.
View 4 Replies
May 29, 2010
I have a button which appears on multiple frames. I want to define an action on the button rather than each instance. Is there any way that I can do this in CS5?
View 4 Replies
Jul 19, 2010
I'm so use to timeline code, that this baffles me. How do I get a button class to recognize a button instance on stage?
[Code]...
Error: 1120: undefined property The error indicates it's the mouse event, not my instance name mc. LINK TO THE FILE
View 3 Replies
Sep 2, 2011
I've created a button in Flash, and inside that I have a TextField and a MovieClip, both with instance names set. They cover all 4 frames of the button, with no keyframes.I found I couldn't access the objects using the instance names I'd set, so I used this piece of code to see what's going on:
var obj:DisplayObject = this.m_graphics.btnChange.upState;
for ( var i:int = 0; i < obj.numChildren; i++ )
{
[code]....
View 1 Replies
Jan 27, 2012
I have 2 instances of a button wich is red and has a white label I have to edit the buttons so one button is red, and the other is green I was doing this, but when applied Also the title of label goes green instead of being white...
[Code]....
View 1 Replies
Mar 24, 2012
In Flash, I created a grid of 400 buttons with instance names c0 through c399.[code]...
View 2 Replies
Jun 28, 2009
I created a button, stored in library, and would like to create an instance of the button in AS3 and add to stage.
It seems that most people use movie clips as buttons, create instances, and add to stage. This works fine.
Is it possible to add instance of a button from the library and add to the stage?
View 8 Replies
Jun 28, 2010
I've been learning AS3 lately and am trying to put together an interactive map. I've brought in some map data and converted it to individual movie clips, each of which has an instance name that I'd like displayed when each clip is clicked on. ideally an informational box would appear with the name of the clip and some other info that I've specified.
What do I need to script so that if one clicks on a movie clip, the instance name is displayed?
View 1 Replies
Sep 18, 2004
I've got a really weird one here. I have a movie A. Inside movie A, I have another movie 3 more movies B, C, D. B, C, D are all instances of the same movie. Inside this movie is a button, given in an instance name of button. When B, C, D are clicked, they put text inside a text box. The actions for this are assigned using frame actions. The exact action is as given below:
[Code]...
View 5 Replies
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
Jun 12, 2009
How do you disable only the MOUSE_OVER event for a an instance of the Button class in AS 3?
MyButton.Mouse_OVER = null ;
Will not work as it is not a writable property.
MyButton.enabled = false
Will not work as that disables the entire Button and that is not what I want.
View 1 Replies
Nov 3, 2011
Just wondering how I reference A button that I have within a movie clip, within a movieclip to and instance on the parent timeline.At the moment I am using, but not getting the correct result:MovieClip(parent).NavBar.gotoAndPlay("About");
View 1 Replies