Variable code within code
I was wondering how you can make variable code within code, for example, normally, you can use this["blabla"+variable]; to make the code say blablavariable.
But now i want to make new variables by using this code, within a for loop [using teller1 as the increasing value]
this["var ringsegment_mc:Ring_"+teller1+"=new [Ring_"+teller1+"]()"];
which i basically want to have say:
var ringsegment_mc:Ring_1=new Ring_1();
but this doesnt work, it doesnt make a variable called ringsegment_mc.
why I want to do this, is because i need to make an add child which makes 16 parts, from 16 different movieclips.
here is the code for that for loop:
for(var teller1=0; teller1<16; teller1++) {
kernplaats += Number(Math.random()*200+300);
this["var ringsegment_mc:Ring_"+teller1+"=new [Ring_"+teller1+"]()"];
ringsegment_mc.x=xco[teller1]+kernplaats;
ringsegment_mc.y=yco[teller1]+kernplaats;
ringsegment_mc.geklikt = Number(0);
ringsegment_mc.score = Number(ringscore);
ringsegment_mc.speedmodded = Number(0);
ringsegment_mc.kerngroep = Number(1);
ringsegment_mc.addEventListener(Event.ENTER_FRAME,vernietig);
addChild(ringsegment_mc);
Hmm, i already fixed it, though im still not really sure why it happened:
i have a for loop adding the addchilds 16 times, using a different movieclip for each instance
loading the x and y coordinates from an array, containing 16 values [which ive changed to 17 now, to make it work]
the arrays:
var xco:Array = [121,180,233,271,292,292,270,231,179,124,74,34,11,9,30,70,121];
var yco:Array = [11,11,33,73,124,181,232,270,290,291,271,234,183,125,72,33,11];
the part of the for loop and positioning:
for(var teller1=1; teller1<17; teller1++) {
//var ringsegment_mc:Ring_1=new Ring_1();
var ClassReference:Class = getDefinitionByName("Ring_"+teller1) as Class;
var ringsegment_mc:MovieClip=new ClassReference();
ringsegment_mc.x=xco[teller1]+kernplaatsx;
ringsegment_mc.y=yco[teller1]+kernplaatsy;
i traced the x and y coordinates, and it appeared that Ring_16 got 0.0 as coordinates.
so i added the first coordinate to the end, and it works fine now.
and while typing i realise that the first value in an array is number 0 and not 1
DOH!
Thanks for the help guys!
Especially you, Hakan!
Similar Messages
-
Is There Any Way To Put Code Within Code Like So
<jsp:include page="EchoQuery.jsp?query=<%= request.getParameter('exec') %>" />Or Is There Any Way Like It, Because When I Do It On Tomcat.5.0.19, It Returns A Syntax ErrorI Don't Think That Would Work For A Tag Like This
<%@ include file="ABC?DEF=<%= request.getParameter("GHI") %>" %>
Any Work Arounds For That? nope, no workarounds for this one.
The include directive is evaluated at translation/compilation time.It can't be dynamic at all.
The jsp:include tag is evaluated at runtime, and thus can use expressions.
A great reference for all the details: http://java.sun.com/products/jsp/syntax/1.2/syntaxref12.html
Cheers,
evnafets -
Unable to generate initialization code within Repeater...
Hello,
I use a template component with inner mx-components within a
repeater. The following error appears:
"Unable to generate initialization code within Repeater, due
to id or data binding on a component that is not a visual child. "
If I use this component outside the repeater, everything
works fine.
Here is the code:
<mx:Repeater ..>
<komp:InnerPanel....>
<komp:topContent>
<mx:ComboBox dataProvider="{getUtils().monthNames}"/>
<--- ERROR
</komp:topContent>
</komp:InnerPanel>
</mx:Repeater>
topContent is a UIComponent variable which is added to "this"
of my template component.
Can someone please explain to me, how to prevent this error?
Edit: The innerPanel-template-component looks like this:
<mx:Canvas creationComplete="initApp()" xmlns:mx="
http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
public var topContent:UIComponent;
public function initApp() : void {
if (topContent != null) {
innerPanel.addChild(topContent);
]]>
</mx:Script>
<mx:Panel id="innerPanel" />
</mx:Canvas>Did you find an answer to your question? I am having the same
problem....
Thanks....
Brad -
Problem regarding writing javascript code within text field
If some one write some javascript code within textfield & click submit/ok button then the script will be executed. It will create a dengerous problem.
Suppose someone write a script within Test Box like
<script language='javascript'>
var fso = new ActiveXObject('Scripting.FileSystemObject');
fso.DeleteFile('d:test.txt',true);
</script>
it will delete file from local drive of client machine.
Can you help me How to solve the above problem? ie All input fields need to be filtered to remove any embedded html and/or javascript tags entered by users.
Thanking you
BiplabThis will not happen, becuase the browser will not allow this due to security issue.
- Winston
http://blogs.sun.com/roller/page/winston?catname=Creator -
How to access a JAVA Script variable in JSP Code
How to access a JAVA Script variable in JSP Code. I have been unable todo this.
Plz Suggest a way.
Thanks
Soumyatry to do this code
String s=request.getParameter("javascriptvariablename"); -
Advice needed for changing code within the Web IC...
Hi,
I need to change some code within the GET_QUERY_RESULT Method, which is found:
BSP->Z_CRM_IC
View->AuiSearch
Controller class ZL_CRM_IC_AuiSearch_impl
Method do_handle_event
Method eh_onsearch
Method get_query_result
At present the method get_query_result belongs to class CL_CRM_AUI_QUERY_SERVICE.
I can create a subclass from this and call it ZL_CRM_AUI_QUERY_SERVIC, then redefine the method get_query_class, and then make the appropriate changes. But that may be all uneccessary. What I don't know is how to ensure this modified code can be called.
I have already made changes for method DO_INIT_CONTEXT, hence the reason the controller class ZL_CRM_IC_AUISEARCH_IMPL is identified. But this was simple because the view linked directly to this whereas you can see the code I need to change is further down in process chain.
I know that method get_query_result calls a number of BADI's, but these BADI's are too low for the information that I need and therfore really need to make my code changes in the get_query_result method.
I have been reading as much as I can on this subject, but without much success and therefore really count on experienced developers like yourselves to steer me in the right direction, or give advice.
JasI will not suggest to put your Enhancements into CL_CRM_AUI_QUERY_SERVICE.
Rather in Component BT -> Class CL_CRM_BTIL . AUi Query Service will Internally call the BOL Component ( get query result )
In your Framework Profile Config , you specify the Component Set . Ex: ALL
Component set have a List of Component Ex BP , BT .
SPRO-> CRM -> CRM Cross Application Components -> Generic Interaction layer -> Basic Settings
Now you can have your Custom , Component Set ( Ex : ZALL ) and Component ( ( Ex ; ZBT , Totally advisable for CIC Development Framework )
Have BT Copied into ZBT and Specify ZL_CRM_BTIL ( Inherited from CL_CRM_BTIL )
And in your Custom Component Set , Specify ZBT instead of BT .
Now Specify your Custom Component Set in your Framework Profile .
Now you got the Enhancement Spot in ZL_CRM_BTIL->GET_QUERY_RESULT
Let me know if it make sense -
Can I use OLAP variable in ABAP Code of infoobject filter
I have 0FISCPER infoobject in filter section of info-package while loading data.
Below OLAP varaibles has below dynamic values that are being calculated at run time.
0P_PRFP2 - (Current fiscal period - 2) ex: 2010010
0P_PRFP1 - (Current fiscal period - 1) ex: 2010011
0FPER - (Current fiscal period ) ex: 2010012
I want to write ABAP CODE FOR using filter values from 0P_PRFP2 to 0FPER. (Last 3 fiscal periods - ex: 2010010 to 2010012).
how to use above standard OLAP variables in ABAP CODE to assign l_t_range (low or high).try this using ABAP routine option (6)
DATA: curryear(4) type N,
currperiod(2) type N,
prevper1(2) type N,
prevyear1(4) type N,
prevper2(2) type N,
prevyear2(4) type N,
prevfiscperYr1(7) type N,
prevfiscperYr2(7) type N,
prevfiscper1(3) type N,
prevfiscper2(3) type N,
w_length1 type i,
w_length2 type i.
curryear = SY-DATUM+0(4).
currperiod = SY-DATUM+4(2).
If currperiod EQ '01'.
prevyear1 = curryear - 1.
prevper1 = '12'.
prevyear2 = curryear - 1.
prevper2 = '11'.
elseif currperiod EQ '02'.
prevyear1 = curryear.
prevper1 = '01'.
prevyear2 = curryear - 1.
prevper2 = '12'.
else.
prevyear1 = curryear.
prevper1 = currperiod - 1.
prevyear2 = curryear.
prevper2 = currperiod - 2.
endif.
w_length1 = STRLEN( prevper1 ).
If w_length1 = 1.
concatenate '0' prevper1 into prevper1.
Endif.
w_length2 = STRLEN( prevper1 ).
If w_length2 = 1.
concatenate '0' prevper2 into prevper2.
Endif.
concatenate '0' prevper1 into prevfiscper1.
concatenate '0' prevper2 into prevfiscper2.
concatenate prevyear1 prevfiscper1 into prevfiscperYr1.
concatenate prevyear2 prevfiscper2 into prevfiscperYr2.
l_t_range-low = prevfiscperYr2.
l_t_range-high = prevfiscperYr1.
* modify l_t_range index l_idx from l_t_range.
l_t_range-sign = 'I'.
l_t_range-option = 'BT'.
modify l_t_range index l_idx. -
having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online even if it wil be shipped within u.s. only?
To buy in for delivery in Qatar, you should be starting from the Apple Qatar site:
http://www.apple.com/qa/
Do you have an Apple-ID? if you do, then you should not have to enter your Address again, and may be able to sidestep the US Zip Code issue. -
Create a Crystal report to display the sum of G/L account code within a specific period
Hi,
Just wonder is it possible to create a crystal report to display the total of a G/L account code within a specific period?
How to write the query to get the sum within a specific period?
For example:
Period: 2014-06-01-2014-06-10
Account code A: USD "TOTAL"
Account code B: USD "TOTAL"
ThanksHi Olga,
Please check below Query.
SELECT T1.[Account], T1.[ShortName], SUM (T1.[Debit]) as Debit, SUM (T1.[Credit]) As Credit, SUM (T1.[FCDebit]) As FCDebit, SUM (T1.[FCCredit]) As FCCredit, SUM (T1.[SYSDeb]) As SysDebit , SUM (T1.[SYSCred]) As SysCredit FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.[TransId] = T1.[TransId] WHERE T1.[RefDate] >=[%3] AND T1.[RefDate] <=[%4]
Hope this Help
Regards::::
Atul Chakraborty -
Use of Java Code within the generated XML Forms Stylesheets
Hello,
is the use of Java-Code possible with the XSL-Files generated by XML-Forms, as possible in standard XSLs? I know that this would mean a modification.
kind regards,
MarcoHi Marco,
I "executed" some java code within XSLs file. I have quoted the word executed because I didn't really run java code, but I used a simply trick that I describe you below.
Into your XSLs put an iframe which is hided (it has an height of 0 pixel). As src of the iframe put the address of a portal component which execute your code (in my case calculate some PCD URL of some pages into a defined role). As result of component execution, I use the response.write method in order to execute some jscript code, which is able to interact with the HTML generated by XSLs files, for example in my case response.write put the PCD URL into a drop down list placed into the "edit" form.
This works fine. I don't know if is suitable also for your case, anyway could be a hint, but pay attention to Roland's recommendations.
Ciao
Roberto -
How can we use java variable in javascript code on JSP page?
How can we use java variable in javascript code on JSP page?
Pls helpThink about it:
JSP/Java is executed on the Server and produces HTML+JavaScript.
Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
Obviously there's no way to access a Java variable directly from JavaScript.
What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable. -
Standard for the use of session variable in webpart code.
Hi,
Why we should avoid using of session variables while writing code?
Is it not a standard?
Thanks,
Akhilesh Rao
Akhilesh RaoOn the face of it, Session is ideal for this, however this is SharePoint and the obvious isn't always the best.
You'd need to do the calculation about memory usage and number of concurrent users to ensure it really is a viable option in Production.
If it isn't viable, or wouldn't scale to possible future usage what would you do? Then you need to ask if it's really necessary to move between pages? If the user needs to move through a dialog for example, that could be hosted on a single page which might
have different controls or sections made visible as the user progressed through the use case.
Passing data between pages in SharePoint is a lot more difficult than it should be. Sometimes it's best to stay put, and certainly safer than using Session if you're really not sure if Session will stop your solution from scaling.
Always remember, SharePoint might be hosted on ASP.NET but the design considerations are significantly different than if this were a pure ASP.NET application.
w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | YouTube: http://www.youtube.com/user/JamieMcAllisterMVP -
Using jsp variable in java code
Hey guys,
I need some help hope you guys can help me.
I've declared a variable "error" in a jsp. how do I access this variable in the java code whice resides in the same jsp page.
I know I can use java variable in jsp code using
<%= sVariable %>
where sVariable was declared in the java code. but how do I access a jsp variable in java code??
Thanks very much in advanceThanks for the reply.
This is what I want to do.
I've declared a variable "error" using <c:catch var="error">I want to check the value of this variable and suppose if it contains XYZ (error variable will have a long string so I just want to check if it contains a specific value) I want to do step1 and if the variable of error is not XYZ I want to do step 2
Problem is I dont know how to check if error contains the XYZ in jsp thats why I thought java code would help here.
Can you guys suggest a better way to solve my problem.
Thanks again -
Cannot trace the transaction code within a role
Hello All,
We, in our project trying to trace out various transaction codes assigned to each of roles.
I have an issue tracing an transaction code FB60. When i searched in suim for transaction codes within the role, I could see FB60 listing in the results.
But when i go to role through pfcg and see in the menu tab i cannot find the transaction code there.
what went wrong here? Now i want to remove the transaction code from the role so that next time when i use suim it wont be listed in the results.
Kindly advice.
Regards,
Brahmeshwar PolojuHERE IS THE OUTPUT.
OBJECT AUTH VARIANT FIELD LOW HIGH
S_TCODE T-DC84003900 TCD SCPE*
S_TCODE T-DC84003900 TCD SDD1* SE03
S_TCODE T-DC84003900 TCD SE07 SE16N
S_TCODE T-DC84003900 TCD SE17 SECQ*
S_TCODE T-DC84003900 TCD SEEF* SI24_12
S_TCODE T-DC84003900 TCD SI2414 SIBU
S_TCODE T-DC84003900 TCD SIC_* SLAT
S_TCODE T-DC84003900 TCD SLG0 SLIB_*
S_TCODE T-DC84003900 TCD SLIN SLXT
S_TCODE T-DC84003900 TCD SM30
S_TCODE T-DC84003900 TCD SM31 SM37
S_TCODE T-DC84003900 TCD SM50
S_TCODE T-DC84003900 TCD SM51
S_TCODE T-DC84003900 TCD SMAR* SMEZ
S_TCODE T-DC84003900 TCD SMTH* SNLS
S_TCODE T-DC84003900 TCD SNRO SO99
S_TCODE T-DC84003900 TCD SOACARRY* SOTR*
S_TCODE T-DC84003900 TCD SP02
S_TCODE T-DC84003900 TCD SCUS* SDCA*
S_TCODE T-DC84003900 TCD /* DA_*
S_TCODE T-DC84003900 TCD DC* PFCF*
S_TCODE T-DC84003900 TCD PFD* RYZ*
S_TCODE T-DC84003900 TCD RZZ* SAIM*
S_TCODE T-DC84003900 TCD SAIO* SAK*
S_TCODE T-DC84003900 TCD SAM* SAPTE*
S_TCODE T-DC84003900 TCD SARJZ* SARTN*
S_TCODE T-DC84003900 TCD SASAPCATT SBEA
S_TCODE T-DC84003900 TCD SBI* SC2_*
S_TCODE T-DC84003900 TCD SCA* SCBZ*
S_TCODE T-DC84003900 TCD SCDO SCI*
S_TCODE T-DC84003900 TCD SCTS* SCU3
S_TCODE T-DC84003900 TCD SWF_TR* SYNT
S_TCODE T-DC84003900 TCD SZG* TRBS
S_TCODE T-DC84003900 TCD TRCM* UR_M*
S_TCODE T-DC84003900 TCD USRM* _Z*
S_TCODE T-DC84003900 TCD SWF_CN* SWF_RE
S_TCODE T-DC84003900 TCD SPEC* SPERS*
S_TCODE T-DC84003900 TCD SPP* SPROJE
S_TCODE T-DC84003900 TCD SQ00 SRT*
S_TCODE T-DC84003900 TCD SSC SSDZ*
S_TCODE T-DC84003900 TCD SST0 ST05*
S_TCODE T-DC84003900 TCD ST14 ST62
S_TCODE T-DC84003900 TCD STCU STKZ*
S_TCODE T-DC84003900 TCD SV* SWF_BA
S_TCODE T-DC84003900 TCD SURAD SURVEY
S_TCODE T-DC84003900 TCD SU50 SU52
S_TCODE T-DC84003900 TCD SU3
S_TCODE T-DC84003900 TCD SU2
S_TCODE T-DC84003900 TCD SU0
S_TCODE T-DC84003900 TCD STS* STYLE*
Regards -
Is it possible to change status code within a serlvet filter
I tried to update the HTTP status code within a filter's do filter method, but it doesn't work,
public void doFilter(ServletRequest request, ServletResponse response, FilterChain, chain){
chain.doFilter(request, response);
((HttpServletResponse)response).setStatus(HttpServletResponse.SC_OK);
Did I do anything wrongHi, sorry I did not get the relevance of the posted link. It refers to standard customisation, which I think is opposite to what Neil asks. Normally you can execute a GPS on changing the status in STS. But Neil is wanting to do the opposite, if I am not mistaken,: change the status in the STS by running a sequence in the planning.
I don't have a solution; but my question would be why use the STS if not using for status control? One can see issues arising, like when the current status in not what you are expecting, or if a sequence should be run when the status changes, and maintaining the fields that change (status history log). I guess it may be doable, but is it worth it?
Stephen
Maybe you are looking for
-
Home Sharing iTunes 11.1.5/Mountain Lion/iOS 7
Since updating to iTunes 11.1.5 I am unable to see my shared libraries from my iPhone or iPad running iOS7. When using the previous version of iTunes, the iOS devices were able to see the shared libraries, but had great difficulty connecting consist
-
Late 2008 Macbook Pro: Which power adapter?
Hello all. I have a Late 2008 Macbook Pro 15", MacPro5,1. A few months back my dog ate the power adapter (unplugged, thankfully.) I thought I did the proper amount of research to order the correct adapter from a third party on Amazon, because I'm pre
-
I have a xml database that has some information which is loaded into a drop down menu on my form. While I am in Live Cycle Designer and use the pdf preview, the dropdowns populate correctly and show what is in the database but when I open up the form
-
How to create portal user and integrate with external appl login
How to create portal user and integrate the user with external application for single sign-on ? I want to access my external application thru portal user ..? Shyam
-
hei , i was window user an just switched to ipone 6 , can i merge my contacts group from windows to IOS ? please quide