Use a variable name in a function?
Here's my function...myInterval = setInterval (TTMO, 15);
function TTMO () {}
InstanceNameOfMovieClip._x = (InstanceNameOfMovieClip._x - _xmouse) / 10;
InstanceNameOfMovieClip._y = (InstanceNameOfMovieClip._y - _ymouse) / 10-2;
}
Can I use a variable name instead of using the "InstanceNameOfMovieClip"? I tried, but it does not work. I also tried to use the correct hierarchy, as this ._parent. VariableName too.
you have to concat the link with the movieclip using your variable of string like this
var mcName_str = "bigBox_mc";
This [mcName_str] ._x = 20;
You can use this method to loop through the objects named in an incremental way
for (var i: Number = 0; i<>
{
This ["mc" + i] ._x = 20;
}
hope that helped
Tags: Adobe Animate
Similar Questions
-
How can we use the variables name, for example?
I use 9 textbox in my step. The names are similar, only difference is the last character. (s1_0, s1_1, s1_2,...). I am using these textbox in a loop. But I couldn't find the right typing... s1_ [i], (i) s1_ or s1_ {i} gives an error.
s1_0.text = 0
s1_1.text = 0
s1_2.text = 0
s1_3.text = 0
s1_4.text = 0
s1_5.text = 0
s1_6.text = 0
s1_7.text = 0How can he do the shortest hits for this problem?
Use the operator [] table:
for (var i: uint = 0; i<>
This ["s1_" + i.ToString ()] .text = 0;
}
-
Using the variable string quickly calling several variables
OK, I'm not entirely sure how to explain it, but I will do my best...
I have had several similar Boolean variables which are publicly declared at the beginning of my class.
for example
public var _ball0_mcPlaced:Boolean = false; public var _ball1_mcPlaced:Boolean = false; public var _ball2_mcPlaced:Boolean = false;
This will determine whether or not a particular ball was placed in a target area.
Now I want to use this variable again in a function... However, I do not want to write in the variable for each ball in the service.
Is there a faster way to access this variable by using a string inside the function varibale? Each ball becomes a target of the event if clicked, so I could use something like...
("_" + event.target.name + "Placé") to create the dependent variable on which ball is selected?
So, if ball0_mc is selected it returns the _ball0_mcPlaced variable?How can I do this?
See you soonIt would be written using the array notation in the form of...
["_" + event.target.name + "Placé"] = true;
-
Use the variable based on Chncalculate to tiara
I need to use a variable in the ChnCalculate function but only takes the text then how to incorporate the varaible in text inside this function. It keeps on undefined variable beep where, as I have already defined at the beginning of the program and also value.
Hi coolguru,
The syntax error is in your first line, it should be instead:
GlobaDim "a".
Brad Turpin
Support Engineer product DIAdme
National Instruments -
The JS function in a variable name. How to call it?
Hello
I have a name of javascript function in a variable in qml. I need to call this function to qml. How to call it.
I spent my name of the function in c ++ (for example - fnCallLog (param)) in qml using signal and slot. Now, I need to call fnCallLog (param) function js in qml.
In javascript, I can use the window function, but here, it is not accessible. How to call here.
Kind regards
Sanjeev
Oops, misunderstood you here. Well, you can try the method of evaluateJavascript (QString) on your WebView. You can get the result using the javascriptResult (id, QVariant) signal on the Web view.
This BlackBerry Builder session can be useful.
-
Using variables for the AS2 function arguments
Hello
I am trying to create a function in AS2.
After you create the function, I want to use the values stored in the variables specified for the arguments to the function instead of manually typing static values for the calculation of the service. Also, I want to use the function to assign a new value to the existing variable.
I asked a similar question here 2 days ago and got the answer (thanks), but now I have another question - how to create the function to assign a value to the variable, the variable itself is also a function argument?
For example, I have 6 numeric variables:
var CoinA:Number = 10;
var CoinB:Number = 20;
var CoinC:Number;var CoinD:Number = 30;
var CoinE:Number = 40;
var CoinF:Number;Then I tried to create a function to assign values to the variables stuck and CoinF:
function CalculationA(FirstCoin,_SecondCoin,_ThirdCoin):Void {}
FirstCoin = SecondCoin + ThirdCoin;
}
CalculationA (stuck, CoinA, CoinB);
CalculationA (CoinF, stuck, CoinF);The code above didn't really affect the values of 30 and 70 stuck and CoinF variables, but instead, stuck and CoinF values are undefined.
Please give me the correct code if there is a good way to do this.
Thank you
Here's a way to do it, passing a string value with the name of the variable instead of the actual variable name...
var CoinA:Number = 10;
var CoinB:Number = 20;
var CoinC:Number;
var CoinD:Number = 30;
var CoinE:Number = 40;
var CoinF:Number;function CalculationA(FirstCoin,_SecondCoin,_ThirdCoin):Void {}
This [FirstCoin] = SecondCoin + ThirdCoin;
}CalculationA ('stuck', CoinA, CoinB);
CalculationA ("CoinF", CoinD, person);(Note that in your second function call, I changed coins since CoinF (ThirdCoin) is not defined at this time).
-
You can use a variable as a variable name as you can do it in Perl?
So say there are 10 clips on the stage, each named mc1 mc2 mc3 etc. I have a function that sends the name of a movieclip in a public class, and I need to be able to change the image of this movieclip according to the string that is sent. Say so my class is the function declaration:
moveFrame (theMovieClip);
where theMovieClip is the object returned by another function.
Is it possible to use this variable somehow?
The concept of what I'm trying to do:
function moveFrame (s) {}
s.gotoAndStop ("the framework law");
}
Who is? Is this possible or should I find another solution?
If the argument of the function (s) pointing to the object, then your code as shown should work.
s.gotoAndStop ("the framework law");
If the argument points to the name property of the object, then you will need to use the getChildByName() method to target the instance.
this.getChildByName (s) .gotoAndStop ("the framework law");
If the argument is a string version of the name of the instanceobject, you can use the support rating to target the object...
This [s] .gotoAndStop ("environment law");
-
Function call for the ActionScript variable name
I am tempted to call a function dynamically by using a string variable. I know that to do this normally, I would use code like this:
var functionName:String = '' + currentItem.id;
var myData:Array = this [functionName] (parameter1, parameter 2, parameter3);
However, my function is actually in another directory of flex/package called UploadApps.customUploadFunctions. I tried this sort of thing:
var functionName:String = '' + currentItem.id;
var myData:Array = UploadApps.customUploadFunctions.this [functionName] (parameter1, parameter 2, parameter3);
but it does not work. Any ideas on how to call a function with a variable name in another package?
John
My suggestion is to stop using the methods at the level of the package. Just do static methods in a utility class as we do in the framework in the mx.utils package. Then you can easily call them UtilityClassName [functionName] (param1, param2, param3). Given that the programming in AS3 is 99.9% on classes, I don't know why AS3 allows even the methods package level.
Gordon Smith
Adobe Flex SDK team
-
Using the string Variable name to ChnFind
Overview - I find crossing points of zero on a set of data so that I can calculate the phase shift of channel to another in my data.
Small image - I start by finding the zero 1 cross in the data, once I found I want to use the index to find the next and so on
Problem
The posted script comes from looking for the 1st pass by zero before moving on to the next channel. The problem is that I can't find out do my group and channel changes with loops.
Option Explicit ' force explicit declaration of all variables in a script.
Dim intCount, intChan ' loop variables
Dim zIntCount = 2 GroupCount-1 ' groups
Call GROUPDEFAULTSET (intCount) ' change the current group
IntChan = 1 to ChnNoMax ' Browse channels
Z = ChnFind ("Ch(""[intCount]/[intchan]"")<0") 'this="" does="" not="" work,="" but="" i'm="" not="" sure="" how="" to="" fix="">0")>
MsgBox (z)
next
I don't know I'm missing something obvious.
MK
Hi Michael,
You need not global variables to simplify this, but I would certainly use object variables to simplify. When indexing of groups or channels, it is easier to use the variable of index with the Data.Root.ChannelGroups collect or Group.Channels collection directly. I also prefer to store the group object and the channel object in a variable. For example, you can then use Channel.DataType to add exactly the same string data to the new group coming from the old group. You can also easily get the name, unit and all sorts of other properties directly from the object variable. I prefer to use a separate group object variable to reduce congestion in the colde, although it adds 2 lines to your example of code snippet.
Set FromGroup = Data.Root.ChannelGroups (intCount)
Set FromChannel = FromGroup.Channels (intChan)
Define participatory = Data.Root.ChannelGroups ("Index" & FromGroup.Name)
The rise in the value = ToGroup.Channels.Add (FromChannel.Name & "Rising", DataTypeChnFloat64)
Fall in the value = ToGroup.Channels.Add (FromChannel.Name & "Falling", DataTypeChnFloat64)Brad Turpin
Tiara Product Support Engineer
National Instruments
-
How to use a variable as a column name in a select statement
Hello, I am using
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
I have a procedure looking for groups that have not been updated for the current month. The columns are month_01, month_02, month_03 etc. I'm becoming if I can automate every month, but I need to be able to use a variable as the name of the column for the month. Can someone help me with this?
Example of Table
CREATE TABLE TEST_TABLE ( IDENTITY_CODE NUMBER(10), YEAR_S NUMBER(5), MONTH_01 NUMBER(18,2), MONTH_02 NUMBER(18,2), MONTH_03 NUMBER(18,2), MONTH_04 NUMBER(18,2), MONTH_05 NUMBER(18,2), MONTH_06 NUMBER(18,2), MONTH_07 NUMBER(18,2), MONTH_08 NUMBER(18,2), MONTH_09 NUMBER(18,2), MONTH_10 NUMBER(18,2), MONTH_11 NUMBER(18,2), MONTH_12 NUMBER(18,2) ); INSERT ALL INTO TEST_TABLE VALUES(640,2015,124,123,125,126,127,128,547,888,987,567,145,685) INTO TEST_TABLE VALUES(098,2015,587,874,0,587,652,222,444,777,885,999,657,547) INTO TEST_TABLE VALUES(608,2015,587,874,687,587,652,222,444,787,885,999,657,547) select 1 from dual;
Here's my current procedure
CREATE OR REPLACE PROCEDURE RRM_EMAIL_NOTIFICATION IS v_output VARCHAR2(10000); v_message VARCHAR2(1000); v_date date; cursor v_check is SELECT * FROM (SELECT '640' AS ds FROM DUAL UNION ALL SELECT '098' AS ds FROM DUAL UNION ALL SELECT '608' AS ds FROM DUAL UNION ALL SELECT '618' AS ds FROM DUAL UNION ALL SELECT '617' AS ds FROM DUAL UNION ALL SELECT '614' AS ds FROM DUAL UNION ALL SELECT '610' AS ds FROM DUAL UNION ALL SELECT '616' AS ds FROM DUAL UNION ALL SELECT '643' AS ds FROM DUAL) WHERE LPAD (ds, 3, '0') NOT IN (SELECT DISTINCT (SUBSTR (IDENTITY_CODE, 2, 3)) AS Blah_Blah_Blah FROM TEST_TABLE WHERE month_03 <> 0 AND year_s = 2015 AND ( SUBSTR (IDENTITY_CODE, 2, 3) = '640' OR SUBSTR (IDENTITY_CODE, 2, 3) = '098' OR SUBSTR (IDENTITY_CODE, 2, 3) = '608' OR SUBSTR (IDENTITY_CODE, 2, 3) = '618' OR SUBSTR (IDENTITY_CODE, 2, 3) = '617' OR SUBSTR (IDENTITY_CODE, 2, 3) = '614' OR SUBSTR (IDENTITY_CODE, 2, 3) = '610' OR SUBSTR (IDENTITY_CODE, 2, 3) = '616' OR SUBSTR (IDENTITY_CODE, 2, 3) = '643')); BEGIN v_date := SYSDATE; open v_check; loop fetch v_check into v_output; exit when v_check%NOTFOUND; v_message := v_message || chr(13) || v_output; END LOOP; close v_check; send_mail('The RRM one-time initiatives that have not been processed for '||v_date|| ' are ' || chr(13) ||v_message,'[email protected]','RRM ONETIMES NOT PROCESSED FOR ' || v_date); END RRM_EMAIL_NOTIFICATION;
I need to be able to substitute the name e.g. MONTH_01 with a variable column so that it will be MONTH_ | "" some months "
A variable can be created as v_month: = 'month_ | TO_CHAR (T_DATE, 'MM')
If I'm not mistaken that should come out as month_03 for March
The output should be in an email as follows:
Something like:
CREATE OR REPLACE PROCEDURE RRM_EMAIL_NOTIFICATION IS
v_output VARCHAR2 (10000);
v_message VARCHAR2 (1000);
date of T_DATE;
v_check SYS_REFCURSOR;
BEGIN
T_DATE: = SYSDATE;
Open the v_check FOR
Q' {}
SELECT *.
FROM (SELECT '640' DS DUAL FROM
UNION ALL
SELECT '098' LIKE ds FROM DUAL
UNION ALL
SELECT '608' LIKE ds FROM DUAL
UNION ALL
SELECT '618' LIKE ds FROM DUAL
UNION ALL
SELECT '617' LIKE ds FROM DUAL
UNION ALL
SELECT '614' LIKE ds FROM DUAL
UNION ALL
SELECT '610' LIKE ds FROM DUAL
UNION ALL
SELECT '616' LIKE ds FROM DUAL
UNION ALL
SELECT '643' DS DUAL FROM)
WHERE LPAD (ds, 3, '0') NOT IN
(SELECT DISTINCT (SUBSTR (IDENTITY_CODE, 2, 3)) AS Blah_Blah_Blah
FROM TEST_TABLE
{WHERE month_}' | TO_CHAR (T_DATE, 'MM') | Q'{ <> 0
AND year_s = 2015
AND SUBSTR (IDENTITY_CODE, 2, 3))
'640'
'098'
, ' 608 "
'618'
'617'
'614'
'610'
'616'
'643')
)
}';
loop
extract the v_check in v_output;
When the output v_check % NOTFOUND;
v_message: = v_message | Chr (13) | v_output;
END LOOP;
close v_check;
send_mail ("one-time initiatives the RRM that haven't been treated for ' |") T_DATE | «are» | Chr (13) | v_message,' [email protected]',' ONETIMES UNPROCESSED for RRM ' | T_DATE);
END RRM_EMAIL_NOTIFICATION;
-
DATACOPY function problem using several variables quick
Hello
I have problem when I use more variables and then a quick calculation with DATACOPY function. When I put a prompt variable in function DATACOPY it works but when I add one or more it gives me error Essbasse (I can see it in the Essbase Administration journal not in the syntax checking process):
Not valid [Calc Script syntax
DATACOPY Q1020-> Dec-> 'FY14'-]
[Fri Jul 11 15:04:25 2014] Local/TS_PLAN/Prihodi/admin@Native Directory/1004/Error (1200421)
Error occurred at or after the line [8]
-Essbase put FY14 because it is rapidly Variable in this error above.
I try datacopy function with this:
DATACOPY Q1020-> Dec-> "FY14 '... It works
DATACOPY Q1200-> Dec-> {YearPrompt}... It works
DATACOPY Q1200-> Dec-> {YearPrompt}-> {ScenarioPrompt} it doesn't it break on variable ScenarioPrompt.
Thank you
Finally, I solved my problem. That was the problem Essbasse how to understand the spaces between the dimensions. I didn't not use quotes for members and I put space between the arrows. It gave me an error I think because he did not understand space as the space. Now, when I use quotes and remove the space between the arrows cross dimensions it works.
-
the variable name of database query to SQL Server using the Oracle database link
Hi all
I have an ApEx 4.1 application running on x 64 (11.2.0.1) 11g on Windows Server 2008 x 64, and I have a few points of data integration with SQL (2005 and 2008) server that I need to create. I have configured the database with dg4odbc link and it works perfectly... I can run queries on the SQL Server database without any problem using the database link.
However, there is a scenario where the SQL Server database name is dynamic, and I need to generate on the fly in a PL/SQL block and then use it in a query dynamic SQL (all this in the ApEx). It of wherever I meet problems... when I asked the default database that is based on the ODBC connection and I don't have to specify the name of the database, no problem. But when I need access to one of the several other databases by default, I received the error "invalid table.
It works well:* (note that 'fv' is the name of my database link)
v_query1: = "select 'Release Date' from dbo." Schedules@FV where dbo. Annexes. "" SchedID "=: calendar";
EXECUTE IMMEDIATE v_query1 in rel_date using the grid.
I then take this rel_date variable, convert a varchar2 (rel_date_char), then use it as the name of the database in the following query...
_ It returns an error(error ORA-00903: invalid table name)
v_query2: = "select"PARTNO": rel_date_char.dbo.ProdDetails@fv where 'SchedID' =: calendar and"UnitID"=: unit"
and 'MasterKey' =: master and "ParentKey" =: parent';
EXECUTE IMMEDIATE v_query2 in part_number using planning, master, parent unit;
I also tried using all of the following conditions without result:
"select"PARTNO"of" | : rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"of" | rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"of" | @rel_date_char | '.dbo. ProdDetails@fv where 'SchedID '...
"select"PARTNO"in @rel_date_char.dbo.ProdDetails @fv where 'SchedID'..."
Is it possible to do it in PL/SQL?
Thanks for any help!
-Ian C.
Published by: 946532 on July 15, 2012 19:45Just did a test using passthrough:
SQL > set serveroutput on
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5. start
c: 6 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
7 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, "select count (*) from EMP");
8 LOOP
9 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
10 output when nr = 0;
11 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
12 dbms_output.put_line (val);
13 end of loop;
14 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
15 end;
16.
24576PL/SQL procedure successfully completed.
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5. start
c: 6 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
7 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, ' select count (*) from dbo.) EMP');
8 LOOP
9 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
10 output when nr = 0;
11 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
12 dbms_output.put_line (val);
13 end of loop;
14 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
15 end;
16.
24576PL/SQL procedure successfully completed.
So all 3 ways work for me.
Published by: kgronau on July 23, 2012 10:08
Now, using the variables to make the selection:
SQL > declare
2 val varchar2 (100);
3 c whole;
4 whole nr;
5 tabname varchar2 (20): = 'EMP ';
6 ownr varchar2 (20): = "dbo."
7 dbname varchar2 (20): = "door";
Start 8
c: 9 = dbms_hs_passthrough.open_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3;
10 dbms_hs_passthrough.parse@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, ' SELECT count (*) FROM ': dbname: '.) ' || ownr | '.'|| tabname | ") ;
11 LOOP
12 nr: = DBMS_Hs_Passthrough.fetch_row@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
13 when the exit nr = 0;
14 dbms_hs_passthrough.get_value@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c, 1, val);
15 dbms_output.put_line (val);
16 end loop;
17 dbms_hs_passthrough.close_cursor@FREETDS_DG4ODBC_EMGTW_11_2_0_3 (c);
18 end;
19.
24576PL/SQL procedure successfully completed.
=> instead of executing the statement using the "execute Immediate" we use the PASTHROUGH package to pass the statement to SQL Server.
Published by: kgronau on July 23, 2012 10:10
-
I need to use a variable in place of the name of the instance
I have a MC with sub of instance name that has a MC with instance name 9 in.
I'm using AS3
var itemNo: String;
Sub.Item9.addEventListener (MouseEvent.ROLL_OVER, handleRollOver9);
function handleRollOver9(e:MouseEvent):void {}
itemNo = e.target.name;
trace (itemNo);
void. itemNo.removeEventListener (MouseEvent.ROLL_OVER, handleRollOver9);
void. itemNo.gotoAndPlay ("s2");
void. itemNo.addEventListener (MouseEvent.ROLL_OUT, handleRollOut9);
}When I trace itemNo it returns 9 is what I want to spend in the last 3 lines.
in the last 3 lines if I replace itemNo by 9, it works.
This is what I get in the output window:
9
TypeError: Error #1010: a term is undefined and has no properties.
at test1_fla::MainTimeline/handleRollOver9() [test1_fla. MainTimeline::frame1:25]also I tried to use e.currentTarget.name which did not help.
Use the scoreboard operator to force the flash to fix ropes to objects. but in your case, use:
Sub.Item9.addEventListener (MouseEvent.ROLL_OVER, handleRollOver9);
function handleRollOver9(e:MouseEvent):void {}
itemNo = e.target.name;
trace (itemNo);e.currentTarget.removeEventListener (MouseEvent.ROLL_OVER, handleRollOver9);
e.currentTarget.gotoAndPlay ("s2");
e.currentTarget.addEventListener (MouseEvent.ROLL_OUT, handleRollOut9);
} -
Use of variables for name files
I have an if statement that performs a function. Inside this function, I want a swf to play according to the variable name that appears table shuffle. Can someone help me with the syntax?
function questions() {}
it. "' question ' + questionNumb [0] +". play();
}
When this function is executed if the vallue of table questionNumb 0 is 2 I want the statement to be executed as question2.play (); I know that I have the wrong syntax, but I can't find a reference to this type of statement in my action script books or online. Any help would be appreciated.
NetBossfunction questions() {}
_root ["issue" + questionNumb [0]] () .play;
} -
Using the definition of a variable as a variable name
I have a string variable with the definition that I use as a variable name.
For example, it is super simple:
var newVariable = 'it's working. "
var partOne:String = "new";
var partTwo:String = "Variable";
var partThree = partOne + partTwo;
trace ("my variable is" + partThree);
Instead of tracing partThree literally partOne + partTwo (which traces "newVariable"), I would like to trace the definition of partOne + partTwo (which is 'it works').
I hope this makes sense, help or advice is appreciated....
...
var partThree = this partOne [+ partTwo];trace ("my variable is" + partThree); will the traces: my variable is it works
TS
Maybe you are looking for
-
Get the error during the last backup in iCloud "unable to complete backup.
I tried to rest network setting and restart the p as well
-
Manual record levels for external microphone HF R600?
Recently, I bought this camera to record clips video and audio of my daughter playing the piano. She would like to create an audio CD to give to family members. We use a micro external pro rode video mic. The problem is that all audio is recorded
-
Load the MS update KB 2419640 attempted, and it fails to load each time...
-
Cannot install Windows Update in Windows Vista error 800F8016
Original title: 800F8016 Hi, I can't download the updates from microsoft, they all fail. I get the code 800F8016 but can't find answers online... Help, please
-
New WUSB600N does not work after the end of the trial
Everything worked fine initially. After the trial period Basic is supposed to work. Now, says Win 7 64 bit it not only does not recognize the device, but it is bad and must be replaced. I went with Network Magic and it is said that he can not cont