Losing variable values between functions...

hi!
I'm trying to do something simple in actionscript as simple as this:
- Create a variable: var urlVideo:String;
- Use that variable inside a function and give it a value: urlVideo = videoElemento.url.text();
- Then create a new variable and give it the urlVideo value: var url:String = urlVideo;
My problem is that urlVideo loses it's value
Why is that happening?
Here's my code:
var idVideo:String = "12";
var urlVideo:String;
var xmlPath:String = "videos.xml";
var xml:XML;
var loader = new URLLoader();
loader.load(new URLRequest(xmlPath));
loader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(e:Event):void
if ((e.target as URLLoader) != null )
xml = new XML(e.target.data);
xml.ignoreWhitespace = true;
getVideo(xml);
function getVideo(videosInput:XML):void
var listaVideos:XMLList = videosInput.Video;
for each (var videoElemento:XML in listaVideos)
if(videoElemento.id.text() == idVideo)
urlVideo = videoElemento.url.text();
trace(urlVideo); //has a value
break;
var url:String = urlVideo; //the urlVideo values is null !!
What am i doing wrong?
Can anyone help me?

The above post is correct providing the way you displayed the code in your original post is the same way you have it in your program
function getVideo(videosInput:XML):void
var listaVideos:XMLList = videosInput.Video;
for each (var videoElemento:XML in listaVideos)
if(videoElemento.id.text() == idVideo)
urlVideo = videoElemento.url.text();
trace(urlVideo); //has a value
break;
var url:String = urlVideo;  this line occurs outside the function which means that until getVideo is called urlVideo will always be null because its never set until getVideo actualy gives it a value.
zeroskillz method will set the url to play right inside the function which is a good way to organize.. keep behaviors together.
now if you placed url= urlvideo before the end of the function you would have seen a trace like thus:
function getVideo(videosInput:XML):void
var listaVideos:XMLList = videosInput.Video;
for each (var videoElemento:XML in listaVideos)
if(videoElemento.id.text() == idVideo)
urlVideo = videoElemento.url.text();
trace(urlVideo); //has a value
break;
var url:String = urlVideo  //has value

Similar Messages

  • Sharing complex substitution variable values between ASO and BSO databases

    We have ASO and BSO Essbase database member names with spaces in, and need to store some of these member names in substitution variables. However, this has to be done differently for ASO and BSO, due to calc script syntax requiring double quotes and MDX requiring square brackets. For example:
    ASO:
    &CurWeek value = Week 1
    MDX: [&CurWeek]
    BSO:
    &CurWeek value = "Week 1"
    Calc Script: &CurWeek
    As a result, the substitution variables cannot be shared between the ASO and BSO cubes, since the BSO variable value requires double quotes due to the space in the member name.
    Is there a way to get the above to work with both ASO and BSO? Can the double quotes be escaped in calc script syntax? Or can the double quotes be removed in the MDX formula?

    Hi TimG,
    Apologies for such a late reponse to this, genuinely haven't had a spare second to reply until now!
    Yes, I suspect a complex alias name may be the best solution here, and to remove the spaces from the actual member names.
    I was not aware of the latter part at all. My colleague has confirmed as much on this too - DBAG 11.1.2.1 pp117 & 118:
    "Note: If a substitution variable value is numeric or a member name starting with a
    numeral or containing the special characters referred to above is to be used both
    in MDX and non-MDX situations, create two substitution variables, one without
    the value enclosed in quotation marks and one with the value in quotation marks."
    "To ensure that a new substitution variable value is available in formulas, partition definitions,
    and security filters, stop and restart the application. All other uses of substitution variables are
    dynamically resolved when used."
    This last paragraph is the most concerning since we were planning to be able to update substitution variables values and then access the new values from calc scripts and formulae instantaneously. This quirk is unexpected and a little inconvenient. We may have to look at scheduling a change of substitution variable value overnight, followed by a stop/start of the app ready for the next day, and to work around needing to access changed values instantly.

  • Cluster environment with Deployment Plan losing variable values

    Hi all,
    Our environment uses Weblogic Server 10.2, with 2 Managed Servers in Cluster, in Feisty Fawn Ubuntu.
    Our app has a bunch of variables configured in the web.xml with custom values, most of which are endpoint and JDBC related. Our web.xml has some default values in these variables, and we created a Deployment Plan to change these values in deployment-time.
    The problem is that, after a random amount of time, the cluster is "losing" these configurations. At first, everything goes fine, but then, we start receiving errors because the endpoint being used is not the Deployment Plan's anymore, but the one from web.xml. It's completely random, and come and go without notice.
    Is there a known bug about this? Is this a configuration issue?
    Any help would be appreciated!
    Thanks,
    Francisco

    Are you redeploying the applications at all?
    Francisco Cavedon wrote:
    Hi all,
    Our environment uses Weblogic Server 10.2, with 2 Managed Servers in Cluster, in Feisty Fawn Ubuntu.
    Our app has a bunch of variables configured in the web.xml with custom values, most of which are endpoint and JDBC related. Our web.xml has some default values in these variables, and we created a Deployment Plan to change these values in deployment-time.
    The problem is that, after a random amount of time, the cluster is "losing" these configurations. At first, everything goes fine, but then, we start receiving errors because the endpoint being used is not the Deployment Plan's anymore, but the one from web.xml. It's completely random, and come and go without notice.
    Is there a known bug about this? Is this a configuration issue?
    Any help would be appreciated!
    Thanks,
    Francisco

  • Synchronize substitution variables values between Essbase and Planning

    Hello,
    In EPM version 11.1.2.1 (but we noticed the problem also in previous EPM versions) when we set the value of a substitution variable in Essbase, the value is is not immediately updated in Planning: for some time we see the old value. The value in Planning remains unchanged even in we log off or exit Planning and log on again.
    Instead if we restart the Planning service, the value is immediately updated
    Since we would like to use the Essbase substitution variables to manage some selections in Planning Data Entru Forms, is there any way to force a synchronization, or to increase the frequence of synchronizations between Essbase and Planning?
    Regards
    Francesco Quaranta

    Have a look at setting the planning property SUBST_VAR_CACHE_LIFETIME
    http://docs.oracle.com/cd/E17236_01/epm.1112/hp_admin/properts.html
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Transfer values between Function Groups

    This may be a very silly question. I have two function groups x and y. X calls a z function module which is in the same funcion group as X. Now I want to pass some value that x gave to z to Y function module . How do I do it??

    I think function Z shouldn't called by X, but Y.
    Infact X and Z are in the same group so they can see the global variables of group.
    For example:
    GROUP 1 -> Function X, Z.
    TOP include.
    DATA: FIELD1 TYPE C.
    DATA X_BKPF LIKE STANDARD TABLE OF BKPF.
    FUNCTION A.
    FIELD1 = 1.
    X_BKPF = .....
    ENDFUNCTION.
    FUNCTION Z.
    EXPORTING
      REFERENCE(FIELD)
    TABLES
        T_BKPF...
      FIELD = FIELD1. "Take field1 value
      T_BKPF[] = X_BKPF[] "Take table values
    ENDFUNCTION.
    Group 2 Y
    FUNCTION Y.
    CALL FUNCTION Z
      IMPORTING FIELD = FIELD_Y
      TABLES    T_BKPF = T_BKPF_Y.
    ENDFUCTION.
    Message was edited by: max bianchi

  • Share variable value between java script and jsp

    Hi, Firends:
    In my old web page I used a static array to hold a set of values, and now I want to use dynamic value from datbase.
    I created a bean to process database data and return resultset value to an array string.
    I convert my html page into jsp page, use "usebean" tag to call specific method, after done, how can I set the
    resultvaule to my script variable?
    It's urgent!! great thanks!

    Hello,
    Finally, the codes work! thanks for all the suggestion!
    The most important is "J" need <%= tag too. and do not forget the double quotation mark ("") while assigning the value.
    the code like following:
    <jsp:useBean id="ArrayBean" class="myProj.BeanServices"
    scope="page" >
    </jsp:useBean>
    <%! public String[] dataArray; %>
    <%
    dataArray = ArrayBean.getRecordsetReturn();
    %>
    <script language="JavaScript1.2">
    var MCC = new Array(<%=dataArray.length%>);
    <%for(int j =0; j < dataArray.length; j++){ %>;
    MCC[<%=j%>]="<%=dataArray[j]%>";
    <%}%>;
    </script>
    One more question:
    I found on the web server, if I used the same file name (asp file and js file, html file is ok.), seems the server always used the old compiled codes ignoring the code already changed, even after re-complile. I have to change the file name again and again.
    I worked on JDeveloper environment, it has a testing web server environment on my local, I am not sure if this situation will happen in the real server environment.
    How can I make any new updates go into effect immidiately! Do you know web server has some configuration to handle this?
    Thanks a gain!

  • Share variable value between context

    Hello people !
    I need to refresh a variable from DB only once, at the beginning, from a GLOBAL context, and then, i need to evaluate that value from several other contexts, but the value must remain the same.
    Is that possible ?
    ps: asi es, soy argentino. Saludos !

    On the package I think is that possible. See # Oracle® Data Integrator - Reference Manual - 10g Release 3 (10.1.3)
    http://www.oracle.com/technology/products/oracle-data-integrator/10.1.3/htdocs/documentation/oracledi_reference.pdf
    Definition of an iterative loop
    To create a loop that repeats ten times, simply create a numerical variable, snp_increment, that
    contains the increment, then insert the following three steps:
    • Step 1 (Initializing loop): A Set Variable -type step which assigns '0' to snp_increment.
    • Step 2 (Increment loop): A Set Variable -type step which increments snp_increment by '1'.
    • Step 3 to n: …actions to execute in a loop n times.... The snp_increment variable can be
    used in these procedures.
    • Step n+1 (loop end test): An Evaluate Variable -type step which tests snp_increment<=10.
    If successful, execute the task: "step 2", if failed, execute the task: "<<next step>>"
    • Step n+2: .... next actions

  • Pass variable values between Applications,but not through URL.

    Greetings,
    My objective is to pass a value from one page in one application to another page in a diferent application.
    I am aware through some posts i ahve read in the forum that it is possible to pass the value through URL,
    however besides being unable to do so i don't want the user to be able to see the value in the url.
    Also it may be a big value and there are URL size limitations as well as not looking pleasant.
    I have considered keeping the value in a database field, but i would like to use this only as a last resort since the value is temporary and when it gets to destination page it will disapear.
    Anyone is aware of a solution for my problem?
    My Homepage
    Best Regards

    Hi Igor,
    I don't know if the APEX_UTIL. [SAVEKEY_NUM|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b32258/api.htm#sthref2583] / SAVEKEY_VC2 functions work across apps, but you could try. The other thing you could try is setting a cookie using the [OWA_COOKIE|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/w_cook.htm] package.
    --Jennifer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Transfer variable values via ABAP betweenn planning areas

    Hello,
    I'm using an ABAP-coding (BPS How-To 'variables type user-exit) for transferring variable values between planning areas. It works fine for single-, multi- and interval-selection, but not for single hierarchie nodes.
    I don't want to transfer the values beneath the nodes but the node itself. Has anyone experience with that or changed the ABAP-Coding.
    Note, I'm using a variable type hierarchie as destination and get always a dump, when the ABAP is executed.
    Appreciate your help, thanks in advance...

    Hello,
    I am having the same problem. Can the function module Z_VARIABLE_GET_DETAIL from the "How to...BPS Variables of Type Exit" be modified to get the node value of a hierarchy node variable so it can be used as a global variable?
    Thanks, Linda

  • Globale variable to exchange  value between two planning function (Formel)

    Hi,
    can I define a globale variable to exchange the value between two planning function?
    any anwser will be very appreciated.
    hongwei

    Hi,
    can I define a globale variable to exchange the value between two planning function?
    any anwser will be very appreciated.
    hongwei

  • Pageflow variable values don't hold between two ajax requests

    I have pageflow application(Portal) where I have implemented typeAhead(like google suggest with AJAX) for two select boxes. Here I have to inform the server of the firstbox value after it is selected(with AJAX) to save it in pageflow variable so that for next request(while typing in second select box), the corresponding select option data determined by first selection has to be returned. But I see that pagflow doesn't hold values between subsequent ajax requests.But as per BEA Pageflow description values are retained till the end of session.
    Does it have anything to do with the ajax requests which are not normal HTTP browser requests? Plz any suggestions are welcome.

    Hi
    Thanks for reply,
    I know that you said, because I did some ABAP programs and some ABAP reports of the bussiness process of Collateral Objects, with information of these tables and when I tried get information,  I did something like you said, or I assigned cms_ast-object_ref_id to a variable, and this varible I converted to the same type of the other field and find the match or join between the tables(cms_movables, cms_ast).
    The problem is not when I do an ABAP program. The problem is:
    (BO)Business Objects needs to get some information about these tables to do some reports, but  BO has not the tools or the capacity to convert  fields, as well as ABAP. BO gets information directly of the tables of database.
    The posible solution to this problem is that I can create a job and a program, which function is replicate the information of cms_ast and insert on a "z" table or get the relation between to tables (cms_movables and cms_ast) and insert on a "z" table. These can help BO to get information, because BO instead of get information of this tables (cms_movables, cms_ast) , now get information of the table z and then get and join with other tables.
    The principal problem is that BO get information online, with these the job which run the program need to be run minute per minute. and I think that it is not the best practice, because all the tables are some scalables.
    I think that my program could be better, how can I catch a INSERT event on table cms_ast, to convert the fields, and insert on a "z" tables
    Or anybody have an idea, how can i solve these problems?

  • How to  pass a variable value into a custom planning function via a web

    Can some one tell me
    How to  pass a variable value into a custom planning function via a web template?
    What are the different types of Planning function parameters available and what is the difference between them?
    Thanks
    babu

    Hi Sutrtha,
    Yeah I got the pop up asking to select the variables used, I have selected ENTITY_ID that was used by the interfaces, but on execution of the package the Scenario did not work as the passeed variable #ENTITY_ID is set to 0 instead of the value I am passing.
    Am I missing something?
    Regards
    B

  • Pass Values between two Function Modules RFC in Portal

    I need to pass values ​​between 2 FM RFC.
    I have an implicit enhancement in HRMSS_RFC_EP_READ_GENERALDATA RFC function module.
    PERNR LIKE  PSKEY-PERNR
    ENHANCEMENT 1  Z_ESS_EXPORT_PERNR.    "active version
      EXPORT pernr to memory id 'PMK'.
      set parameter id 'PMK' field pernr.
    ENDENHANCEMENT.
    On the other hand an RFC function module that has the code:
            pmk    LIKE PSKEY-PERNR,
            pmk_2  LIKE PSKEY-PERNR.
      get parameter id 'PMK' field pmk.
      IMPORT pmk_2 FROM MEMORY ID 'PMK'.
    When the execution is done in development environment, the modules function at the level of R3, the "get parameter id" works only if the debbuger is classic, otherwise not work. The Import to memory id never works.
    In the environment of quality, r3 do not work any of the 2 sentences. If run from portal (which is as it should be) does not work.
    Thanks if anyone can help me get the problem. Both function modules are executed at the portal.
    Regards
    Edited by: Daynet1840 on Feb 15, 2012 2:02 AM

    When the execution is directly in r3, in development environment or quality, does the set / get parameter id. Export / Import memory id not work.
    But if the FM are called from the portal, does not the set / get parameter id.
    I tried changing the sentence as I indicated harishkumar.dy still not working.
    Madhu: They're in different function groups, one is standard and the other not.
    Regards
    Edited by: Daynet1840 on Feb 15, 2012 3:08 PM
    Edited by: Daynet1840 on Feb 15, 2012 3:11 PM

  • Web report - Variable values while switching between views.

    Hi Gurus,
    We have a query which has a few variables that are getting populated with default values during query execution[customer exits].
    We have added this query to the web.Now there is a date variable  which gets populated with the current date value by default.Suppose the users don't vant to run the report for the current date, they are able to change the date in the variable window and execute. But once the report is run, and we try to choose a different vieew for the report, the report automatically gets refreshed with the selected view, but for the default current date value (because of the customer exit).Shouldn't the selected view be getting refreshed with the date values that the user had entered while executing the report?
    Also when navigating between the different views, shouldn't a variable window pop up? Is there any setting to have the variable window pop up when navigating between the different views of a web report?
    Would appreciate a quick response.
    Thanks a Lot
    Arvind

    hello,
    we need to go to Query properties -> interaction tab-> remove reuse variables to populate the variable screen everytime or "Save and reuse variable values" to supress variable window
    or
    Problem could be due to any personalisation.try this:
    One the query is executed, click on the button which says change variable values.
    In the variable pop-up screen which comes up click on the personalization button
    In the new screen which comes up click on reset personalization button
    Enter new variable values and execute the query.
    Reg,
    Dhanya

  • GET function fails to get values between 1 and 0

    Hi i have the folowing code
    GET(CONTAVENDAS="PERCVOLUMECORP",FONTEDADO="INPUT",TEMPO="2011.INP",PRODUTO="%SPECIE%_IN",CANAL="NACANAL",ORGCOMERCIAL="NAORGCOM")
    When the value in the PERCVOLUMECORP account, is greater or equal to 1 let's say 80, the get function returns me the correct value, but when i have a value between 0 and one, for instance 0,25, the get function returns 0 (zero)
    Any ideas?
    Thanks in advance.
    Leandro
    Brasil

    Here is the entire script
    **SELECT(%ANO_BD_TRAB%,[YEAR],CATEGORIA,"ID='BDTRABALHO'")
    **SELECT(%ANO_BD_TRAB1%,[YEAR]+1,CATEGORIA,"ID='BDTRABALHO'")
    **SELECT(%ANO_BD_TRAB2%,[YEAR]+2,CATEGORIA,"ID='BDTRABALHO'")
    **SELECT(%MES_INCIO%, STARTMTH, CATEGORIA, "ID='BDTRABALHO'")
    **SELECT(%MESES%,[ID],TEMPO,"MONTHNUM>=%MES_INCIO% AND YEAR=%ANO_BD_TRAB% AND LEVEL='MONTH'")
    **SELECT(%MESES1%,[ID],TEMPO,"MONTHNUM>=%MES_INCIO% AND YEAR=%ANO_BD_TRAB1% AND LEVEL='MONTH'")
    **SELECT(%MESES2%,[ID],TEMPO,"MONTHNUM>=%MES_INCIO% AND YEAR=%ANO_BD_TRAB2% AND LEVEL='MONTH'")
    **SELECT(%CONTAS%, [ID], CONTAVENDAS, "TOPDOWNALLOC='Y'")
    *SELECT(%TODOSPROD%, [ID],PRODUTO,"GRUPO='PRODUTO'")
    **SELECT(%SPECIES%, [ID],PRODUTO,"GRUPO='TIPOESPECIE' AND FLAG_TOPDA='N'")
    **SELECT(%SPECIES_IN%, [ID],PRODUTO,"GRUPO='TIPOESPECIE' AND FLAG_TOPDA='Y'")
    *XDIM_MEMBERSET TEMPO = %MESES%,%MESES1%,%MESES2%,%ANO_BD_TRAB%.INP,%ANO_BD_TRAB1%.INP,%ANO_BD_TRAB2%.INP
    *XDIM_MEMBERSET CONTAVENDAS = %CONTAS%,PERCVOLUMECORP
    *XDIM_MEMBERSET PRODUTO = %SPECIES%,%SPECIES_IN%,%TODOSPROD%
    *OLAPLOOKUP VENDAS
      *DIM FONTEDADO="INPUT"
      *DIM TEMPO="2011.INP"
      *DIM PRODUTO="C_IN"
      *DIM CANAL="NACANAL"
      *DIM ORGCOMERCIAL="NAORGCOM"
      *DIM PERCVOL:CONTAVENDAS="PERCVOLUMECORP"
    *ENDLOOKUP
    *FOR %CONTA% = VOLUME
      *FOR %MES% = 2011.JAN
        *FOR %SPECIE% = C AND %SPECIENAME% = CERVEJAS
         *WHEN PRODUTO.SPECIETYPE
         *IS "%SPECIENAME%"
           *WHEN CONTAVENDAS
           *IS "%CONTA%"
             *WHEN TEMPO
             *IS "%MES%"
                    *REC(CONTAVENDAS="%CONTA%",EXPRESSION=LOOKUP(PERCVOL))
             *ENDWHEN
           *ENDWHEN
         *ENDWHEN
        *NEXT
      *NEXT
    *NEXT
    *COMMIT
    Thanks is advance.

Maybe you are looking for