Flash CC HTML5 Get instance names on click?

I make escape games and often have lots of items in a scene each with flash instance names that on mouse over or mouse click make some event happen or some text is displayed.
I'm using Flash CC and HTML 5 output and cannot get it to output the instance names in the log, is this not possible? Can anyone suggest an alternative method of responding to lots of movieclips/buttons etc
Here's my test code:-
//stage.enableMouseOver(24);
var clicked = "";
var clickedname = "";
//NEED TO FIND OUT MOVIECLIP INSTANCE NAME??
var key1 = exportRoot.key1
//key1.name = "key1"
//console.log(key1ref.name)
stage.on("click", function (evt) {
    //clickedname = stage.getObjectUnderPoint(evt.stageX, evt.stageY)
    //clicked = evt.target
    clicked = evt.target
    console.log(clicked)
    //output result to log
    /*if (clicked == "key1"){
        console.log("clicked key 1")

Thanks Ned, I really appreciate the help as I've been stuck on this seemingly obvious thing for a few days now and can't progress until I can figure it out...
Basically using currentTarget it outputs this:-
a {id: 24, _matrix: a, _rectangle: a, children: Array[1], canvas: canvas#canvas…}
so comparing it to a name/instance name is not going to work ;-)
using evt.target gets me this:-
lib.key1 {id: 21, _matrix: a, _rectangle: a, image: img, x: -40…}
so again useless, a reference to the key1.png in the library but not to the named instances placed on the stage!!
Am I assigning the instance name correctly??
var key1 = exportRoot.key1
key1.name = "key1"
Any help from anyone appreciated!!

Similar Messages

  • Tween and getting instance names problems

    Hi, iv got these buttons animated using the inbuilt tween
    function and am coding them like this:
    function navOver(e:MouseEvent):void {
    var page = MovieClip(e.currentTarget).buttonThumb;
    var myTween16:Tween = new Tween(page, "y", Regular.easeOut,
    0, -25, 0.35, true);
    function navOut(e:MouseEvent):void {
    var page = MovieClip(e.currentTarget).buttonThumb;
    var myTween17:Tween = new Tween(page, "y", Regular.easeOut,
    -25, 0, 0.35, true);
    function navClick(e:MouseEvent):void {
    var page = MovieClip(e.currentTarget).buttonThumb;
    page.y = 0;
    button.addEventListener(MouseEvent.ROLL_OVER, navOver);
    button.addEventListener(MouseEvent.ROLL_OUT, navOut);
    button.addEventListener(MouseEvent.MOUSE_DOWN, navClick);
    but if i click on the button before the animation has
    finished it ignores the
    page.y = 0; code and does nothing. how can i fix this?
    also im trying to get the instance name of a mc called
    "home" using this code:
    MovieClip(e.currentTarget) wich gives me the result
    [object button_1]
    and
    MovieClip(e.currentTarget).instanceName returns
    undefined
    neather of which are the instance name.
    i cant hardcode the function because its used on lots of
    different mcs throughtout the flash file
    thanks

    if you want to send the 'page' back to the 0 position, you
    might be better off declaring the tweens outside the method, in
    this way you can control them in 'other' methods that aren't local
    to where the assignment is made, for instance:
    var myTween17:Tween;
    then in the handler navOut, just 'assign' the tween:
    myTween17 = new Tween( .. );
    then in the navClick method you could call:
    myTween17.stop();
    myTween17.rewind();
    and that should reset the clips position to 0
    for your other question use:
    MovieClip(e.currentTarget.name);

  • Get instance name help

    Okay, I want to be able to click anywhere and get the
    instance name of any object. The kicker is this actionScript needs
    to be on the main timeline and not on the movieClip. In other
    words, if I have one movieClip on the stage named "my_MC". I want
    to be able to run the movie and when I click on the stage it will
    trace "_level10", but when I click on the first movieClip, it will
    trace its instance name "my_MC".
    I know that:
    this.onMouseDown = function() {
    trace(this);
    will give me the instance name of the stage or "_level10",
    but how do I make it identify the movieClip I'm clicking on without
    putting any script on the movieClip itself?

    You need to do something like this, since the generic parameters don't exist at runtime.
    public M createMInstance(Class <? extends M> clazz) {
      return clazz.newInstance();
    }I'm not very well versed in generics, so you may have to tweak it a bit, but the main idea is that you have to provide the Class object.

  • How to get instance name

    I was wondering if there was any way to get the instance name
    of the class to the class without having to pass it in when you
    create the instance of it. For example, so I can do this:
    var myObject:CustomClass = new CustomClass();
    and then the class knows whats its instance name being used
    is instead of having to do something like this:
    var myObject:CustomClass = new
    CustomClass("myObject");

    As I think I found out how to gnerate unique key form components passed to my method and afterwards be able to get this key by knowing the component.My code is following:
    public static String generateUniqueKey(Component c){
    String resultString="";
    String s = c.getAccessibleContext().getAccessibleComponent().toString();
    StringBuffer stringbuffer = new StringBuffer(s);
    if(!Character.isJavaIdentifierStart(stringbuffer.charAt(0))){
    resultString="a_";
    }else{
    resultString=resultString+stringbuffer.charAt(0);
    for(int j = 1; j < s.length(); j++){
    if(!Character.isJavaIdentifierPart(stringbuffer.charAt(j))){
    resultString=resultString+"_";
    }else{
    if (stringbuffer.charAt(j)=='$'){
    resultString=resultString+"s_";
    }else{
    resultString=resultString+stringbuffer.charAt(j);
    return resultString;
    Any suggestions on this. May this result in problems anywhere?
    Thanks

  • Powershell to get instance name

    Hi,
    Not sure whether this is the forum to ask.I have a list of servers names and i need to get the instance names in below format.
    SERVERNAME\INSTANCE1
    The o/p of the script actually shows Servername,MSSQL$Instance name..Anyway to tweak this to SERVERNAME\INSTANCE1?
    $servers = get-content "C:\SQLCheck\machinelist.txt"
    $logfile = "C:\SQLCheck\sql-instances.txt"
    $logerrs = "C:\SQLCheck\sql-failures.txt"
    Echo "Server, Instance" >> $logfile
    ForEach ($server in $servers) {
    $instances = Get-WmiObject -ComputerName $server win32_service | where {$_.name -like "MSSQL*"}
    if (!$?) {
    Echo "$server - No SQL instance found" >> $logerrs
    Echo "$server - No SQL instance found"
    Else {
    ForEach ($instance in $instances) {
    if (($instance.name -eq "MSSQLSERVER") -or ($instance.name -like "MSSQL$*")) {
    Echo "$server\$instance.name" >> $logfile
    Echo "$server, $($instance.name)"
    Best Regards, Arun http://whynotsql.blogspot.com/

    Hi,
    Use the sqlcmd -L command:
    $SqlCmd = "sqlcmd -L "
    Invoke-Expression $SqlCmd
    sqlcmd Utility
    http://technet.microsoft.com/en-us/library/ms162773.aspx
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Get instance name

    Hello
    Is there any dynamic way to obtain an object's instance (variable) name?
    For example:
    Object myObject = new Object();
    System.out.println( "The object's name is: " + someMethod() );
    And the output would be:
    The object's name is: myObject
    Thanks in advance.

    Even if it were possible...import  java.lang.reflect.*;import java.util.*;
    public class VariableNames {
    static Object obj = new Object();
    static Object obj2 = obj;
    static Object obj3 = obj2; //-- a single Object referred to by 3 variables
    public static void main (String[] args) {
    System.out.println(getTheNamesOfTheVariablesThatReferToThisObject(obj3));
    //-- it has to print the list {obj, obj2, obj3}.
    public static List getTheNamesOfTheVariablesThatReferToThisObject (Object obj) {
    List varnames = new ArrayList();
    Class clazz = VariableNames.class;
    Field[] fields = clazz.getDeclaredFields();
    for (int index=0, length=fields.length; index<length; index++) {
    try {
    if (fields[index].get(null) == obj) {
    varnames.add(fields[index].getName());
    } catch (IllegalAccessException e) {
    // ignore
    return varnames;
    }Of course, if you tell us why you would want to do this, then there is probably a better solution (except for some types of constriant programming, where it can be justified) Pete

  • Flash CS4 - Slide presentation - instance name question

    Is it possible to rename slides dynamically in a Flash presentation that is created using the Flash Slide Presentation template in Flash CS4. So, if I have a presentation with 50 slides and they are named 001 to 050 and I need to insert a slide between slide 010 and 011 is there a way to have Flash renumber them or do I have to just manually rename.

    You might do better to use an array to manage the ordering of things--storing references to the slides in the array.  That way you don't have to be chasing names to make them follow some scheme.  You can still use names to help define where things go brain-wise, but having them listed in an array allows you to slip in new things without having to rename anything... just use the array/index to target the objects rather than the actual names.

  • Reference a movieclip by a variable containing its instance name?

    There are some movie clip instances on the stage (not
    dynamically created at run time). Now, I want to do this:
    use a variable to hold a instance name at runtime. then use
    this variable to reference the movie clip it points to.
    Problem: suppose this variable is named "mc_ref". it fails to
    use "_root.mc_ref" to refer to the movie clip by the name that
    mc_ref contains. it seems in this case flash takes "mc_ref" as
    instance name and thus looks for any child by that name. since
    mc_ref itself is not a name, this will not work.
    is there something like MovieClipbyInstanceName function for
    this? Any thoughts? Thanks!

    you're confused. the variable's name and the movieclip's name
    should not be the same.
    the following are correct ways to reference movieclips in
    flash:

  • Giving things instance names. Flash cs4

    Ive been using adobe flash cs4 for a while now and have had little trouble giving things instance names. Now though, whenever i double click on something like i normally do to give it an instance name, the blue box no longer comes around it, i click on properties, and change the instance name. I now get a dashed line along the lines of the picture. and when i go to properties, it just says shape, and I cant edit the instance name. Just position and size, then the fill and stroke.  What is going on?

    You do not assign instance names to objects in the library.  Instance names are assigned to object on the stage.  Instance names are unique for each item on the stage.... meaning the same library object can be used multiple times... each instance of it will have a different name.  If you want to assign a name you do it either by manually entering it in the properties panel or thru actionscript code when the object is added to the movie.

  • ? Derive a clicked button's 'level' and instance  name?

    I am trying to do something that I did quite often in Flash.
    When a button is clicked, I need to understand it's instance name
    and heirarchy as the application would identify it when looping
    through the DisplayList.
    For example, if a button, 'myButton', is clicked on in the
    application ' myApp', I need to get its programatic name as
    referenced by the application with 'myApp0.myButton'.
    In Flash, with AS2, I could have the button tell me its
    programatic name with:
    myButton.onRelease=function(){
    trace(this);
    The result in Flash would be '_level0.myButton';
    How can I get this type of informtion with Flex? Is it
    different with MXML and AS3?
    For reference, I am using a similar function to that below to
    'index' the list of objects in Application.application:
    function traceDisplayList(container:DisplayObjectContainer,
    indentString:String = ""):void {
    var child:DisplayObject;
    for (var i:uint=0; i < container.numChildren; i++) {
    child = container.getChildAt(i);
    trace (indentString, child, child.name);
    if (container.getChildAt(i) is DisplayObjectContainer) {
    traceDisplayList(DisplayObjectContainer(child), indentString
    + " ")
    Any information and examples would be appreciated.
    Thank you.

    Ok, I found a partial solution, but I could still use some
    help with event listeners. The solution I found is:
    Within Flex, on a button click, the application can list the
    click target when an event is called. So, when a user clicks a
    button, in the 'click' action of the button, the following code
    will return the object information I was looking for.
    <mx:Button label="myButton"
    click="trace(event.currentTarget)"/>
    Now I am interested in seeing if I can dynamically "listen"
    for clicks without adding an event command to the buttons. For
    instance, on the button above, I can have the button tell me its
    name, as shown above, or I could listen for the click and derive
    it. For example:
    <mx:Button label="myButton"
    click="trace(event.currentTarget); sayName(event)"/>
    Then I can have AS code listening for that event:
    private function sayName(event:MouseEvent):void {
    trace(event.currentTarget);
    The problem with the listener solution 'sayName', is that it
    requires a button to pass the event to 'sayName()'. I am really
    looking for a solution which listens for ANY button click, checks
    to see if it is a button, or a text link, or any object that might
    act as a button (as opposed to a graphic or movie without 'semantic
    events' with the application performing a resulting action).
    So this is what I have tried:
    In an AS Class, I added the following to the main class
    function to initialize it:
    addEventListener(MouseEvent.CLICK, clickHandler);
    addEventListener(MouseEvent.DOUBLE_CLICK,
    doubleClickHandler);
    Then, within the class I added the following functions:
    //possible event listeners?
    private function clickHandler(event:MouseEvent):void{
    var tempES:String = "type : "+event.type+" objectName :
    "+event.currentTarget;
    trace(tempES);
    private function doubleClickHandler(event:MouseEvent):void{
    var tempES:String = "type : "+event.type+" objectName :
    "+event.currentTarget;
    trace(tempES);
    I get nothing. I suspect that I get no results because the
    Application has the buttons and these listeners are not referencing
    the application properly to listen for button clicks.
    Am I off base? Can anyone help me understand how to listen
    for click activity and get the object information even though the
    listener code is in an imported class?
    Thank you

  • Stored procedure for getting host name, host instance and status of that host is it running or stopped.

    Hello all,
    yesterday I got one task in that I have to stored procedure for getting host name, host instance and status of that host is it running or stopped.
    any body knows where exactly, In which table this details are there in BizTalk databases.
    thanks

    Status of the host instance is not stored in the SQL database for you to query the status using stored procedure. You have to either use Powershell or WMI to get the status.
    In SQL, following table contains the details about the host like Name, LoginName, IsDisables etc but status of the host instance is not stored in the database.
    SELECT * FROM BizTalkMgmtDb..adm_HostInstance
    Powershell to get the status:
    http://axonolympus.nl/?page_id=186&post_id=969&cat_id=6&lang=en
    WMI to get the status:
    https://msdn.microsoft.com/en-us/library/aa561820.aspx?f=255&MSPPError=-2147217396
    https://msdn.microsoft.com/en-us/library/aa578621.aspx
    Regards,
    M.R.Ashwin Prabhu
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • General Question About common Instance Names in Flash CS4 (AS3)

    I tried something interesting recently. I had code effecting an object with the instance name : object_mc.
    Now I added another object and gave it the same instance name.
    The result was, that the code only effected the most recent added object (no error).
    Is there a way in flash to have multiple objects with the same instance name all being affected by one piece of code?
    ~ Thanks for any thoughts, advice or facts. ~

    Advice: avoid it... if you want to control different instances, give them different instance names.
    It depends on what you mean by "one piece of code".  Directly using the instance name to target the movieclips will work as you have seen already... Last one added gets the attention.
    To use the instance name to take action is doable more along the lines of testing each movie to see if it has the name, but still, you would have to target each using a different means. 
    For the piece of code below I have some number of objects on the stage and I test to see if they have an instance name assigned (object_mc) that is shared by some of them, and I am able to move them if they do, but I cannot use the instance name to target each of them for action... in this case I use the getChildAt method.
    for(var i=0; i<this.numChildren; i++){
    if(this.getChildAt(i).name == "object_mc"){
      this.getChildAt(i).x += 200;
      object_mc.x += 25;  // only moves the last object added

  • Flash actions and instance names

    Hi, i'm after some advise on how to navigate around the timeline using buttons. I know this sounds simple but i'm running into some daft problems.
    I've added a single instance for a button called 'button' which appears on multiple keyframes. This button only appears once per keyframe but some of the actions are getting mixed up. I know that i can create multiple instances to get around this but in principle i cant see why having one action attached to one instance per keyframe would cause an issue regardless of that fact i have the same instance appear on multiple keyframes. Should flash be behaving like this?
    Andy

    Hi Ned, what i have is a layer called actions that hosts a number of actionscripts with a keyframe for each script. To save time i usually create the first frame using unique instance names and then i simply copy and paste them into subsequent keyframes. So each KEYFRAME has unique instances. I thought that by doing this i would save time by not having to re-name or reposition each instance that appears on my timeline -  this would take a long time not to mention the complications it would cause should i decide to shuffle a few frames about later on. For the majority of the time everything works just fine but occasionally the timeline will jump to somewhere totally unexpected. the problem is compounded by the fact that many of these buttons control video playback, so you can imagine the mess this is causing.
    If what i'm doing is bad practice then i'll happily do it the right way by naming each instance but i'm still struggling to see why actions are getting mixed up when they run on their own keyframe.

  • How to get audio to play on Ipad using flash cc html5 canvas

    I'm using flash cc html5 project type. I built my project and tested on desktop and it works fine. Once test on ipad it does not play the audio. It works on android  devices but not my ipad 4. I'm using Mp3 files in my flash project.
    I tried the safari & Chrome on my Ipad neither played the audio in my file.
    Links to my files.
    http://dev.wisc-online.com/prototypes/TestJosh/cis3405_html5.html
    http://dev.wisc-online.com/prototypes/TestJosh/cis3405_html5.js

    Thanks I read through that. I still cant determine what exacty my issue is.
    Is it audio must be played only on a click handler?
    Is it that i must install quick tiem on my ipad?
    So i have to modify code that flash outputs for me to get audio to play on an Ipad? That doesnt seem correct? It should just function.

  • How to get DB Instance name

    Hi ,
    I have build a solutuon to send email invoce using BIP.
    I want to prefix the DB instance name in email Subject on development/test instances.
    Please suggest me how to get the DB name in BI publisher bursting control file.
    <xapi:message id="1" to="${TO_EMAIL_ID}" attachment="true" content-type="html/text" subject="$
    for exmaple: I have email with
    subject: 74444555 - Invoice(20071429) notification
    on my development box icprj01 I need email subject like
    subject: ICPRJ01 74444555 - Invoice(20071429) notification
    Thanks
    Kumar

    Can't do it in bursting. You will need to pull the db name for sql in a data template or reports6i. Sorry :-(

Maybe you are looking for

  • Mini does not appear on desktop or in Itunes

    This problem happened suddenly. I plug in my mini, as usual, and no icon appears either on the desktop or in Itunes. I have tried four of the five Rs (can't restore without mini showing up in itunes), and have searched the discussions for some soluti

  • Quicktime 7.1.3 wont install, iTunes wont work.

    When ever I start iTunes,first of all it never opens up but a error comes up saying.... "QuickTime version 7.0d0 is installed, iTunes requires QuickTime Version 7.1.3 or later. Please Reinstall iTunes" So I reinstall iTunes, I have done this about 4

  • How do I save and manipulate an attached document through gmail?

    How do I save and manipulate an attached document through gmail on my iPhone?

  • Template and child pages do not match

    Hi, there are several issues here and I'm pretty sure they're linked so I'll tell you them all. I was recently editing my website and I was changing the title of a page a created. I noticed that after I changed the name, when I clicked off it it just

  • Changing the Device Name

    My daughter gave me her old nano. When I plug it in to my computer, it says the device is "Karens ipod". It has her songs on the ipod. How do I get this Ipod to say "Puhs idpod" and to get rid of her name?