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

}

Tags: Adobe Animate

Similar Questions

  • 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 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.

  • How to get event.target/event.currentTarget for HTML 5 canvas for Manager click

    Hello

    I hope that everyone else is doing great.

    I belong to bottom Actionscript and just started on CC Flash HTML 5 Canvas.

    How to get event.target and event.currentTarget in CC Flash for HTML 5 canvas for the click event.
    As we used to do an ACE 3.0

    btn.addEventListener (MouseEvent.CLICK, GB);

    function GB (evt:MouseEvent) {}

    trace ("evt-" + evt.currentTarget); It will let us know the selected target
    }

    For HTML-5

    btn.addEventListener ('click', go.bind (this));

    function GB (evt) {}

    Console.log ("evt-" + evt.? t); What is the correct syntax here?

    }


    Thank you


    Hey guys found the answer to stackoverflow

    It's - evt.target

  • 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

  • I want to know how to use my domain name in BusinessCatalyst

    Please I want to know how to use my domain name in BusinessCatalyst

    Hi, take a look at this video - http://docs.businesscatalyst.com/user-manual#! / site-parametres/site-domaines/ajouter-votre-domaine-a-c.-b. or in this document for more info - http://forums.adobe.com/docs/DOC-1741

  • 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 use Event Viewer to erase the mistakes/Vista

    How to use the event viewer.in performance information a tools / tools... built a lot of mistakes over time... Vista Home Basic to system op.  also it would help to speed up my computer?... can someone help me please...

    Hello

    To add to the good advice of dax1792:

    MyEventViewer can be verified at the time of the EVENT or the blue screen (BSOD) within a second
    then the EVENT or time of the BSOD for more information on the possible cause - see TIP.

    MyEventViewer - free - a simple alternative in the standard Windows Event Viewer.
    TIP - Options - Advanced filter allows you to see a period of time instead of the whole of the record-
    Set it a bit before and after the time of the EVENT or the BSOD.
    http://www.NirSoft.NET/utils/my_event_viewer.html

    This ulilty also lets you clean (remove) one, several or all the logs in Event Viewer. Only
    real reason to remove them would be to make it easier to read all the new events - those recording after
    compensation.

    ------------------------------

    TechNet - observer of events
    http://TechNet.Microsoft.com/en-us/library/cc766042.aspx

    TechNet - clear an event log
    http://TechNet.Microsoft.com/en-us/library/cc722318.aspx

    I hope this helps.
    --------------------------------------------------------------------------------------------
    Rob Brown - Microsoft MVP<- profile="" -="" windows="" and="" devices="" for="" it :="" bicycle="" -="" mark="" twain="" said="" it="">

  • How to use event parameters?

    Hello

    I did simple EEM applet for the shutdown of the port to which cases of storm of device control.

    It's look like this:

    Event Manager applet shut-storm

    control of storm events

    1.0 cli python action local bootflash:shut - storm.py

    and the script is

    Cisco import CLI

    Cisco import cli

    import sys

    import datetime

    time of import

    import re

    whitelist =]

    Ethernet1/1"."

    'Ethernet1/2']

    shlog = CLI ('sh logg last 100 | I ETHPORT-5-STORM_CONTROL_ABOVE_THRESHOLD: last 3', False) .get_output)

    = Pat re.compile (r'(\d {4} \w{3} \d{2} \d\d:\d\d:\d\d) \S+ \%ETHPORT-5-STORM_CONTROL_ABOVE_THRESHOLD: the traffic in the port (Eth\S + |)) (([Pp] o\S +)')

    now = datetime.datetime.now)

    Delta = datetime.timedelta (second = 180)

    for l in shlog:

    mobj = pat.match (l)

    If mobj:

    port = mobj.group (2)

    logTimeStr = mobj.group (1)

    time.strptime = logTimeObj (logTimeStr, "%Y %b %d % H: % m: %S") ")

    logTime = datetime.datetime(*logTimeObj[:6])

    If now logTime<>

    If port not on the white list:

    CLI ("conf t")

    CLI ("interface %s" % port)

    CLI ("shutdown")

    But the python script is a bit complecs because it is located and must find some interfece triggered the newspaper.

    Is it possible to use event parameters? And how?

    I know that they are:

    SW1 # sh event handler det events history

    Time of the event event Event Type slot ID policies

    32 09/30/2013 15:40:51 storm_control active (1) shut-storm

    interface = ' Ethernet1/16', cause = 'storm-control ".

    You should be able to:

    bootflash:shut local python CLI - storm.py $interface $cause

    However, the appeal of scripts Python applets EEM on Nexus is not officially supported, so your mileage may vary.

  • How to use the target FPGA and co. on the same chassis cRIO?

    I have a cRIO system consisting of a master chassis 9074 with several modules IO and EtherCAT 9144 slave unit.

    I want to run a CIE (see: http://zone.ni.com/devzone/cda/epd/p/id/5333) on the chassis of the master, this uses the analytical engine. At the same time I have to do some very urgent measures if I want to use the Board in hybrid mode, using analysis and FPGA engine at the same time (as described here: http://digital.ni.com/public.nsf/allkb/0DB7FEF37C26AF85862575C400531690.)

    But as soon as I add the FPGA target at one of the chassis, the feature of the ice on this chassis stops working. After some research, I found that the CIE can initialize is no longer the modules belonging to the frame that has the target FPGA on it. Error in the method Init of the CIE is: 65700 (indeterminate). This occurs when you try to use "for a more specific class' on the modules configured with a target FPGA on it.

    Someone knows what can cause exactly this problem and perhaps provide a solution/work around?

    Many thanks in advance.

    Hybrid mode requires you to have a bitfile compiled running on the FPGA to be able to read the Scan Interface IO Variables.  Move the target FPGA at the RT target module will allow Interface of scanning for this module, but the frame will always mode Interface of LabVIEW FPGA.

    To get fair access to the scan mode for the frame, right click on the chassis in the project, and choose Properties.  Then, modify the Scan Interface programming.  If you want to continue using the programming of FPGA and the Scan Interface set (hybrid mode), you will need to compile a bitfile (empty if you do not want programs on the FPGA again or containing your FPGA code).  By compiling, the support of the module scan mode for the modules under your RT chassis is compiled in your custom bitfile.  Then, on your VI RT, you need to use reference FPGA VI open to your newly compiled VI.  Once this VI is deployed and ongoing implementation, you get the data from you are the CIE.

    For more information, see this knowledge base article and Reference Interface of Scan CompactRIO and procedures.

  • How to use event FDM (vb) scripts in FDMEE


    Hi all

    In my application, I have a few event using VBA scripts.

    When I copied the same script of old FDM to my new app FDMEE it did not work.

    Please let me know what are the steps I need to do to make the old scripts to work in the new application FDMEE.

    Thank you

    HAPPY.

    It could be that your adapter HFM is not registered correctly.

    I can remember the API from VB FDMEE is saved with the HFM adapter.

    I would recommend the deregistration of the adapter and save it again (example):

    Unsubscribe from the command line-> E:\Oracle\Middleware\EPMSystem11R1\products\FinancialDataQuality\bin\UnregisterHFM.vbs

    Command line registry-> E:\Oracle\Middleware\EPMSystem11R1\products\FinancialDataQuality\bin\RegisterHFM.vbs domain\hfmdcomuser password E:\Oracle\Middleware\user_projects\epmsystem1

    You should get a message like this:

    HFM finished recording adapter

    ...

    FDMEE VB API completed registration

    Also, try to use a VB script in a custom script to ignore the problem is related to the script BefImport to create the object.

  • How to use the root in flash AS2

    I have a clip within the clip, so I have a button, but how to make the button work on my main timeline, I can jump to another party on the main timeline

    You can use:

    _root.gotoAndPlay (); main timeline

    and

    _parent.gotoAndPlay (); parent movieClip

  • Drop-down list - how to use event handler?

    I can't with setting the readonly (via Javascript) in the adjacent text box property to my drop-down list when the index value is a number.

    I tried to use MouseUp and MouseDown OnBlur even... but the readonly does not always get the value true or false,.

    This could be a timing problem? The text box that I am trying to control is the control tab order in the list of controls for this page.

    This same logic works very well in the MouseUp handler for checkboxes. So I was just wondering if it is a bug or should change the my implementation to accommodate drop-down lists? For example, should I move the logic to the handler Enter the text box instead? An own eventhandler of the control set read-only when it is the active form field does

    -Not quite (it comes after the events of mouse, but before the blur event),

    but it should do for your application. The process of the event is complex. You can

    Learn more on this subject in the reference document on the JS API, under event - form

    processing of the event.

    -C' is correct, although it is not a bad idea to do it explicitly anyway.

    Friday, October 24, 2014, at 16:51, syswizardx, [email protected]>

  • How to use events from time?

    I tried to create a function of weather events, but something is wrong, check this out:

    public void randomNPCMove(t:TimerEvent):void

    {

    var NPCMoveDelay:Timer = new Timer (Math.random () * 1000, 1);
    NPCMoveDelay.addEventListener (TimerEvent.TIMER_COMPLETE, randomNPCMove);

    Alert.Show ("I'm alive");

    }

    The previous fold was right in that you will need to call start() on your clock.  You will also need to move your variable timer (NPCMoveDelay) and the creation of timer outside the service.  You're currently declare it as a variable function which will disappear when the function is finished.

    This documentation of timer can be useful, see the examples:

    http://www.flexafterdark.com/docs/ActionScript-timer

    I hope this helps...

    Ben

  • 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!

Maybe you are looking for