Passing event target name to text field

Hi There,
I'm new to 3.0 and can use some help here... should be an
easy one for you experts...
I just need to pass an event target name to a text field:
square.addEventListener(MouseEvent.MOUSE_DOWN,downObj);
function downObj(event:MouseEvent){
targetObj = event.target;
mydrag.visible = true;
targetObj.startDrag();
mydrag.addEventListener(Event.ENTER_FRAME, dragClip);
target_txt.text = String(event.target);
I've also tried:
target_txt.text = event.target;
but no luck so far..
Any help would be highly appreciated.
Cheers...
Bruno Aun
Flash + Coldfusion Developer
http://www.BrunoAun.com

That's right...
target_txt.text = String(event.target
.name);
works like a charm.
thank you!

Similar Messages

  • Help with event.target.name

    I am very green with actionscript and coding in general so please forgive me if I am asking something that sounds super simple.
    Is it possible to take "event.target.name" value which in my case would be something like "SW5005_mc" and change that value.
    I use that value right now to tell another clip to gotoAndStop(event.target.name); which I have frames labeled the same as the event.target.name.
    I would like to take the value of event.target.name for instance "SW5005_mc" and remove the "_mc" and put a dash in between the "SW" and the "5005"
    to get "SW-5005" which then I would pass into a text field.
    I really don't know where to begin or if this is possible.
    Thanks for any help or suggestions,
    Chris

    yes you can do it with String manipulation, check out the various String Class methods, some examples here:
    http://www.wuup.co.uk/as3-basics-string-manipulation-in-actionscript-3/
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/String.html

  • How do I use the event.target.name String with an external dispatchEvent?

    ...I hope the title question makes sense...
    On my stage I have an externally loaded SWF with a button. When clicked the button dispatches an event to the main stage.
    On the main stage a listener then loads an SWF into a loader called gallery.
    The gallery loader is also being shared by buttons on the main stage which use the event.target.name String to call in SWFs with corresponding names.
    I am using Tweens to fade-out and -in content to the gallery when a button is pressed.
    Loading the SWFs was working until I tried to create a universal button function for the dispatchEvent buttons...
    The problem I have is that I don't know how to define the String to tell the newSWFRequest where to find the SWF when triggered by the external buttons.
    (I may be doing this all wrong... but figured the best way to load an SWF on to the main stage from an external SWF was by using dispatchEvent??)
    My code triggers the Event and the gallery loader fades out, but then it cannot find the new SWF:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
    Please can someone help me understand the way to make the String point in the right direction? (I think the only errors are in bold below)
    Code:
    var myTweenIn2:Tween;
    var myTweenOut2:Tween;
    var nextLoadS2:String;
    // Listen for external event dispatched from external btns
    addEventListener("contactStage", btnClickExtrnl);
    function btnClickExtrnl(e:Event):void {
    nextLoadS2 = ?????
    myTweenOut2=new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);
    myTweenOut2.addEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteF2);
    // Btns Universal function
    function tweenOutCompleteF2(e:TweenEvent){
    myTweenOut2.removeEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteF2);
    myTweenOut2=null;
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + nextLoadS2 + ".swf");
    myTweenIn2 = new Tween(gallery, "alpha", None.easeOut, gallery.alpha, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    Thank you.

    That works – thank you!
    I'm now using this code to fade in each of the SWFs:
    function contactStage(e:MouseEvent):void {
        var newSWFRequest:URLRequest = new URLRequest("swfs/"+e.currentTarget.name+".swf");
        myTweenIn = new Tween(gallery,  "alpha", None.easeOut, 0, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    But I cannot add the fade out function. I have amended the above code to create:
    var myTweenOutX:Tween;
    var myTweenInX:Tween;
    function contactStage(e:MouseEvent):void {
    myTweenOutX=new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);
    myTweenOutX.addEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteFX);
    function tweenOutCompleteFX(e:TweenEvent){
    myTweenOutX.removeEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteFX);
    myTweenOutX=null;
        var newSWFRequest:URLRequest = new URLRequest("swfs/"+e.currentTarget.name+".swf");
    myTweenInX = new Tween(gallery,  "alpha", None.easeOut, 0, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    But get this error:
    ReferenceError: Error #1069: Property name not found on fl.transitions.Tween and there is no default value.
    at ACOUSTIC_fla::MainTimeline/tweenOutCompleteFX()[ACOUSTIC_fla.MainTimeline::frame1:110]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.transitions::Tween/set time()
    at fl.transitions::Tween/nextFrame()
    at fl.transitions::Tween/onEnterFrame()
    Where am I going wrong?

  • How do I use event.target.name in AS2?

    Thanks to kglad I was able to see how event.target.name in AS3 could make a button load a movieclip with the same namesake.
    I'm doing the same thing now in AS2 but don't know what to write instead of event.target.name.
    And so at the moment each button pushes info into an array and then a function uses that to decide which movieclip to attach to a holder after it has faded out once, and then fades in again...
    // ***** IMAGE GALLERY START ***** //
    // Add image to holder
    imgholder.attachMovie("img0", "image0_0", 1)
    // Array
    var nextLoad = ["img0"];
    // Btn listeners
    img5.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img5"); btnClick() } // Written on 1 line
    img4.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img4"); btnClick() }
    img3.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img3"); btnClick() }
    img2.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img2"); btnClick() }
    img1.onRelease = function() {
    nextLoad.pop();
    nextLoad.push("img1");
    btnClick()
    img0.onRelease = function() {
    nextLoad.pop();
    nextLoad.push("img0");
    btnClick()
    // The btn function
    function btnClick() {
    trace ("click");
    var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true);
    myImgTween.onMotionFinished = function() {
    fadeOutImg();
    // The btn function part II
    function fadeOutImg() {
    trace ("fadeOutImg");
    imgholder.attachMovie(nextLoad, "image1_1", 1);
    var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true);
    I know I should be able to push the button name into the array, but am having to use a string... I'm sure my code is cumbersome!! But it works. I've tried pushing the button name but it end up including the full stage reference.
    Is there a cleaner way of doing this using event.target.name?
    Thanks for looking!

    There is no event.target in AS2. However since AS2 has no way of remembering the scope object where the target object resides, you can use this to your advantage to retrieve the name of the target by using the "this" command in the function whenever you use the above format "mc.onPress = myfunc". FYI, the popular workaround Delegate, made it possible that when you called "this" in the function, you could retrieve the scope object where the target instance resides. So without its use, "this" will return the name of the target object. Anyway this is the code you can use:
    imgholder.attachMovie("img0","image0_0",1);
    var nextLoad = ["img0"];
    img5.onRelease = onImgRelease;
    img4.onRelease = onImgRelease;
    img3.onRelease = onImgRelease;
    img2.onRelease = onImgRelease;
    img1.onRelease = onImgRelease;
    img0.onRelease = onImgRelease;
    function onImgRelease():Void {
       nextLoad.pop();
       nextLoad.push(this._name);
       btnClick();
    // The btn function
    function btnClick() {
       trace("click");
       var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true);
       myImgTween.onMotionFinished = function() {
          fadeOutImg();
    // The btn function part II
    function fadeOutImg() {
       trace("fadeOutImg");
       imgholder.attachMovie(nextLoad,"image1_1",1);
       var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true);

  • Attached corresponding image in mouse without using event.target.name in actionscript 3

    Hi,
    AS3:
    How to get general id (or) name from xml loaded images. bcoz, i want to drag and drop that images in generic method. Now, i currently used the event.target.name for each one.
    So, code length was too large. See my code below.
    /*********loading images through xml********/
    var bg_container_mc:MovieClip
    var bg_bg_myXMLLoader:URLLoader = new URLLoader();
    bg_bg_myXMLLoader.load(new URLRequest("xml/backgroundimages.xml"));
    bg_bg_myXMLLoader.addEventListener(Event.COMPLETE, processXML_bg);
    function processXML_bg(e:Event):void {
              var bg_myXML:XML=new XML(e.target.data);
              columns_bg=bg_myXML.@COLUMNS;
              bg_my_x=bg_myXML.@XPOSITION;
              bg_my_y=bg_myXML.@YPOSITION;
              bg_my_thumb_width=bg_myXML.@WIDTH;
              bg_my_thumb_height=bg_myXML.@HEIGHT;
              bg_my_images=bg_myXML.IMAGE;
              bg_my_total=bg_my_images.length();
              bg_container_mc = new MovieClip();
              bg_container_mc.x=bg_my_x;
              bg_container_mc.y=bg_my_y;
              ContentHead.addChild(bg_container_mc);
              for (var i:Number = 0; i < bg_my_total; i++) {
                       var bg_thumb_url=bg_my_images[i].@THUMB;
                        var bg_thumb_loader = new Loader();
                       bg_thumb_loader.load(new URLRequest(bg_thumb_url));
                       bg_thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded_bg);
                       bg_thumb_loader.name="bg_load"+i;
                       bg_thumb_loader.addEventListener(MouseEvent.MOUSE_DOWN, bg_down)
                       bg_thumb_loader.x = (bg_my_thumb_width-18)*bg_x_counter;
                       bg_thumb_loader.y = (bg_my_thumb_height-45)*bg_y_counter;
                       if (bg_x_counter+1<columns_bg) {
                                 bg_x_counter++;
                       } else {
                                 bg_x_counter=0;
                                 bg_y_counter++;
    function thumbLoaded_bg(e:Event):void {
              var my_thumb_bg:Loader=Loader(e.target.loader);
             var sprite:Sprite = new Sprite();
              var shape:Shape = new Shape();
              shape.graphics.lineStyle(1, 0x0098FF);
              shape.graphics.drawRect(e.target.loader.x-2, e.target.loader.y-2, e.target.loader.width+4, e.target.loader.height+4);
              sprite.addChild(shape);
              sprite.addChild(my_thumb_bg);
              sprite.x=4;
              bg_container_mc.addChild(sprite);
              my_thumb_bg.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded_bg);
    //  get name for each image. 
    I want to change this code in generic method. do needful.
    function bg_down(event:MouseEvent):void {
              var bg_name:String=new String(event.currentTarget.name);
              var bg_load:MovieClip=event.currentTarget as MovieClip;
              if (event.currentTarget.name=="bg_load0") {
                      var alaska_mc:alaska_png=new alaska_png();
                       addChild(alaska_mc);
                       alaska_mc.x=stage.mouseX;
                       alaska_mc.y=stage.mouseY;
                       alaska_mc.name="alaska_duplicate"+alaska_inc;
                       alaska_inc++;
                       alaska_mc.startDrag(false);
                      alaska_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
                       alaska_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load1") {
                       var lake_mc:lake_png=new lake_png();
                       addChild(lake_mc);
                       lake_mc.x=lake_mc.mouseX;
                       lake_mc.y=lake_mc.mouseY;
                       lake_mc.name="lake_duplicate"+lake_inc;
                       lake_inc++;
                       lake_mc.startDrag(false);
                       lake_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load2") {
                       var mountn_mc:mountn_png=new mountn_png();
                       addChild(mountn_mc);
                       mountn_mc.x=mountn_mc.mouseX;
                       mountn_mc.y=mountn_mc.mouseY;
                       mountn_mc.name="mountn_duplicate"+mountn_inc;
                       mountn_inc++;
                       mountn_mc.startDrag(false);
                       mountn_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load3") {
                       var town_mc:town_png=new town_png();
                       addChild(town_mc);
                       town_mc.x=town_mc.mouseX;
                       town_mc.y=town_mc.mouseY;
                       town_mc.name="town_duplicate"+town_inc;
                       town_inc++;
                       town_mc.startDrag(false);
                       town_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load4") {
                       var water_mc:water_png=new water_png();
                       addChild(water_mc);
                       water_mc.x=water_mc.mouseX;
                       water_mc.y=water_mc.mouseY;
                       water_mc.name="water_duplicate"+water_inc;
                       water_inc++;
                       water_mc.startDrag(false);
                      water_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load5") {
                       var city_mc:city_png=new city_png();
                       addChild(city_mc);
                       city_mc.x=city_mc.mouseX;
                       city_mc.y=city_mc.mouseY;
                       city_mc.name="city_duplicate"+city_inc;
                       city_inc++;
                       city_mc.startDrag(false);
                      city_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load6") {
                        var citywide_mc:citywide_png=new citywide_png();
                       addChild(citywide_mc);
                       citywide_mc.x=citywide_mc.mouseX;
                       citywide_mc.y=citywide_mc.mouseY;
                       citywide_mc.name="citywide_duplicate"+citywide_inc;
                       citywide_inc++;
                       citywide_mc.startDrag(false);
                      citywide_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load7") {
                       var downtown_mc:downtown_png=new downtown_png();
                       addChild(downtown_mc);
                       downtown_mc.x=downtown_mc.mouseX;
                       downtown_mc.y=downtown_mc.mouseY;
                       downtown_mc.name="downtown_duplicate"+downtown_inc;
                       downtown_inc++;
                       downtown_mc.startDrag(false);
                      downtown_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load8") {
                       var powerlines_mc:powerlines_png=new powerlines_png();
                       addChild(powerlines_mc);
                       powerlines_mc.x=powerlines_mc.mouseX;
                       powerlines_mc.y=powerlines_mc.mouseY;
                       powerlines_mc.name="powerlines_duplicate"+powerlines_inc;
                       powerlines_inc++;
                       powerlines_mc.startDrag(false);
                      powerlines_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load9") {
                       var tropical_mc:tropical_png=new tropical_png();
                       addChild(tropical_mc);
                       tropical_mc.x=tropical_mc.mouseX;
                       tropical_mc.y=tropical_mc.mouseY;
                       tropical_mc.name="tropical_duplicate"+tropical_inc;
                       tropical_inc++;
                       tropical_mc.startDrag(false);
                      tropical_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load10") {
                       var waters_mc:waters_png=new waters_png();
                       addChild(waters_mc);
                       waters_mc.x=waters_mc.mouseX;
                       waters_mc.y=waters_mc.mouseY;
                       waters_mc.name="waters_duplicate"+waterthumb_inc;
                       waterthumb_inc++;
                       waters_mc.startDrag(false);
                      waters_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
    Please suggest me if any  one.
    Regards,
    Viji. S

    for each loader created, create a movieclip and add your loader to the movieclip.  assign all the properties you want to retrieve later to the movieclip and assign your event listeners to the movieclip.

  • File name into text field

    Is there a way to display the forms file name, into a text field?
    Example: The form's file name is "MyForm.1.01.pdf"
    I would like to display "MyForm.1.01" in a text field on the form.
    If my form is saved and goes up a revision to say "MyForm.1.02"
    "MyForm.1.02" is then displayed in the text field.
    I was thinking, this could be on the pre open event, so that when the form is saved, it would display the new revision when the form is next opened?
    Thanks in advance.

    Hi,
    The following will get the file name:
    this.rawValue = event.target.documentFileName;
    I would put this in the docReady event, as this event fires only once, when the form opens.
    There is a sample here: https://acrobat.com/#d=ZnxO-dlXXFDS0GvYcQk2NQ
    Hope that helps,
    Niall
    Assure Dynamics

  • Event handler for a text field

    How do I write an event handler that will be triggered when the value of a text field changes? I assume I can place an event in place of SOME EVENT HERE in the example below.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[
                private var newVal:Number=1
                public function doThis():void{
                    newVal+=1
                    goal1.text=String(newVal)
                    //goal1.addEventListener(SOME EVENT HERE, textChange)
                public function textChange():void{
                    trace("text changed")
            ]]>
        </mx:Script>
        <mx:Text id="goal1" color="#57782f" fontSize="30" text="1"  x="106" y="110"/>
        <mx:Button x="88" y="169" label="Button" click="doThis()"/>
    </mx:Application>

    "Text" does not dispathc a change event, so use a TextArea tweaked as follows.
    If this post answered your question or helped, please mark it as such.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[           
                private var newVal:Number=1
                public function doThis():void{
                    newVal+=1
                    goal1.text=String(newVal)
                    goal1.addEventListener(Event.CHANGE, textChange)
                public function textChange():void{
                    trace("text changed")
            ]]>
        </mx:Script>
        <mx:TextArea id="goal1" color="#57782f" fontSize="30" text="1"  x="106" y="110"
         focusThickness="0" borderThickness="0" backgroundAlpha="0"/>
        <mx:Button x="88" y="169" label="Button" click="doThis()"/>
    </mx:Application>

  • Passing the date to a text field using DateChooser

    How can I pass the date that someone selects to a text field
    in Flash.
    AND then how can I pass the date that someone selects to a
    text field in Director using the same component?
    "selectedDate()" isn't working, plus I get "undefined" when I
    trace that...

    > Do you know why if I select the same date twice I get a
    "property not
    > found"
    > error ---- #selectedDate?
    Think you have to use on change(me) instead of mouseUp.
    To use that with the flashobject, you need to intialize the
    object once, eg
    in enterframe.
    Try the following - look out for linebreaks.
    property pSprite
    property pInit
    property pEvent
    on beginSprite(me)
    pSprite = sprite(me.spriteNum)
    pInit = false
    pEvent = 0
    end
    on enterFrame(me)
    if not(pInit) then
    pEvent = pSprite.newObject("MyDateChooser")
    pSprite.setCallBack(pEvent, "change", #change, me)
    pInit = true
    end if
    end
    on change(me)
    y = integer(sprite(1).selectedDate.getYear()) + 1900
    d = integer(sprite(1).selectedDate.getDate())
    m = integer(sprite(1).selectedDate.getMonth())+1
    member("chosenDate").text = d & "-" & m & "-"
    & y
    end
    on endSprite(me)
    pEvent = 0
    end

  • How can I pass URL parameter value to text field?

    Dear Masters,
    I have a text field. I want it to have a value based on the URL parameter, for example:
    http://myapplication.net:7777/pls/apex/f?p=102:1:::::P1_RTNUM:9448,P1_EMAILADD:email.add.here
    I want the value of the text field = P1_EMAILADD after the form was loaded. Also, please have it read-only.
    Thanks a lot.
    Edited by: user6368519 on Sep 16, 2009 11:39 PM

    Thanks Saad,
    Can I email you(I would need your email) for any concerns or just create a new thread for you to look?
    This is ok now. I'm sorry but I just marked this one as an "answered" one last time.
    Thanks for all the help again I appreciate it. ;)
    Thanks,
    Aaron
    [email protected]

  • File name from text field value

    Is it possible to save a file with the value of a Text field?
    Thank you

    Well JSP is server side code and TextBoxes are html which is client side script. To get the value of an html Textbox you either can use Javascript and do it all client side or you can post your form to a JSP or servlet and use request.getParameter("field_name"); to get the value of the form field.
    make sense?
    -S-

  • Can you make an enter event in topmostsubform that gets the field name of any field thats entered

    Looking for some help.
    I have a modified Enter Event I'm trying to use. What my expected results are: When you click on a field on the PDF, it would open up a certain webpage or file depending on what field is entered. I currently have:
    if (xfa.host.name == "Acrobat") {
              app.launchURL("www.cnn5.com" + "/" + event.target.documentFileName + "&" + this.name, true);
    else {
              xfa.host.gotoURL("www.cnn5.com");
    In this example, i'm using a bogus address obviously. "event.target.documentFileName" gives me the PDF name which is what I want, but I need to scrub off the ".pdf" at the end of it. I know I can use this in every field that I want it in, but I'm looking to see if I can get this code in just the topmostsubform only due to having hundreds of forms I might be using this form and to save time.
    When this is used in the topmostsubform, it gives me the URL: "www.cnn5.com/PDFname.pdf&TopmostSubform" no matter what field i click into. Is there something i can change this.name to? Any help would be greatly appreciated.
    Also, i'll need to have this event to be able to use multiple times, because currently in the topmostsubform, it only activates on the first field that I enter and doesn't activate on fields after that. Suggestions please? Thank you

    Hi,
    Are you using event propagation?  If you are try
      xfa.event.target.name
    Otherwise have a look at this  http://blogs.adobe.com/formfeed/2009/03/xfa_30_event_propagation.html
    Regards
    Bruce

  • Spawning a new page depending on whether a text field is populated or not

    I am trying to create a form that once the last line is in the description field contains text it will automatically spawn a new page directly below the page being filled in. I am so googled out.
    if (getField("DOD20").value === "");
    else
    var a = this.templates;
      for (i = 0; i < a.length; i++)
      a[i].spawn(this.numPages, false, false);

    The renaming of the form fields is controlled by the spawn method. It is a passed parameter. By default the new page will be inserted after the first page, the fields will be renamed, the form will not overlay.
    Because the fields are renamed in a standard manner, you need to create your scripts to allow for this. I usually do this by using JavaScript to access the focused field name, event.target.name, and split the field name into an array and then compute the field names that need to be accessed.
    Did you open the JavaScript console and see if there are any errors?
    Have you opened the form and looked at the form in the edit mode?

  • Linking a class to a dynamic text field to load XML data.

    Hi,
    I'm quite new to ActionScript and would be grateful for any help here.
    I want to load text into a dynamic text field (called 'about_tab') using  a class depending on the language selected (by clicking on a flag icon)  by the user.
    I managed to get this to work when the ActionScript was written directly  in the timeline, but am having problems with doing the same thing via a  class.
    This is my class file:
    package
    import flash.display.SimpleButton;
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    import flash.events.Event;
    public class ChangeLang extends SimpleButton
    public function ChangeLang()
    addEventListener(MouseEvent.CLICK, switchLang);
    trace("ChangeLang class working");
    public function switchLang(event:MouseEvent):void
    var lang = event.target.name;
    var req:URLRequest = new  URLRequest("languages/"+lang+".xml");
    var loader:URLLoader = new URLLoader();
    var substance:XML;
    function xmlLoaded(event:Event):void
    trace("function xmlLoaded is running");
    substance = new XML(loader.data);
    about_tab.text =  substance.about_lbl;
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    loader.load(req);
    Here's one of my XML files (the other is the same except "About" is  written in German):
    <substance>
    <about_lbl>About</about_lbl>
    </substance>
    When I run it, it returns my trace statements that the class ChangeLang  and the function xmlLoaded are running, but no text appears in the  dynamic text field (I should/want to see the word 'About'). I get this  error message:
    1120: Access of undefined property about_tab
    The problem, I'm guessing, is in the part in red in my code. I think I need to target the text field in the display list by creating a  reference to it. If so, could someonw point out how I do this, or perhaps a tutorial that would help. I've tried adding the word stage (i.e.,stage.about_tab.text =  substance.about_lbl; ) but it still doesn't connect. I guess there's something really simple I'm missing, so I  apologize if this comes across as a stupid question
    Thanks for any help.

    Hello flashrocket!
    I'm also new to AS3 and I've just started using external classes and I think I know what you should do to put your code to work.
    Instead of using the text field you created inside your flash file, why don't you use the "TextField" class to create an instance of this object? It's the exact same thing as when you create and instantiate a new text field inside Flash.
    First, import flash.text.*; (includes classes like TextField, TextFieldAutoSize, TextFormat, TextFormatAlign, etc)
    Than you just have to create a var like
    public var about_tab : TextField;
    or
    public var about_tab : TextField = new TextField();
    then, to adjust the properties of this tab you use dotsyntax as if it where on your stage like:
    about_tab.x = 50; about_tab.alpha = .5; etc...
    you can even create a function to "config your textField"
              private function createAndConfigTextField() : void {
                   about_tab = new TextField(); //you only need this line if you
              // only typed something like "public var about_tab:TextField;
              // if instead you used "public var about_tab:TextField = new TextField(); outside
              // this function, just skip this first line because you already have an instance of
              // text field named "about_tab"...
                            about_tab.autoSize = TextFieldAutoSize.CENTER;
                   about_tab.background = true;
                   about_tab.border = true;
                   var aboutTextFormat : TextFormat = new TextFormat();
                   format.font = "Arial";
                   format.color = 0x000000;
                   format.size = 11;
                   format.bold = true;
                   format.align = TextFormatAlign.CENTER;
                   about_tab.defaultTextFormat = aboutTextFormat;
                   addChild(about_tab);
    This is just an example of what you can do... I hope you get it... let me know if you have any doubt...

  • How do I clear a form text field during validation using JavaScript?

    I am just learning JavaScript and the Acrobat API.  I have a form created in adobe acrobat 9 standard (starting from an existing form in MS Excel).  There is a text field for a Social Security Number.  I have a custom format script and keystroke script and a custom validation script. I would like to add to the existing validation script, that if what is entered doesn't match the validation test, then clear out the field as in erase all the characters that were typed into the field.  I want this to happen no matter what.  So even if someone filled in a valid SSN number and then moved to the next field, but then went back to the SSN field and decided to change their entry and this new entry was "invalid" then clear out the field (do not revert to what was typed in the field originally, even though it was considered valid by the script).  (There is currently no default value for this field.)  Thank you inadvance for you help on this.
    Here is the current validation script:
    // only run when field not blank
    if (event.value != "")
    // RegExp for validation #########
    var re = /^(\d{3})(\d{2})(\d{4})$/
    if(re.test(event.value) == false)
    app.alert("Enter a 9-digit Social Security number with no spaces or special characters (e.g., 555555555). It will be converted to the format 555-55-5555.")
         //Here is where I've tried adding all of these lines, but none of them will clear out what is in the field
              //this.resetForm([event.target.name]);
              //event.target.value == "";
              //getField("SSN 1").value = getField("SSN 1").defaultValue;
              //getField("SSN 1").value == "";
              //event.rc = false;
    And incase these are somehow affecting it, here are the other scripts being processed on this field:
    Keystroke script:
    var input=event.value;
    var chars=input.length;
    if( event.willCommit || chars==8 )this.getField("Name 1").setFocus();
    Format script:
    var re = /^(\d{3})(\d{2})(\d{4})$/
    if(re.test(event.value) == true)
    // add "-"
    event.value = RegExp.$1 + "-" + RegExp.$2 + "-" + RegExp.$3;

    Thank you very much.  I did try that before, but I was using event.value == "";  I guess in this case I'm assigning the value of "", not making the value equal "".

  • Displaying the value of text field A in text field B

    I have a PDF form with 2 layers. Layer 1 has information, a textfield, and a button. Layer 2 is a certificate design. The user inputs their name in to a textfield called NameEntry.
    When they hit the button, layer 1 disappears -- the instructions and NameEntry box become hidden. Layer 2 is the certificate design and I need a new textfield (which is called NameDisplay) to be populated from inputted information in text field NameEntry.
    The simple answer, I know, is to name both text fields the same. This does not work for me as I need the input textfield to be styled differently (background and border) due to decisions out of my control vs the NameDisplay which will have no background and no border.
    Any ideas? Thanks!

    Use this custom calculation script:
    event.value = this.getField("NameEntry").valueAsString;

Maybe you are looking for

  • Db recovery in a multiprocess environment

    Hi, We have a application consisting of two tomcat servers using Berkeley db and hence the application is simultaneously accessed by two or more(I have a few utilities too) processes. I run one of these instances with primary flag and othe instance a

  • IPhone 6 Trade-In Promotion Code That Works

    Okay, loads of posts about not getting the promotional amount and so on. I am in the same boat EXCEPT I haven't shipped my old iPhone back yet. I have been on the phone with Verizon three times trying to figure out how to get the trade-in page on the

  • Can I store multiple bootable images in the same partition?

    Can I store multiple bootable images in the same partition or do they each need their own partition? I am going to use disk utility to create a copy of my current OSX 10.5 system on a new external drive before upgrading to Snow Leopard. Then I want t

  • KeyStore functionality

    Hi All, Exploring KeyStore functionality to be implemented in File Adapter. As per the info, SOAP , Mail adapters support this functionality. Pls let me know whether the KeyStore functionality can be implemented in File Adapter using EJB or any other

  • Editing in iPhoto app

    Hi, I can't seem to figure out how to get certain edits to stick. I can apply an effect, but then when I tap another icon, for example, to change the exposure or colors, my photo reverts back to the original without the first effect I applied. How ca