Using variables in a button function
I am new to AS3 and building a simple flash banner. There
will be four movie clips consisting of just one word each (in the
sample below I'm just using rectangle for now). When moused over
each word will show a rectangle with a message in it, like a large
tool tip. I have a rudimentary version working fine, see code
below.
Question 1: Is there a way to just write on function which
will work with all four buttons changing the message, say using
variables like AS2?
Question 2: Does the code below look relatively efficient?
I'm sure there are better ways to write it.
Here's a link to the rudimentary version,
http://www.rivergraphics.net/tests/button3.html,
that should give you an idea of what I'm trying to do.
Thanks.
Simply use the information that's passed along with the event
to figure out which item raised the event. Then you can easily call
the other items that correspond to the button raising the event.
TS
Similar Messages
-
How to use variable in the LIKE function along with % operators
Hi,
Is there any way i can use the variable in the Like function. That means i have query like
SELECT * FROM Device WHERE DeviceName LIKE %v_MediaName%;
Here "v_MediaName" is the userdefined variable which contains string. I want to retrieve all the records from the "DEVICE" table whose DeviceName LIKE %v_MediaName%;
If i put it in a single quotes '%v_MediaName%' then the v_MediaName will be treaded as a string instead of a variable. I am using this query in a Procedure.
please help me out to resolve the issue.
thanksLIKE '%'||v_MediaName||'%';
Will not make use of the indexes though.
Message was edited by:
satishkandi -
Using variables in a calculation function in Diadem script
Hey guys,
I'm new to working with Diadem Scripts. I have tried the two different ways below to make the values of a channel equal to the results of a formula containing created variables. I can do it if the formula contains values in place of the variables using the calculator method. I would appreciate any guidance on how to correct the syntax in the below scripts.
Option Explicit 'Forces the explicit declaration of all the variables in a script.
dim a, b, c
a = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef1").Value
b = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef2").Value
c = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef3").Value
Ch ("[2]/ROP (ft/hr)") = a + b* Ch("[2]/Backhead Pressure (psi)") + c* Ch("[2]/Backhead Pressure (psi)")^2
Or
Option Explicit 'Forces the explicit declaration of all the variables in a script.
dim a, b, c
a = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef1").Value
b = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef2").Value
c = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef3").Value
call ChnCalculate("Ch(""[2]/ROP (ft/hr)"")="&a+&b"*Ch(""[2]/Backhead Pressure (psi)"")+"&c"*Ch(""[2]/Backhead Pressure (psi)"")^2")I think you need to use channel name strings of the format "Group Name/Channel Name" in your ChnCalculate function. I usually use a formula, a symbol array, and a value array to get this done:
Dim a, b ,c, sFormula, aSymbols, aValues
Redim aSymbols(6), aValues(6)
aSymbols(0) = "a"
aSymbols(1) = "b"
aSymbols(2) = "c"
aSymbols(3) = "A"
aSymbols(4) = "B"
aValues(0) = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef1").Va
lue
aValues(1) = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef2").Value
aValues(2) = Data.Root.ChannelGroups(2).Channels("rop regression formula").Properties("ResultNonLinearFitCoef3").Value
aValues(3) = Data.Root.ChannelGroiups(2).Channels("ROP (ft/hr)").GetReference('ref type')
aValues(4) = Data.Root.ChannelGroiups(2).Channels("Backhead Pressure (psi)").GetReference('ref type')
sFormula = "Ch(A) = a + b*Ch(B) + c*(Ch(B))^2"
Call ChnCalculate(sFormula,aSymbols,aValues)
CLAD -
Using variables in PL/SQL function body returning SQL query
h4. okay so I have this procedure POSTCODE_TO_LAT_LNG_GM_API(postcode IN VARCHAR2, lat OUT NUMBER, p_long OUT NUMBER) to convert a postcode into lat/long values. I then need to add them to the returned SQL statement so I used the string concat operator || with to_char but it comes up with this error when I try to apply the changes: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic column'' checkbox below the region source to proceed without parsing.
ORA-00936: missing expressionh4. Does anyone know what I am doing wrong here I have tried so many different ways round and none seem to work!! :/
h4. btw I'm using Oracle 11g release 11.2.0.3.0 and Apex version 4.1.1.00.23
DECLARE
l_lat NUMBER;
l_lng NUMBER;
l_SDO_GEOMETRY SDO_GEOMETRY;
l_query VARCHAR2(30000);
BEGIN
POSTCODE_TO_LAT_LNG_GM_API (:P1_POSTCODE, l_lat, l_lng);
l_query := 'select
CAR_ID, CAR_NAME, CAR_POSTCODE,
SDO_GEOM.SDO_DISTANCE(car_location, SDO_GEOMETRY(2001,
8307,
SDO_POINT_TYPE(' || to_char(l_lng) || ','
|| to_char(l_lat) || ',
NULL),
NULL,
NULL),
0.005, ''UNIT=MILE'') DISTANCE
from CARS';
RETURN l_query;
END;Okay so did a little playing around and eventually got it to work, the SQL Command didn't help with the function FYI (maybe something to do with it testing SQL statements and not PL/SQL?).
My 1st problem was that one of my columns relied on an apex text box which isn't always filled in so the SQL Compiler didn't like that. To solve this I did an IF NOT NULL, ELSE statement.
My 2nd problem was after I did that i didn't have a value for Distance in the ELSE statement and so APEX didn't know weather or not to add a Distance column. I solved this by making the distance column NULL.
Here is my final working code:
DECLARE
l_lat NUMBER;
l_lng NUMBER;
l_SDO_GEOMETRY SDO_GEOMETRY;
l_query VARCHAR2(30000);
BEGIN
IF :P1_POSTCODE IS NOT NULL THEN
POSTCODE_TO_LAT_LNG_GM_API (:P1_POSTCODE, l_lat, l_lng);
l_query := 'select
CAR_ID, CAR_NAME, CAR_DESC, CAR_MAKE, CAR_MODEL, CAR_MILEAGE, CAR_PRICE, CAR_YEAR, CAR_POSTCODE,
SDO_GEOM.SDO_DISTANCE(car_location, SDO_GEOMETRY(2001,
8307,
SDO_POINT_TYPE(' || l_lng || ','
|| l_lat || ',
NULL),
NULL,
NULL),
0.005, ''UNIT=MILE'') DISTANCE,
dbms_lob.getlength(CAR_IMAGE_SMALL) CAR_IMAGE_SMALL,
CAR_FUEL_TYPE, CAR_TRANSMISSION, CAR_ENGINE_SIZE, CAR_NUM_DOORS, CAR_BODY_TYPE, CAR_COLOUR
from CARS';
ELSE
l_query := 'select
CAR_ID, CAR_NAME, CAR_DESC,
NULL Distance,
dbms_lob.getlength(CAR_IMAGE_SMALL) CAR_IMAGE_SMALL,
CAR_FUEL_TYPE, CAR_TRANSMISSION, CAR_ENGINE_SIZE, CAR_NUM_DOORS, CAR_BODY_TYPE, CAR_COLOUR
from CARS';
END IF;
RETURN l_query;
END;So yer problem solved now, thanks to you guys for trying to help out!! =) -
Using variable coulmn name in sql function
Hi there,
I am not an expert with PL/SQL and I can not figure out how to use variable column names in my function.
My function is:
CREATE OR REPLACE FUNCTION RESET_TRIGGERS(aTrigger VARCHAR2) RETURN NUMBER IS
TEMP_ID NUMBER;
TEMP_USER_ID NUMBER;
BEGIN
SELECT 'LIMS.'||'$aTrigger'||'.NEXTVAL' INTO TEMP_ID FROM DUAL;
SELECT 'LIMS.'||'$aTrigger'||'_USER.NEXTVAL' INTO TEMP_USER_ID FROM DUAL;
IF TEMP_ID > TEMP_USER_ID THEN
LOOP
SELECT LIMS.SQ_U_FINALRESULT_USER.NEXTVAL INTO TEMP_USER_ID FROM DUAL;
EXIT WHEN TEMP_USER_ID = TEMP_ID;
END LOOP;
ELSE
WHILE TEMP_ID < TEMP_USER_ID LOOP
SELECT LIMS.SQ_U_FINALRESULT.NEXTVAL INTO TEMP_ID FROM DUAL;
END LOOP;
END IF;
COMMIT;
RETURN (TEMP_ID);
END;
What I want is that I pass a seqencename with aTrigger and that two triggers will be equal if not.
eg ifaTrigger = 'SQ_U_FINALRESULT'
than I want the triggers LIMS.SQ_U_FINALRESULT and LIMS.SQ_U_FINALRESULT_USER to be set equal.
The above function will not work, but what will?????
I hope you can help me out!
CheersA very strange function indeed.
But here is what I think he meant to do:
SQL> create procedure reset_sequences
2 ( p_sequence_name in varchar2
3 , p_nextval out number
4 )
5 is
6 l_nextval1 number;
7 l_nextval2 number
8 ;
9 procedure reset_sequence_value
10 ( p_sequence_name in varchar2
11 , p_current_value in number
12 , p_new_value in number
13 )
14 is
15 l_dummy number;
16 begin
17 execute immediate 'alter sequence ' || p_sequence_name || ' increment by ' || to_char(p_new_value-p_current_value);
18 execute immediate 'select ' || p_sequence_name || '.nextval from dual' into l_dummy;
19 execute immediate 'alter sequence ' || p_sequence_name || ' increment by 1';
20 end reset_sequence_value
21 ;
22 begin
23 execute immediate
24 'select ' || p_sequence_name || '.nextval,' || p_sequence_name || '_user.nextval from dual'
25 into l_nextval1, l_nextval2
26 ;
27 if l_nextval1 < l_nextval2
28 then
29 reset_sequence_value(p_sequence_name,l_nextval1,l_nextval2);
30 end if
31 ;
32 if l_nextval1 > l_nextval2
33 then
34 reset_sequence_value(p_sequence_name || '_user',l_nextval2,l_nextval1);
35 end if
36 ;
37 p_nextval := greatest(l_nextval1,l_nextval2)
38 ;
39 end reset_sequences;
40 /
Procedure is aangemaakt.
SQL> show err
Er zijn geen fouten.
SQL> create sequence testseq start with 5 increment by 1
2 /
Reeks is aangemaakt.
SQL> create sequence testseq_user start with 2 increment by 1
2 /
Reeks is aangemaakt.
SQL> declare
2 l_new_value number;
3 begin
4 reset_sequences('testseq',l_new_value);
5 dbms_output.put_line(l_new_value);
6 end;
7 /
5
PL/SQL-procedure is geslaagd.
SQL> select testseq.currval from dual
2 /
CURRVAL
5
1 rij is geselecteerd.
SQL> select testseq_user.currval from dual
2 /
CURRVAL
5
1 rij is geselecteerd.Regards,
Rob. -
Repost Function using Variable is not working
Hello experts! I am on BW-BPS 3.5. I have set up a repost function using variables to change a characteristic value for Business Unit.
1. I created 2 variables as Bus.Unit From and Bus.Unit To in the Planning Area. I am not using the variables in my planning level.
2. I entered the variables in the parameter group New Values area for the From and To Values.
3. My goal is when the user executes the Repost Function for a Variable Prompt should appear and have the user select the From Business Unit and To Business Unit.
The Variables are set up as USERVALUE User-Defined Values, Restriction of Values required by user and I have tried with/without option of Input Allowed by User.
Can you tell me what I am doing wrong, I expected a variable prompt when executing the Repost Function but it does not work.
Thank you,
TeriRavi, Thank you for your reply however I contiue to have errors or the execution does not repost (change any value) as noted below.
1. I have 2 Variables in Planning area var1 (from) var2 (to) for the same charateristic which is Business Unit
2. Business Unit is in the level, on the selection tab to add the variable I can only add 1 variable, So I added var1 (from) to the level.
3. Parameter group for old and new values - I have Var1 (from), var2 (to)
4. Report Function - are you referring to Reporting variables in BPS? I have set this up as suggested in the "How to Use Reporting Variable in BW-BPS" document.
5. Enter plan data: I receive prompt for VAR1, mandatory. At this point there is no value in Var2.
6. Execute Repost function - I receive an error to "Restrict Var2"
7. If I set variable values and add a value for Var2 I receive an error "The generated data is not contained in the selection condition".
Next I removed VAR1 from my planning level and turned on the option 'Selection in package' for Business Unit. This seems to work well.
What do you recommend?
Thank you,
Teri -
Using Variables in a "Report Custom Functions"
Hi!
I created a custom function using Basic Syntax where I am trying to declare/use variables. I keep getting syntax errors and don't know why. Here is my code so far:
Function cdQSIPeriod () As String
YY = Year(CurrentDate)
MM = Month(CurrentDate)
If MM = 1 then
MM = 12
YY = YY - 1
else
MM = MM - 1
cdQSIPeriod = String(MM)& String(YY)
End Function
Any help you can provide will be appreciated.You need to add
dim YY as number
dim MM as number
HTH,
Carl -
Use variables in ParallePeriod function in MDX
Hello, I am using PARALLELPERIOD () function in MDX. the syntax is
PARALLELPERIOD([Date].[Calendar Hierarchy].[Year],1,[Date].[Calendar Hierarchy].[Date].&[20131201]). My question is can i use two variables in this? like PARALLELPERIOD( @Level,1,@Member). I know we can do PARALLELPERIOD([Date].[Calendar Hierarchy].[Year],1,@Member).
With this two variables, i can use same query for calendar hierarchy and week hierarchy etc. Please let me know your thoughts. A work around solution is also fine.
or can I derive @level from @member on the fly? something like PARALLELPERIOD( @Member.level,1,@Member)
thanks in advance.
prajwal kumar potulaYou can use variables like that client side. That may be a .NET function that generates MDX, or SSRS does the same thing.
Regarding whether you can derive @Level from @Member, yes you can. Once you have substituted @Member in the query, you can use the .Level function, so it would look like this - after substitution:
PARALLELPERIOD( [Date].[Calendar Hierarchy].[Date].&[20131201].Level,
1,
[Date].[Calendar Hierarchy].[Date].&[20131201]
Christian Wade
http://christianwade.wordpress.com/
Please mark correct responses as answers! -
Distribute Planning Function(Using Variables)
Hi All,
I'm trying to distribute KeyFigure value between months.
For example:Between Jan2005 and April2005 i want to distribute values.
4000 gets distributed as below:
Jan2005 - 1000
Feb2005 - 1000
Mar2005 - 1000
Apr2005 - 1000
I want user to select from CalYear/month and To CalYear/month from WebInterface dynamically.
But,Distribute from Sender to Receiver planning function is not allowing me to use two variables From and To.
It is allowing me to use only one Variable.
Could u please suggest me how to use two variables in distribute planning function.
Thanks in advance,
Pat.Hello Saritha,
A variable in the BPS can contain a single value or/and a range of values. In the definition of the planning function you can specify an interval by entering the from value and the to value or by choosing one variable containing this interval. This is why the system behaves the way you described it.
What can you do? Use a variable of type Exit in the definition of the planning function. Use two additional variables in the web interface so the users can enter a from and a to value. Now in the exit (for the exit variable)you read the two values and return the interval. You can find the necessary coding and a more detailed description of such a scenario in the BPS how to guide "How to... Variables of type Exit".
Best regards,
Gerd Schoeffl
SAPNet Weaver RIG BI -
Using variables for function arguments AS2
Hello,
I am trying to create a function in AS2.
After creating the function, I want to use values stored in variables for the function arguments rather than manually typing static values for carrying out the function calculation. Also, I want to use the function to assign a new value to the existing variable.
I have asked a similar question 2 days ago here and got the answer (thank you), but now I got one more question - How can I create the function to assign a value to the variable while that 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 variables CoinC and CoinF:
function CalculationA(FirstCoin, SecondCoin, ThirdCoin):Void {
FirstCoin = SecondCoin + ThirdCoin;
CalculationA(CoinC, CoinA, CoinB);
CalculationA(CoinF, CoinE, CoinF);
The above code didn't really assign the values 30 and 70 to the variables CoinC and CoinF but instead, values of CoinC and CoinF are undefined.
Please give me the correct code if there's a correct way of doing this.
Thank you,Here is one way of doing it, by passing a string value of the variable name 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("CoinC", CoinA, CoinB);
CalculationA("CoinF", CoinD, CoinE);
(Note that in your second function call I changed the coins since CoinF (ThirdCoin) is undefined at that point.) -
Personalisation - 'Launch a Function' using variables as parameters
I am trying to call a function from another form using Built In 'Lanch a function'.
In Add parameters, If I provide hardcoded values, its working fine. When I try to pass variables such as :GLOBAL.XX_ITEM_ID or ${item.folder.item_id.value} ,
it errors out
When I use GLOBAL variable, the error is 'Type does not match definition in form XXX ' I tried using to_char , to_number but no use.
When I use item.folder.item_id.value it errors out with 'FROM keyword not found'
I tried putting them in single quotes, pipes etc.
Can anybody tell me how to pass variabes while launching a function?
Thanks a lot.I just solved it. Used the following syntax
'G_QUERY_FIND=PO_LINE_LOCATION_ID
PO_LINE_LOCATION_ID='||${global.xx_po_line_location_id.value} -
Query for create manual tabular form using apex collection add row button functionality
Hello everyone
My requirement is i created a tabular form manually using apex collection but if i click on add row button then previously selected data refreshed and added new row in this form it is fine.but i don't want to refreshed previously selected data and click on add row button then add new row .how it is possible? plz help
Thanks & Regards,
UjwalaUjwala
Instead of starting a new thread with the same question as Query for create manual tabular form using apex collection add row button functionality.
Could you answer the question about what you see while debug the javascript code.
If you don't understand the question or have trouble debug javascript let us know.
Nicolette -
Explain how to implement prompt functionality using @variable
Hi all,
Anyone please explain how to implement prompt functionality using @variable.
We got some sql reports.Those reports have to be converted into BO free hand sql report.
Please provide any best practices for converting sql reports into BO free hand SQL.
Thanks & Regards,
James CharleHi
Please refer "@Variable" section in page number 601, in http://help.sap.com/businessobject/product_guides/boexir31SP3/en/xi31_sp3_designer_en.pdf
Regards
Ashwini -
My Ipad mini has frozen leaving Candy crush. I tried to put it off using the on/off button, now the screen is black with no function. I can hear Siri if I push the control. It is charged. Any ideas? I can't read the very small printed serial number on the back so can't use the Apple help as they require the serial number.
Hold down the sleep/wake button and the home button for ~10 seconds, or until the apple logo appears. This is called a reset.
HTH -
Cant get function to use variable!
hi I have created an actionscript function which stops an animation on a specific frame which works fine. I have then loaded in a php file with a variable which will contain the number for the frame i want the animation to stop on. This has loaded in fine and i have loaded it in a function. what i cant seem to do is to get the variable into the function which tells the animation to stop playing.
here is my code:
//load variables
varReceiver = new LoadVars(); // create an object to store the variables
varReceiver.load("http://playground.nsdesign6.net/percentage/external.php");
//load variables
//function1
varReceiver.onLoad = function() {
//value is the var that is created.
var paul = this.percentage;
//function1
//function2
this.onEnterFrame = function() {
if(this._currentframe==(paul)) {
this.stop();
this.onEnterFrame = undefined;
play();
//function2One problem lies in that you are declaring the variable within a function. This limits the scope of that variable to within the function. So your enterFrame function cannot see it. One other thing you should consider is not activating the enterFrame function until the variable is read in. So while I would have suggested you move the variable declaration out of the function, maybe moving the enterFrame into the function will have a similar effect...
varReceiver.onLoad = function() {
//value is the var that is created.
var paul = this.percentage;
this.onEnterFrame = function() {
if(this._currentframe==(paul)) {
this.stop();
this.onEnterFrame = undefined;
play();
If that doesn't work, then just try moving the variable declaration outside of the function and only assign its value within it. That way paul is visible to the second function...
var paul;
//function1
varReceiver.onLoad = function() {
//value is the var that is created.
paul = this.percentage;
//function1
Maybe you are looking for
-
Pre Purchase Question: Adding a second hard drive on a DV4t
I'm really interested in the DV4T and I was customizing online but can't seem to find any option to add or even where to purchase an internal second hard drive for the SmartBay. Could someone help, Thanks in advance.
-
JScrollPane in a JFrame scrollbars visible but not functional no thumbtabs
Here is the code that I compiled and run on J2SE v. 1.4.2 (runtime b28). I looked through the various related articles and nothing seems to help with this issue. The scrollbars appear along with the panel but the thumbtabs are not present. Any help w
-
4KE5-Actual Distribution for Profit center
I am facing the below error when I execute the 4KE5 for profit center actual distribution. I have maintained the number range but still the same error is there. I defined number range for Document type OC for year 2008. please advise how to overcome?
-
Adobe XI Pro crashes every time I try to compare two PDF's. What gives?
-
How can be time implimenting in Square Wave Point By Point .vi
i want to use "Square Wave Point By Point .vi" but i can not understand how to put time value.