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.
Similar Messages
-
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!! -
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 -
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
thanksif 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); -
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 -
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.
thanksStatus 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. -
Get server instance name without deploying weblogic.jar to client
I use wlclient.jar with my client. Using weblogic.jar instead causes the
size of the deployment package of my client to go from 4 meg to 34 meg
(roughly). I don't want full MBean functionality, all I want to do is find
out what the server instance name is. Surely there's a way to do this.Hi,
Weblogic provides you a way to create client jar files so that the complete weblogic.jar
doesn't need to be downloaded to the client. The tool is called verboseToZip.
See
http://e-docs.bea.com/wls/docs70/adminguide/utils.html#1117405
hope this helps, pat
"BEA" <[email protected]> wrote:
I am trying to deploy my client application on a standalone windows machine
and do not wish to deploy weblogic.jar with the client deployment. Is
there
any way of allowing my clients to use Weblogic JNDI without having to
deploy
weblogic.jndi.WLInitialContextFactory.class (and its associated classes.
I find it hard to believe that everyone who is developing on weblogic
distributes this JAR file to their customers with their client
applications....?
Can you use something other than weblogic.jndi.WLInitialContextFactory
such
as the sun jndi provider instead....?
If anyone can shed some light on this deployment problem it would be
much
appreciated.....even if its simply 'thats just the way you have to do
it
!......will save me time trying to get other solutions to work...!
TIA -
How to get Host name and SQL Instance Name by T-SQL
I am using SQL 2000, 2005 and 2008. I have few multi instances SQL servers. I would like to gather following information:
Host Name
SQL Instance Name
SQL Version
Server1
Server1
SQL 2000
Server1
Server1\ABC
SQL 2005
Server1
Server1\XYZ
SQL 2008
Server2
Server2
SQL 2008
Is there any way I can get it by T-SQL? Any help would be appreciated.
Thanks
SaumenSELECT
SERVERPROPERTY('MachineName') AS [ServerName],
SERVERPROPERTY('ServerName') AS [ServerInstanceName],
SERVERPROPERTY('InstanceName') AS [Instance],
SERVERPROPERTY('Edition') AS [Edition],
SERVERPROPERTY('ProductVersion') AS [ProductVersion],
Left(@@Version, Charindex('-', @@version) - 2) As VersionName
|
Blog: MSBICOE.com |
MCITP - BI, SQL Developer & DBA
Hate to mislead others, if I'm wrong slap me. Thanks! -
Get All instance names in the stage
hi,
is there any way to get all instance name of the objects presents on the stage ? trace them for example
thank youthank you, it's the correct answer but i still can't solve my problem ,
the thing is that am using a code from http://www.freeactionscript.com that make enemie follow the player, but i need to do some modification, i need to detect collision between enemies so they will not get the one into the other and the thing that i cannot found their instance name, even when i used your function i only get "player_mc : _level0.player_mc" at the output,
here is the code, i will be really greatful if you can find a way to help me solve this problem .
ps :
am trying to write my own code that make enemie follow the player, coz this one looks very complicated
thank you
the code :
* Game Enemy AI Behavior - Run Away & Follow Player
* Version: 1.0
* Author: Philip Radvan
* URL: http://www.freeactionscript.com
var enemiesArray:Array = new Array();
var radians:Number = 180/Math.PI;
createEnemies(5, "typeA", "e1");
createEnemies(5, "typeB", "e2");
createEnemies(5, "typeC", "e3");
// createEnemies(number of enemies, behavior)
// use ex: createEnemies(10, "slow", "myLinkedMovieClip);
function createEnemies(enemyAmount:Number, enemyBehavior:String, enemyLibraryClip:String):Void
//run a for loop based on the amount of enemies
for(var i = 0; i < enemyAmount; i++)
//set temporary variable that will hold the new enemy attributes
var tempEnemy:MovieClip = _root.attachMovie(enemyLibraryClip, "enemy"+_root.getNextHighestDepth(),_root.getNextHighestDepth())
//give new enemy a random x/y position based on stage width/height
tempEnemy._x = random(Stage.width);
tempEnemy._y = random(Stage.height);
tempEnemy._rotation = random(360);
//set enemy behavior
if(enemyBehavior == "typeA")
//define enemy characteristics
tempEnemy.speed = 1
tempEnemy.turnRate = .05
tempEnemy.agroRange = 200;
tempEnemy.mode = "follow"
else if(enemyBehavior == "typeB")
//define enemy characteristics
tempEnemy.speed = 4
tempEnemy.turnRate = .5
tempEnemy.agroRange = 200;
tempEnemy.mode = "follow"
else if(enemyBehavior == "typeC")
//define enemy characteristics
tempEnemy.speed = 1
tempEnemy.turnRate = .2
tempEnemy.agroRange = 100;
tempEnemy.mode = "run"
//define variables that are used to calculate following
//*don't change these*
tempEnemy.distanceX = 0;
tempEnemy.distanceY = 0;
tempEnemy.distanceTotal = 0;
tempEnemy.moveDistanceX = 0;
tempEnemy.moveDistanceY = 0;
tempEnemy.moveX = 0;
tempEnemy.moveY = 0;
tempEnemy.totalmove = 0;
//add new enemy to array
enemiesArray.push(tempEnemy)
//Update enemies function
function updateEnemies():Void {
//run a for loop based on the amount of enemies
for(var i = 0; i < enemiesArray.length; i++)
//set temporary variable that will hold the new enemy attributes
var tempEnemy:MovieClip = enemiesArray[i];
//run follow function with temporary enemy as the follower
updatePosition(tempEnemy, player_mc);
// updatePosition(follower, target)
// use ex: updatePosition(myEnemyMovieClip, playerMovieClip)
function updatePosition(follower:MovieClip, target:MovieClip) {
//calculate distance between follower and target
follower.distanceX = target._x-follower._x;
follower.distanceY = target._y-follower._y;
//get total distance as one number
follower.distanceTotal = Math.sqrt(follower.distanceX * follower.distanceX + follower.distanceY * follower.distanceY);
//check if target is within agro range
if(follower.distanceTotal <= follower.agroRange){
//calculate how much to move
follower.moveDistanceX = follower.turnRate * follower.distanceX / follower.distanceTotal;
follower.moveDistanceY = follower.turnRate * follower.distanceY / follower.distanceTotal;
//increase current speed
follower.moveX += follower.moveDistanceX;
follower.moveY += follower.moveDistanceY;
//get total move distance
follower.totalmove = Math.sqrt(follower.moveX * follower.moveX + follower.moveY * follower.moveY);
//apply easing
follower.moveX = follower.speed * follower.moveX / follower.totalmove;
follower.moveY = follower.speed * follower.moveY / follower.totalmove;
//move & rotate follower
if(follower.mode == "follow")
follower._x += follower.moveX;
follower._y += follower.moveY;
follower._rotation = Math.atan2(follower.moveY, follower.moveX) * radians;
else if(follower.mode == "run")
follower._x -= follower.moveX;
follower._y -= follower.moveY;
follower._rotation = (Math.atan2(follower.moveY, follower.moveX) * radians)+180;
//onEnterFrame that executes the updatePosition updateEnemies every frame
_root.onEnterFrame = function(){
updateEnemies();
//start/stop drag for player_mc
player_mc.onPress = function(){
startDrag(this);
player_mc.onRelease = function(){
stopDrag(); -
Get the instance names of clips attached to a movieclip
I want to get the instance names of all the cmovieclips that
are attached to a movieclip.
Is there a simple way to do this.
I imagine this is something that can be done with AS3 but can
it be done with AS2?
regards Jyou're welcome.
FYI: a for...in loop loops through all the accesible
properties (in the broadest sense of the meaning, includes
methods/functions and variables etc). Each time it finds one it (in
this case) assigns the property name to the variable 'unknown'
the code inside the loop just checks
a) is it a property that references a movieclip instance and
b) is it the same property name as the movieclip instance's
_name property (this is to avoid listing additional references to
the same movieclip instance that may be set up as variables in your
McA's scope).
I just read that and I'm wondering if it actually will help
you understand... its quite complicated to describe,sorry...
although its simple to understand once you get used to it. To learn
you should experiment with a few for.. in loops on different
objects and see what trace outputs you get. -
Generate a report from the grid to get all the 10g instance name and size
Hi Guru
Greetings foe the day
can you help me to Generate a report from the grid to get all the 10g instance name and size.
If its passible you would help me a ton
Thank youIf you can see in you query, you asking to view dba_segments for one instance and the other query is over the MGMT$DB_TABLESPACES view but NOT "WHERE" clouse is using, and if ypu have more once instance then than view sum all the tablespaces sizes.
How many instanced are registed in your grid control?
http://www.jpuga.cl
Regards
user625256 wrote:
Hi
can any one help on this
The o/p
SQL> select sum(bytes)/1024/1024/1024 from dba_Segments;
SUM(BYTES)/1024/1024/1024
3549.80879
when i query from the above mgmt its returns 1,507,473.149 GB
select target_name DB_NAME,host_name Host,sum(trunc(tablespace_used_size/1024/1024/1024,2)) size_GB
from MGMT$DB_TABLESPACES group by host_name,target_name order by target_name
it gives the size as 1,507,473.149 GB
Thank you in advance -
How to get the instance name from the SWFLoader?
Hi Guys,
I am new to Flex. i need help from u.
i load the swf file through the SWFLoader in Flex 3.
Than how to get the instace(button,text,etc.,) of the loaded
swf.
Please help me.Yes. hashcode is not absolutely unique. I know this.
I had took this idea into my consideration. But it failed finally.
Thanks
To JN_.
Maybe I still have some misunderstood descripte my question.
neither the name not an "instance name" nor an "object name".
So now, I really do not know how to call this.
Can you tell me? Then I will not make the same fault next time.
thanks. -
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
KumarCan't do it in bursting. You will need to pull the db name for sql in a data template or reports6i. Sorry :-(
-
How to get object/instance name in method
Hi folks,
I have created a class and implemented a method within the class.
Now i would like get the name of instance/object calling this method ,within this method.
Is their any way to get this obj name within method?
Eg:
I hve class ZCL with method METH
Now in some program i used this method, by creating any obj
data obj type ref to ZCL
obj->METH
Now is there any way to get this obj name within the methodMETH by using some method like GET_OBJ_NAME(just making a guess)
Regards
PG>
PG wrote:
> Now is there any way to get this obj name within the methodMETH by using some method like GET_OBJ_NAME(just making a guess)
>
> Regards
> PG
Please check the below code snippet
DATA:
lref_obj TYPE REF TO cl_abap_typedescr.
lref_obj ?= cl_abap_objectdescr=>describe_by_object_ref( me ).
Maybe you are looking for
-
We are experiencing a landry list of problems with java 1.2.2 and 1.3 when trying to print reasonably simple reports. I am just curious if anyone has encounterd problems like these, or if anyone has had any luck working around them. We would really l
-
Can I have the same iTunes library on 2 computers?
I have iTunes on my desktop PC, but now I want to use it on my laptop. I've downloaded iTunes on the laptop, but when I log in to my account, none of my music appears. I have my library backed up on my desktop hard drive, so do I have to import all o
-
i just purchased a new I phone 5 and want to give my grandson my I phone 4. So how do I delete all my apps and other data on my phone ?
-
Hi, We are interfacing data from txt file to the ECC Unicode system. In text file charecters are looks like KÏÂÕ 0,8ÌÌ ÏÐÎÇÐÀ×ÍÛÉ and same charectrers we are able to see in the document which posted by the interface. However, when we upload same file
-
How do I measure the period of one TTL signal and the delay until a second TTL signal?
Hi, I have a PCI 6024E board, the SCB-68 terminal box and am running LabView 6.1. If needed I could install 7.1. I have two Honeywell sensors (HOA7720) which each consist of an infrared transmitter and a infrared reciever. When the beam is broken t