ActionScript 3.0 :: Using Target To Get Access To Textfield?
May 27, 2009
I'm struggling trying to get the correct (assuming it's possible) syntax to get access to a textfield in a movieclip via a button also in the movieclip.
Here's the specifics:
var statue:MovieClip = new mcStatue;
In mcStatue is a button: btnStatue, and a textfield named Qty.
On a mouse click to the button I want to be able to add to the Qty textfield.
e.target.Qty.text = "x"
game me: Property Qty not found on fl.controls.Button and there is no default value.
Is there a way to do this, or do I need to go after some kind of workaround?
View 5 Replies
Similar Posts:
Mar 29, 2011
I'm making a Matching Game where I have some images on my left and I can drag them onto images on my right and if they are matching, they should both disappear from the stage.
[Code]....
findMatch() is a function that finds in my XML file the path of the file that matches the file that is being dragged. Having that path, I send it to dragEnterHandler where it compares it with the path of the dropTarget file and if they are the same, it accepts it. Then in dragDropHandler, I'm changing the source path of my second image to "", so that it disappears from the stage. How can I access the first file (the one that was being dragged), so that I can change its path to "", to get rid of it?
View 1 Replies
Sep 11, 2011
I added a SWC with movieclip assets to my flash builder project. I can access all movieclips with dot syntax but when I try to access my textfields it throws an error saying it is cannot access a property or method of a null object reference
Here is my code:
// gameMenuLevels is a main asset.
this.object = new gameMenuLevels();
This all works fine, I can go two levels deep:
var levelString:String = "level" + Utils.zeroPad(i + 1, 3);
var level:MovieClip = this.object[levelString] as MovieClip;
var bronze:MovieClip = level.bronze as MovieClip;
But when I try to get my textfield:
(bronze.getChildByName("levelNumber") as TextField)
View 1 Replies
Jan 13, 2010
I need to create a complex html displaying in a textfield so I'm looking right now at a few options. The simplest would be to use an img tag so I can add a few Sprite coming from the library. Problem is I can't seem to find a way to modify or pass values to the Sprite that is created that way.
View 9 Replies
Oct 3, 2005
Everytime I press a button, my function duplicate's my MC and give's it a new name (artikel1, artikel2, arikel3...)This MC contains a dynamic textfield called "tekst".Now I want my function to change that textfield for every new duplicated mc something like this (mc1, mc2, mc3...)And thats the problem! I cant access the tekstfield from outside the mc ! i tryed something like this and manny more but nothing happend.
View 2 Replies
Jan 13, 2009
This is for AIR: My document class imports a separate class "ConnMonitor" and uses it to constantly monitor the network connection. It's at the very end of that class where it's supposed to update a textfield on the stage as the connection changes, but the class can't access the textfield.
View 8 Replies
Jan 27, 2010
The following code is not working
function menuAct(event:MouseEvent):void { event.currentTarget.parent.removeEventListener(MouseEvent.MOUSE_OVER,
[code].....
View 4 Replies
Aug 12, 2009
I've created an animated scene in Flash, with a bar chart.The bar is a MovieClip symbol containing a large rectangle and a TextField.I'd like to access the TextField using actionscript, but I can't seem to reference it.
Each bar in the scene has its own instance name, so that's easy to find.
But how do I modify the text in the textfield within the symbols?
View 1 Replies
Feb 4, 2011
I have an MC (act as button) with onRelease, onRollOver and onRollout handlers.
When I click the MC I want to remove these handlers so I can access a TextField of type Input.
But no matter what I've tried over the last TWO WHOLE DAYS, I simply cannot get anywhere near a solution.
View 3 Replies
May 14, 2011
I have two frames, and I would like to set the textfield's text on frame #2 of the textfield's content on frame #1. How can I do this? Here are the codes: Frame #1(I've got an input textfield(bemenet) and a button(gonb) on it):
Code:
stop();
gonb.addEventListener(MouseEvent.CLICK, klikkol);
bemenet.border=true;
bemenet.textColor=0x000000;
[Code].....
After run, and clicking the button, I've get an error message: Cannot access a property or method of a null object reference.
View 3 Replies
Jan 17, 2012
I have the following situation: I create a movieClip and need to access the dynamic textfield that's inside the movieClip in AS3. As follows:
var mcAzul:mcStickerAzul = new mcStickerAzul();
this.addChildAt(mcAzul, 0);
mcAzul.x = 20;
[code]....
The problem is that always returns the message:
TypeError: Error #1009: Can not access a property or method of a null object reference.
View 4 Replies
Dec 5, 2008
I am trying to make a "mother" swf to hold all my functions, shortcuts, etc.. This "mother" swf will be stored on a "mother" server.I intend to make several websites on different servers that all access this "mother" swf for various tasks.I created two testing domains where I was able to have cross-domain swfs share functions & variables successfully.The problem occurs when one swf tries to write to a textfield in another swf. I can change properties like position and rotation, but I cannot access properties such as ".text", which is the most important property I need to use.
Mother SWF: "www.projectvolcano.com/a.swf" (a.swf)
2nd SWF: "www.unitcounter.com/b.swf" (b.swf)
Note: b.swf loads a.swf using loadMovie
[code].....
View 3 Replies
Mar 20, 2009
I have created a class, that is simply a group of text fields. In the main app, I create instances of this class, and add them to the main app.How can i access the textFields that are in the class, to say, change the text, etc...
View 3 Replies
Jul 18, 2009
1, Seems like a standard job, but somehow this doesnt work: Movieclip called "Button" lies in the library.I instantiate it in code:
Code:
var button:MovieClip = new Button();
I have a dynamic textfield with an instance name of "description_text" in it, but if I try to access it (e.g: change the text), I get an error. This is how I do it:
Code:
(button.getChildByName("description_text")as TextField).text = "Success";
Cannot access a property or method of a null object reference.
Why is this not working?
2, I know it's easier to just have the movieclip invisible on all frames except the ones that I need it.
View 4 Replies
Jun 23, 2010
I have a custom class which creates a new MC using a library MC. The library MC contains a dynamic textfield called productName.
The custom class object gets created fine and is displaying on the stage. It's also holding custom properties I set as well.
How do I control the dynamic textfield inside the MC, which is inside the custom class object?
My Product.as:
Code:
package {
import flash.display.MovieClip;
public class Product extends MovieClip {
[Code].....
View 2 Replies
Mar 30, 2009
I have another problem I create a button in the library, it has a background graphic on a layer and a textField, the textField has a instance name defined in the properties panels and some text. I manually place some instance of the button on stage, I give them different instance names and voilĂ a new problem arise when with actionscript I try to assign a new text to the textField inside a button it throws me error 1119. A quick look at the menu option debug ->list objects, shows me that the instance name of the textField inside the button it is not what I defined but it was replaced with some random name like "instance66"I did a test with a movieclip instead of a button and I can correctly access my textField with the instance name that I manually defined. Why that can be the same with the button? And if for some arcane reason cant be possible to access a manually defined instance inside a button WHY flash give me the possibility to give an instance name to a dynamic textField inside a button?
View 1 Replies
Oct 2, 2011
I have an input textfield on my stage. I have created a AS3 Document as the Main Class for my work. Now I need to access the user input in the textfield and work with it in my class.
View 4 Replies
Feb 4, 2012
I have an external as file.I was wondering what I put in it to update a textField I have manually drawn on the stage? so what I'd normally put in the timeline is:
myField.text = 'tester';
what would you put in an exteranl as file, and do I need to include:
import flash.display.MovieClip;
import flash.display.Stage;[code]....
View 11 Replies
Jan 7, 2010
I have an external swf file 'testSWF'loaded into a UILoader 'myLoader2'. The external swf has a textfield 'myText'. I want to retrieve the text from this external swf textfield into another textfield 'parentTextField' in my parent flash file. I can't work out how to do it, and I can't find a simple example.
[Code]....
View 1 Replies
Nov 2, 2011
I'm stunned as to why I cant access the textfield object placed inside a movieClip objectI'm doing this in a subclass as so:I gave the movieClip an instance name of "myMC" and the
Code:
package {
import flash.display.MovieClip;
[code].....
View 7 Replies
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
Oct 14, 2009
i want to access a movieclip or a textfield placed on stage within a static function defined in a class not in a document class ..
View 1 Replies
Jan 11, 2011
I am having trouble referencing dynamically generated textfield in a document class. I gives me the assigned name when traced, but generates an error when I refer to the name. Here are the documents:
[Code]...
View 9 Replies
May 13, 2010
how can i access event.target outside event listener method.say for example
my_mc.addEventListener(MouseEvent.CLICK, onC);
function onC(e:MouseEvent):void
{
var m:MovieClip = e.target as MovieClip;
}
trace(m.totalframes);/// not working
now what if i want to get totalframe property of m instance, in short for every movieClip clicked.
View 11 Replies
Sep 29, 2003
On the attached exercise, is it possible to stop further items being dragged onto a target when the target box is full?
View 1 Replies
Nov 28, 2011
What is the difference between target and currenttarget in flex?What is the difference between Target and Current Target in Flex especially in mouse events.
View 2 Replies
Aug 17, 2010
I'm just now learning the new object oriented way of scripting. It's been a wild ride, but I've finally learned how to keep script off my frames (very hard coming from as2).Here's my problem:
I have a TextField on the stage in my main .fla file named loadPercent.
I'm loading a jpg with preLoad.as and displaying the bytes loaded in loadPercent.
I can access my loadPercent TextField from my MainClass
but I can't access it from preLoad.as
the document class is MainClass.as
Code:
package
{
import flash.display.MovieClip;[code]....
I get three '#1120 access of undefined propery' errors for each time i try to access loadPercent.
a few basic questions: 1. all my files are in a folder in my documents, not in the flash directory, is this bad? I've seen people using com.whatever etc.
2. my main .fla file does not share the same name as my MainClass.as (it's not named MainClass.fla) Is that a problem?
I'm assuming these are inconsequential because my code seems to work up to a certain point.
View 7 Replies
Nov 1, 2008
The code I'm building creates two MovieClips on the stage, in one it instantiates several text boxes and in the other some buttons.
What I can't do is access data from the text boxes (e.g. textField.text) for use in the functions called by the eventListeners attached the buttons. I had the system all working nicely before I placed the text boxes and the buttons on separate movie clips.but this structure makes it much tidier to refresh the text I'm using.The button functions are fine with variables created prior to the building of the text boxes.
Am I failing to address the text boxes correctly (because they're on another movie clip) or is there a stage / movie clip property I need to set so they can see each other ... or is this something else altogether?Could it be that the buttons are created before the text boxes?
View 5 Replies
Aug 30, 2010
qi have a movieclip which is added to the stage:
var profileholder:profileHolder=new profileHolder ;
inside of profileholder is another movieclip(infoBtn) that acts as a button.when the mouse is over profileholder i want to do something with infoBtn like:
//profOver is the over state of profileholder
function profOver(e:Event) {
e.target.infoBtn.alpha=1;
}
this doesn't work and brings up this error:ReferenceError: Error #1069: Property infoBtn not found on flash.display.Loader and there is no default value.
at main_fla::MainTimeline/profOver()
i also tried:
function profOver(e:Event) {
var item:profileHolder=e.target as profileHolder;
item.infoBtn.alpha=1;
}
and get this error:TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 1 Replies
Mar 14, 2005
i don't know why this isn't working.i got a button. and when it's pressed, i need it to go and play a frame in a movie clip. i'll test it and then when i click on it, i get this:
Target not found: Target="whoweare" Base="_level0.instance20.instance48.instance49"
this is the code that i am using:
on (press) {
tellTarget ("whoweare") {
gotoAndPlay (51);
}
}
View 14 Replies