Helps the event.target.name

I'm very green with actionscript and coding in general so please forgive me if I ask you something that sounds super easy.

Is it possible to take the "event.target.name" value, which in my case would be something like 'SW5005_mc' and change this value.

I use this value now to tell another clip of gotoAndStop (event.target.name); I have identical to the event.target.name marked images.

I would like to take the value of event.target.name for example "SW5005_mc" and delete the "_mc" and put a dash between the 'SW' and the '5005.

for "SW-5005" and then I'd spend it in a text field.

I don't really know where to start, or if this is possible.

Thanks for any help or suggestion,

Chris

You can use String.indexOf to find the _ and just get everything entered, then use substr and substring for the rest:

var a: String = event.target.name;
var b:String = a.substring (0, a.indexOf ("_")); get the front part of the _
var c:String = b.substr (0.2) + "-" + b.substr (2); Insert a - between the first two characters and the rest
trace (c);

SW-5005

Tags: Adobe Animate

Similar Questions

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

    ... I hope that the question of the title makes sense...

    On my stage, I have an external SWF loaded with a button. When you click the button dispatches the main event scene.

    On the main stage a listener can load a SWF it in a magazine called Gallery.

    The charger of the Gallery is also shared by the buttons on the main stage, who use the event.target.name chain to appeal to sovereign wealth funds with corresponding names.

    I use tweens to fade and, in the content of the Gallery when a key is pressed.

    --

    Loading of the FSV worked until I tried to create a universal function for the dispatchEvent buttons...

    The problem I have is that I don't know how to set the string to indicate to the newSWFRequest where the SWF file when triggered by external buttons.

    (I maybe do this wrong... but thought that the best way to load a SWF on the main stage from an external SWF was using dispatchEvent?)

    My code raises the event and the charger of the Gallery Faints, but then it does not find the new SWF:

    Error #2044: Unmanaged by the IOErrorEvent:. Text = Error #2035: URL not found.

    Please can someone help me understand how to make the point in the chain in the right direction? (I think that the errors only are in bold below)

    Code:

    var myTweenIn2:Tween;

    var myTweenOut2:Tween;

    var nextLoadS2:String;

    Listening external inclinometer shipped external event

    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);

    }

    Function universal BTNS

    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.

    If this code is on the timeline of a child of the main timeline of your external swf add parent 3rd in two lines with parent.parent.

  • instances of addChild does not recognize event.target.name?

    I have a button that has been added to the stage using addChild when the page load, the button is supposed to be removed using removeChild and redirect in its specific page using event.target.name... somehow, I got this error:

    Error #2044: Unmanaged by the IOErrorEvent:. Text = Error #2035: URL not found.

    I try to replace this line.

    var newswf:URLRequest = new URLRequest (".") ("/ swf /" + event.target.name + ".swf");

    with that,.

    var newswf:URLRequest = new URLRequest("./swfs/about.swf");

    and everything works fine, but I don't want that since I want to dynamically load and use less code... is there a solution to do this, thanks for the help

    my code as below:

    //////////////////////////////////////////////////////////

    var subject: About = new About().

    about.x = 300;

    about.y = 200;

    addChild (about);

    function btnClick2(event:MouseEvent):void {}

    removeChild (about);

    removeChild (loader);

    var newswf:URLRequest = new URLRequest (".") ("/ swf /" + event.target.name + ".swf");

    Loader.Load (newswf);

    Loader.x = XPos;

    Loader.y = YPos;

    addChild (loader);

    SoundMixer.stopAll ();

    to stop all the background sound when click

    }

    about.addEventListener (MouseEvent.CLICK, btnClick2);

    //////////////////////////////////////////////////////////////////////////

    I missed the part where you create dynamically on the Forum...  You must assign a name because the name property is not the same as the var with that you instantiated...

    var subject: About = new About().

    about. Name = "a connection";

  • How to use event.target.name in AS2?

    Thanks kglad, I could see how event.target.name in AS3 could make a button to load a movieclip with the same name.

    I do the same thing now in AS2, but don't know what to write instead of event.target.name.

    And so, at the present time, each button push information in a table and then a function that uses to decide what movieclip to tie to a holder after that he faded once and then fades new...

    BEGINNING OF THE GALLERY OF IMAGES *.
    Add images to the holder
    imgholder.attachMovie ("img0", "image0_0", 1).

    Table
    var nextLoad = ['img0'];

    Listeners of BTN
    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 function of btn
    function btnClick() {}
    trace ('click');
    var myImgTween:Object = new Tween (imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true ");
    myImgTween.onMotionFinished = function() {}
    fadeOutImg();
    }
    }

    The function part of II btn
    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 in the table, but I meet to use a string... I don't know that my code is heavy! But it works. I tried to push as the name of the button but it end by including the reference to full step.
    Is there a cleaner way to do this using event.target.name?
    Thanks for the research!

    There is no event.target in AS2. However since AS2 has no way to remember the scope object where the target object, you can use this to your advantage to get the name of the target using the command 'that' in the function when you use the format above "mc.onPress = myfunc". FYI, the delegate popular workaround solution, enabled when you called 'this' in the function, you can retrieve the scope object where the target instance. So without her help, "this" will return the name of the target object. In any case, this is the code that 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 function of btn

    function btnClick() {}

    trace ("Click");

    var myImgTween:Object = new Tween (imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true ");

    myImgTween.onMotionFinished = function() {}

    fadeOutImg();

    }

    }

    The function part of II btn

    function fadeOutImg() {}

    trace ("fadeOutImg");

    imgholder.attachMovie(nextLoad,"image1_1",1);

    var myImgTween:Object = new Tween (imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true ");

    }

  • How to check the event.target type in the "if" statement

    Hi, I have "roll-over" event listener and I wish that only works with music videos (without textfields etc.). I would write something like this:

    if(Event.Target == MovieClip) {do something}

    else {do something}

    This does not work properly.

    How to check the event.target type in the "if"?

    Thanks for any help.

    :

    If (getQualifiedClassName (Event.Target) == 'flash. display::MovieClip') {do something}

    else {do something}

    .

  • Pages.gotoAndStop (event.target.name);

    I followed this tutorial

    http://www.YouTube.com/watch?v=AhsSQGcm46E

    I make a Web site with buttons but when I test the scene it scrolls and loops of each content page.

    This is the code I have for action script


    var myMenuArray = [which, video, photography, Web design];
    for each {(var btn in myMenuArray)

    btn.addEventListener (MouseEvent.CLICK, onBtnClick);

    }
    function onBtnClick(event:MouseEvent):void {}


    Pages.gotoAndStop (event.target.name);
    }

    When I test the scene, he said.

    1061: call to a Stop method maybe not defined through a reference with static type fl.motion:AnimatorFactory.

    Any ideas?

    The error would give the impression that Pages is not an object with a timeline

  • How to get the event target?

    I recorded the event mask depending on:

    App.notifiers.Add ("Hd",.. mpfprojectdir\dev10\src\csharp\projectbase.file path);

    Now, how can he obtain the object that triggered the event?  [app.active document.activeLayer] give me only the layer ".  Of course, this does not work in a scenario where the user hides a layer that is not selected.

    I'd appreciate any help!

    Action handler has no direct access to objects in the object model. It has its own class and object. Sometimes, there may be a more direct access by name. If the event descriptor was the index of the layer or the ID you can use instead of the name.

    Sorry, when I threw together for you I only tested hidding layers that do not have the activeLayer. I don't think that the alert is empty is because the top layer was hidden. I think it's because the activeLayer was hidden so the actionReference is different.

    Try this (which seems to work for me with both)

    try {
        if (arguments.length >= 2) {
        var desc = arguments[0];
        var event = arguments[1];
        // make sure it's the hide event
        if (event == charIDToTypeID('Hd  ')) {
            // get the list of what was hidden
            var list = desc.getList(charIDToTypeID('null'));
            // get the actionReferences from the list
            var ref = list.getReference(0);
            var psClass = ref.getDesiredClass();
            // make sure it was a layer that was hidded
            if(psClass == charIDToTypeID('Lyr ')){
                // check to see what is in the reference
                var dataEnum = ref.getForm();
                // should either be an enum if activeLayer
                if(dataEnum == ReferenceFormType.ENUMERATED) {
                        alert(app.activeDocument.activeLayer.name);
                }else{// or the layer name
                    alert(ref.getName());
                }
            }
        }
      }
    } catch (e) {
      alert( "Error: " + e + ":" + e.line );
    }
    
  • Can I drag the event target source drag?

    I have adds drag and drop features of a tree control on a VI at several targets of slipping on different VI.  For example, they can drag the tree for a XY Chart on another VI, a table to an another VI, a digital indicator on an another VI, etc...  In addition, when they abandon the data, I need to know where he left it down and initiate an action from the drag source (tree control) VI.

    My problem is, I see no way to determine what VI and control the move action took place the.  I'm basically looking to the control reference of the operation drag and drop target once the drop event occurs.

    I know that I should add a few cases of event for all the different targets, but I try to keep the minimal code and keep most of the complexity of the VI with the source.  If I have, I will use some sort of a global or the driving force to write an identifier of the target VI to a place where the source VI can be read, but I'd rather not do that in many places so I don't have to.

    Create your own event type user 'Control' and save it in the same diagram as source Tree. On the event of filter "Drag start?" of the source tree, inject this event Ref use in drag data (it will take be flattened). Then, in the 'Drop' unflatten handler this Ref user event and send event user with the value of the event data "Ref" of this event handler 'drop '. It is a form of a callback function, which is much more reliable than a global engine or action that exposes the risks of racing conditions.

  • The event log name: Application indicates problem with logon user account. How to fix?

    I am getting this caveat in my event log when I try (and fail) to connect to my guest user account. What security settings and/or part needs to be changed and replaced by what?

    Log name: Application
    Source: Microsoft-Windows-user profiles general
    Date: 23/04/2012 14:58:30
    Event ID: 1509
    Task category: no
    Level: WARNING
    Keywords:
    User: PeaVM4jic\Guest
    Computer: PeaVM4jic
    Description:
    Windows cannot copy file \\?\C:\Users\Default\AppData\Local\Microsoft\Windows\Temporary Internet Files\SQM\iesqmdata_setup0.sqm to the \\?\C:\Users\TEMP\AppData\Local\Microsoft\Windows\Temporary Internet Files\SQM\iesqmdata_setup0.sqm location. This error can be caused by network problems or insufficient security rights.

    DETAIL - access is denied.

    The event XML:
    http://schemas.Microsoft.com/win/2004/08/events/event">
     
       
        1509
        0
        3
        0
        0
        0 x 8000000000000000
       
        42220
       
       
        Application
        PeaVM4jic
       
     

     
        \\?\C:\Users\Default\AppData\Local\Microsoft\Windows\Temporary Internet Files\SQM\iesqmdata_setup0.sqm
        \\?\C:\Users\TEMP\AppData\Local\Microsoft\Windows\Temporary Internet Files\SQM\iesqmdata_setup0.sqm
        Access is denied.

     

    Later today

    The first sign of distress in my event log has been 01/04/12

    1515 error: "Windows has backed up this user's profile. Windows will automatically try to use the backup profile the next time that the user logs. »

    and 1511 error: "Windows cannot find the local profile and connects you with a temporary profile." Changes to this profile will be lost when you close the session. »

    What brought this?

    During this time, I was getting a rash of warnings of 1530 open handle.

    During my attempts to fix my account, I get the occasional errors of 1533: 'Windows cannot delete the directory [account]. This error can be caused by files in this directory that is used by another program.  DETAIL - the directory is not empty. »

    Are these signs of malware activity?

    There was also warnings of failure to notify events profile 1534, which could explain why I had no warning of this problem. These imply that the user profile Service does not work properly?

    I appreciate really all the efforts that you and others have invested in this. Thanks to you all.

    I was faced with two similar topics at the same time. The poster in this other thread seems to have solved his problem by the roundabout way to impose a UAC challenge. Maybe it will work for you also.
    Here are the steps:
    1. Create a new admin account.
    2. Log in under a non-administrator account.
    3. Try running msconfig.exe. You will face a challenge of UAC.
    4. Use the newly created admin account to respond to the challenge.
      This process will create the registry key and the profile for the admin account folder.
    5. Open a session under the new admin account. It should work.
    6. Downgrade the new admin account if you wish.
    Please let me know if it works!
  • Regex help - the analysis of names

    I get the names of another system, and I need assistance, the analysis of the data that it is. There are errors of common input of the other system I want to correct that data are imported. I am formulating a regular expression to find and replace the common mistakes.

    Example 1: A folder with the family name "DE ROSA" is imported. Note that there are two spaces between "FROM" and "ROSA". I want to delete extra spaces. This one is more simple.

    Example 2: A file with the family name "DE ROSA - LA CRUZ" is imported. It's the same problem, but now there are two places where it should be fixed.

    Example 3: A folder with the name "LYNDE - ROSA" is imported. I would like to correct extra spaces in "DE ROSA", but not touch Lynde, which also contains 'FROM' at the end.

    I can't create a regular expression that finds all the scenarios that I need without including the results I want. These are the rules, I need:

    1. find the expression 'FROM' as a phrase with one or more spaces after him.
    2. the item preceding the "OF" must be nothing (the beginning of the line) or a character that is not a - z or A - Z.

    It sounds simple enough, but my expression either don't get "FROM" at the beginning of the string, or they catch the 'OF' at the end of a family name. The names are converted to uppercase simplified procession.

    Any help would be greatly appreciated. I tried to explain this with the simplest possible examples, but I can provide more information if it would help.

    You seem to need "negative look behind" are looking for which is not an alpha. Check the Javadoc for model.

  • Helps the event Felx.IDEL

    Hi people,

    I am a beginner in Flex and I used an example on Flex.IDLE event of
    http://inflagrantedelicto.memoryspiral. ... nt-page 1.
    to log out a user after a specific interval inactive.

    What happens with me is

    1. when the window is minimized, this event does not occur.
    2. when some flash content are run in the same or different, browser event fires sometimes and sometimes not.

    Can someone help me to understand why this is happening and how I can solve this problem. Please help me.

    Thanks in advance.
    Kind regards

    When you add the linstener of the IDLE event?

    I did an experiment: If you put the code "systemManger.addEventLinster(FlexEvent.IDLE,handler)" after the addToStage event has been sent in application, which works well

  • HP QuickTouch on-screen ceased to working__name the problem of the event: APPCRASH__application name: HPKBDAPP.exe

    So yes this message after my Win Vista Monte starts
    and of course I can't listen to anything on my computer
    which is a Compaq Presario V3617LA

    I tried to update my software to the most recent HP available as I saw
    that solved the problem on two other Questions posted on the site
    descrbing the same mistake with the application "HPKBDAPP.exe".
    and after the power cycle that have really nothing = /.

    In any case, any suggestions would be greatly appreciated
    and thanks for taking the time to check my questions.

    PS, I saw a position similar to mine, but my pc do not disconnect or restart itself
    It works perfectly fine, except for the part audio lol :)

    Hi dyo89,

    Welcome to the Microsoft Answers site!

    Thus, even after the update of your hp quicktouch software, you still get the error message at startup and there is no sound on the computer.

    I suggest you perform a clean boot

    Clean boot uses a minimal set of drivers and startup programs and helps eliminate software conflicts.

    1. click on start. In the start search, type in msconfig and press ENTER.
    2. on the Services tab, select hide all Microsoft Services.
    3. on the Startup tab, click Disable all, and then click Ok.
    4. If you are prompted to restart the computer, click Restart now.

    When the computer is in a clean boot, applications and third-party services are disabled. Once the computer is restarted, check if the problem occurs right now.

    Check out this link that talks about How to perform a clean boot

    Note: Follow all the steps in the link to find out what software are contradictory.

    http://support.Microsoft.com/kb/929135

    Don't forget to reset the computer in a Normal startup once find you what software is conflicting.

    If this is any help, I suggest you to uninstall and reinstall the HP QuickTouch software.

    Note: Follow the instructions provided with your computer Setup to perform the step above

    Let me know if it worked.

    Kind regards

    Karena R - Microsoft Support
    _____________________________________________________________________________________________________________________

    Visit our Microsoft answers feedback Forum and let us know what you think

  • By the way the target name of the event to the text field

    Hello

    I'm new to 3.0 and can use some help here... should be easy for you, experts...
    I just need to target an event 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 also tried:
    target_txt. Text = event.target;
    but no luck so far...

    Any help would be much appreciated.
    See you soon...

    Bruno Aun
    Flash + Coldfusion Developer
    http://www.BrunoAun.com

    It's true...

    target_txt. Text = String (event.target .name);

    works like a charm.
    Thank you!

  • testbox. Optimization of event.target listener and event name

    Is it possible to get the name of a TextBox of event.target?

    stage.addEventListener (MouseEvent.MOUSE_DOWN, clickHandler);

    function clickHandler(e:Event):void {}

    trace (e.Target.Name);

    }

    out to click on a text box is

    instance1111

    I am creating a clickHandler which takes care of everything by checking the name of which was clicked on instead of adding individual headphones to each object.

    (added)

    Another solution that I thought would be to separate the text and turn it into an object, but I prefer not to do that if it can be helped.

    (question 2)

    I worked on a menu, when you click on something it becomes visible and adds / removes event listeners to each button you change your location.

    Switching between menus causes a noticeable pause, which made me think to spend the 1 Manager of.

    Is there a reason to not just leave the active event listeners?  Even better if I can get the above responded and have 1 single active listener to the menu instead of 30.

    In order to get the name of the event.target text box you need

    Event.Target.parent.parent.Name

    A text box consists of 2 subobjects.

    (added)
    Your comment about having children made me put 2 and 2 together.  Initially, I tried e.target and she came back with TextLine, didn't think about it being a "child" until your comment.

    trace (e.Target); TextLine

    trace (e.Target.parent); Sprite

    trace (e.Target.parent.parent); TLFTextField

  • Where is the 'show source/target name' in 3.0?

    3.0 lost 1 great feature...

    He was named 'show the source/target name' under Tools, preferences, then diagram, logical model.

    I have an option to display the names of relationship in the schema. The anterior approach (small box next to the arrow) was beautiful, IMHO.

    Reference:
    the webcast of data Modeler #1, 00:20:19 time!
    http://img801.imageshack.us/img801/135/20110307111852007.jpg

    Published by: user8261183 on March 7, 2011 02:18

    Hello

    The functionality is not lost.
    'Show stream Name', 'Show the relationship name' and "Display the name of FK" withdrew from preferences.
    Instead, "Show labels" option is added in right click menu of the corresponding to the diagram.

    Concerning

Maybe you are looking for