Use navigateToURL  in a loop

I'm trying to do a loop, and call a javascript function in
flex for every loop.
The loop only seems to call the javascript once the loop is
done... and it only calls it for the last iteration of the loop.
To reproduce the issue do the following:
1. Create a new project in flex
2. Put a button on the form, and make it's click="test1();"
3. Create a script block like so
<mx:Script>
<![CDATA[
private function test1():void{
for (var i:int = 0; i < 5; i++){
var u:URLRequest = new URLRequest("javascript:alert(" +
"\'test " + i + "\');");
navigateToURL(u,"_self");
trace(i);
]]>
</mx:Script>
the button calls this very simple function, and theoretically
you should get 5 alert boxes, but you don't...you get 1.... i'm
curious if these methods can be used like this.

have a look here: http://livedocs.adobe.com/flex/gumbo/html/WS2db454920e96a9e51e63e3d11c0bf626ae-7fe8.html
<s:Application
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/halo"
    xmlns:s="library://ns.adobe.com/flex/spark">
     <s:layout>
      <s:HorizontalLayout/>
     </s:layout>
  <fx:Script><![CDATA[
     import flash.net.navigateToURL;
     private var listingData:Array=[
        "http://flex.org",
        "http://www.adobe.com",
        "http://aspexamples.adobe.com"
     private function openWindows(n: Number):void {
        if (n < listingData.length) {
           navigateToURL(new URLRequest(listingData[n]), '_blank');
           callLater(callLater, [openWindows, [n+1]]);
  ]]></fx:Script> 
  <s:Button label="Click Me" click="openWindows(0)"/>
</s:Application>

Similar Messages

  • Why use cursor and for loop?

    Hi All
    So in general why would we use a cursor and a for loop to do update in a stored procedure?
    Why wouldnt we just use a single update statement ?
    is there compelling reason for using a cursor and a for loop: I am reading some code from a co-worker that the business logic for the select (set need to be updated) is complex but the update logic is simple (just set a flag to (0 or 1 or 2 or 3 or 4).
    But eventually the select come down to a key (row_id) so I re-write it using just a single sql statement.
    The size of the main table is about 2.6 to 3million rows
    Any thoughts on that??
    The code below I just do a google for cursor for update example in case for something to play with
    -Thanks for all your input
    create table f (a number, b varchar2(10));
    insert into f values (5,'five');
    insert into f values (6,'six');
    insert into f values (7,'seven');
    insert into f values (8,'eight');
    insert into f values (9,'nine');
    commit;
    create or replace procedure wco as
      cursor c_f is
        select a,b from f where length(b) = 5 for update;
        v_a f.a%type;
        v_b f.b%type;
    begin
      open c_f;
      loop
        fetch c_f into v_a, v_b;
        exit when c_f%notfound;
        update f set a=v_a*v_a where current of c_f;
      end loop;
      close c_f;
    end;
    exec wco;
    select * from f;
    drop table f;
    drop procedure wco;
    Joining multiple tables
    create table numbers_en (
      id_num  number        primary key,
      txt_num varchar2(10)
    insert into numbers_en values (1, 'one'  );
    insert into numbers_en values (2, 'two'  );
    insert into numbers_en values (3, 'three');
    insert into numbers_en values (4, 'four' );
    insert into numbers_en values (5, 'five' );
    insert into numbers_en values (6, 'six'  );
    create table lang (
       id_lang   char(2) primary key,
       txt_lang  varchar2(10)
    insert into lang values ('de', 'german');
    insert into lang values ('fr', 'french');
    insert into lang values ('it', 'italian');
    create table translations (
      id_num    references numbers_en,
      id_lang   references lang,
      txt_trans varchar2(10) not null
    insert into translations values (1, 'de', 'eins'   );
    insert into translations values (1, 'fr', 'un'     );
    insert into translations values (2, 'it', 'duo'    );
    insert into translations values (3, 'de', 'drei'   );
    insert into translations values (3, 'it', 'tre'    );
    insert into translations values (4, 'it', 'quattro');
    insert into translations values (6, 'de', 'sechs'  );
    insert into translations values (6, 'fr', 'six'    );
    declare
      cursor cur is
          select id_num,
                 txt_num,
                 id_lang,
                 txt_lang,
                 txt_trans
            from numbers_en join translations using(id_num)
                       left join lang         using(id_lang)
        for update of translations.txt_trans;
      rec cur%rowtype;
    begin
      for rec in cur loop
        dbms_output.put (
          to_char (rec.id_num         , '999') || ' - ' ||
          rpad    (rec.txt_num        ,   10 ) || ' - ' ||
          rpad(nvl(rec.txt_trans, ' '),   10 ) || ' - ' ||
                   rec.id_lang                 || ' - ' ||
          rpad    (rec.txt_lang       ,   10 )
        if mod(rec.id_num,2) = 0 then
          update translations set txt_trans = upper(txt_trans)
           where current of cur;
           dbms_output.put_line(' updated');
        else
          dbms_output.new_line;
        end if;
      end loop;
    end;
    /Edited by: xwo0owx on Apr 25, 2011 11:23 AM

    Adding my sixpence...
    PL/SQL is not that different from a SQL perspective than any other SQL client language like Java or C# or C/C++. PL/SQL simply integrates the 2 languages a heck of a lot better and far more transparent than the others. But make no mistake in that PL/SQL is also a "client" language from a SQL perspective. The (internal) calls PL/SQL make to the SQL engine, are the same (driver) calls made to the SQL engine when using Java and C and the others.
    So why a cursor and loops in PL/SQL? For the same reason you have cursors and loops in all these other SQL client languages. There are the occasion that you need to pull data from the SQL engine into the local language to perform some very funky and complex processing that is not possible using the SQL language.
    The danger is using client cursor loop processing as the norm - always pulling rows into the client language and crunching it there. This is not very performant. And pretty much impossible to scale. Developers in this case views the SQL language as a mere I/O interface for reading and writing rows. As they would use the standard file I/O read() and write() interface calls.
    Nothing could be further from the truth. SQL is a very advance and sophisticated data processing language. And it will always be faster than having to pull rows to a client language and process them there. However, SQL is not Turing complete. It is not the procedural type language that most other languages we use, are. For that reason there are things that we cannot do in SQL. And that should be the only reason for using the client language, like PL/SQL or the others, to perform row crunching using a client cursor loop.

  • Can you use soundtrack pro's loops in your youtube videos or do you need to purchase a license since it is royalty free?

    Can you use soundtrack pro's loops in your youtube videos or do you need to purchase a license since it is royalty free?
    I understand they are royalty free, I am just confused about using the actual loops for films, videos, etc - if there is a special license you must purchase or what?
    Yes sure, it's a library and may be used a lot - but is it legal or against agreement?
    And to clarify - what about music I create on the program , that is ok right?

    If you purchased the software you have the right to use the loops that came with the software in the software to make whatever you want.

  • In Flex Application Session out while export to excel while using navigateToURL _Self ?

    Hi,
    I am using Flex 3.0 and facing one problem session out while export to excel in Live server not on localhost .
    I have Used navigateToURL (url, "_self"); export to excel. While url is sevrlet call.
    In localhost(tomcat) everything is working fine while another server or live in weblogic server, my session Is Getting Lost and User is re-directed to login screen again.
    what to do to resolve this issue.
    while I tried to use _blank instead of _self then session Is getting preserved but its opening blank new window which user will not accept necessary page.
    please Suggest what to do to preserve The session while using _self ..
    waiting for quick reply.
    Regards,
    prabhat

    I'm not using Flex, but the following preserves session in Flash:
    var url = "http://" + WebServerIPAddress + "/" + ApplicationName + "?data=" + datavalue;
    var cmd:String = "window.open('" + url + "','win','height=768,width=1024,toolbar=no,scrollbars=yes');";
    var request:URLRequest = new URLRequest("javascript:" + cmd + " void(0);");
    navigateToURL(request, "_self");

  • Hi, I have small problem, for some time in music area I had two folders to use 1. Apple loops for soundtrack pro 2. Final Cut pro sound effects now both are gray and with out content may I know what happend

    Hi, I have small problem, for some time in music area I had two folders to use 1. Apple loops for soundtrack pro 2. Final Cut pro sound effects now both are gray and with out content may I know what happend

    I just went through this and it appears that my Focusrite Saffire was the culprit. I connected all the outputs on the focusrite according to the way the jacsk on the back were labeled and then set up the multichannel speaker setup to match. Then I went into STP, created a pink noise clip and panned it around, the LFE, center and rears were not in the right place.
    I reconnected the hardware to match the 5.1 pan pot in STP then changed the multichannel speaker setup to match. Everything appears to be correct now but I would have loved to have been able to just assigned the output busses to correct outputs in the saffire.
    Next step is to pan that pink noise around with my SPL meter to calibrate the room.

  • Use navigateToURL to open a local pdf...

    I have a problem with the following code. I have been searching since yesterday for solutions to open pdfs in a browser window from within flash. I've found various forum posts about using navigateToURL and it looks like people have success. It seems very simple to do, but everytime I try to open the pdf file, i get a 404 error in the browser, which is going to this link:
    http://file.pdf (which obviously does not exist)
    My pdf file is sitting inside the same folder as the swf that's trying to launch it. Is there a way to use navigateToURL and specify that the file is local? Else, is there another way to open a pdf file from within a folder? Or am I just an idiot and am missing something very obvious?
    Thanks for any help,
    Chipleh
    Code:
    myBtn.addEventListener(MouseEvent.MOUSE_DOWN, openPDF);
    function openPDF(event:MouseEvent):void{
    var url:String = "file.pdf";
    var myRequest:URLRequest = new URLRequest(url);
    try {
      navigateToURL(myRequest, '_blank');
    catch (e:Error) {
      trace("Error occurred!");

    Hakan KIRIK wrote: "Have you tried Windows Projector (from publish settings) ?"
    Sweeeeet! That works great Hakan, we can certainly use the Flash Projector.
    One more solution I just came up with through googler(in case anyone is interested)
    -  Create a .bat file and call it from  fscommand:
    In Flash:
    function openPdf(event:MouseEvent):void{
    fscommand("exec", "openPdf.bat");
    In your fscommand folder:
    Create a .bat file called openPdf.bat with the following contents:
    @echo off
    file.pdf
    exit
    For this solution to work, name your pdf 'file.pdf', or change the name in the bat file and place the pdf in your fscommand folder as well.
    However, it's alot more work than just calling the navigateToURL funtion, but if you don't want to use a web browser to display your pdf, then the bat file method will work.
    Thanks for the solution Hakan, much appreciation,
    ~Chipleh

  • Flex sampling frequency changes when I use it with apple loops

    Flex sampling frequency changes when I use it with apple loops in a 24 bit 88.2 project

    sorry  !
    Flex changes sampling frequency when I use it with apple loops in a 24 bit 88.2 project

  • I am using a timed while loop and am unable to get the loop to run at a speed of less than 1ms (I am currently using the Wait(ms) function). How can I get a faster response?

    I am trying to create a virtual engine within a timed while loop and am unable to get the loop to run at a speed of less than 1ms (I am currently using the Wait(ms) function). This does not however allow realistic engine speeds. How can I overcome this? I have access to a PCI-MIO-16E-4 board.

    andyt writes:
    > I am using a timed while loop and am unable to get the loop to run at
    > a speed of less than 1ms (I am currently using the Wait(ms) function).
    > How can I get a faster response?
    >
    > I am trying to create a virtual engine within a timed while loop and
    > am unable to get the loop to run at a speed of less than 1ms (I am
    > currently using the Wait(ms) function). This does not however allow
    > realistic engine speeds. How can I overcome this? I have access to
    > a PCI-MIO-16E-4 board.
    Andy,
    Unless you use a real time platform, getting extactly 1 ms loop rate
    (or even less) is impossible. It starts getting troublesome at about
    0.1 Hz for standard operating systems.
    I'd tackle your problem with "if i mod 10 == 0 then sleep 1 ms".
    Of
    course this is jerky by design.
    HTH,
    Johannes Nie?

  • How to use like operator in loop

    Hi I am trying to use like operation in loop condition. the code is as follows:
    loop at lt_mara into l_mara where l_mara like '%XXX'.
    endloop
    when i have the like operator like above its giving me an error that i cannot use like operator. Is there anyway that i can use like operation in loop at condition,
    Thanks in advance

    using the ranges with CP option we can do that..
    Populate the ranges mentioned below..
    data: r_matnr type range of matnr,
            w_matnr like line of r_matnr.
    w_matnr-low = '%XXX'.
    w_matnr-sign = 'I'.
    w_matnr-option = 'CP'.
    append w_matnr to r_matnr.
    loop at lt_mara into l_mara where matnr in r_matnr.
    endloop
    Regards
    Vijay Babu Dudla

  • Is there any way to use a For Each Loop for each property of an User Defined Type?

    Is there any way to use a For Each Loop for each property of an User Defined Type? That would be very handy!
    Jorge Barbi Martins ([email protected])

    Alas, no, not in VBA.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Opening a page using navigateToURL

    HI,
    I have a page with title "Product details" on title bar.On
    this page I have a link which is opening another external window
    using
    navigateToURL(new
    URLRequest('http:/mylink.com/ProductDetailsReport.html'))"
    The Link page must open with title "Product Details Report"
    on title bar as I have coded this page with title "Product Details
    Report".
    Now the problem is it is opening the external link page with
    the title "Product details" rather than "Product Details Report" .
    It is taking title of the calling page rather than called
    page.
    Can ne1 pls tell me how to change the title of the Called
    page.Its urgent
    Thank u
    Surender dahiya

    Hi,
    Please see the sample code below to open a page in new window using java script function :
    In Process request of CO from where page has to be opened :
    OALinkBean brcdViewSearchLinkBean = (OALinkBean)webBean.findChildRecursive("brcdViewOnlySearch");
    brcdViewSearchLinkBean.setOnClick("javascript:window.open ('OA.jsp?page=/brocade/oracle/apps/bra/invanalysis/webui/BrcdAdditionalSrchPG&retainAM=Y&addBreadCrumb=N','new','height=550,width=850,status=yes,scrollbars=yes,toolbar=no,menubar=no,location=no'); return false;");
    Here On click on a link I am opening a page in new window. You can modify this based on your requirement.
    Thanks
    Nidhi

  • Is it possible to micro step using the Pci7314 (open loop) controller and umi7764 and Labview.

    Is it possible to micro step using the Pci7314 (open loop) controller, umi7764 and Labview. if so how would this be set up. i have searched the valuemotion vi libraries and found no microstepping functions. Please could you offer any advice. cheers JON ROGERS

    Hi Jon,
    Micro-stepping is a property of the motor amplifier (motor drive) rather than the controller. It sounds like you are using a 3rd party drive, since you have a UMI. You want to check with your motor amplifier documentation to see if it's supported. Usually, there will be dip-switches on the drive that sets the microstep factor.
    Hope this helps. Please let me know if you have any questions.
    Thanks,
    Ken Sun
    Applications Engineering
    National Instruments

  • Converting aiff to caf for use with the logic loop browzer

    I've got a bunch of new loops. I would like to batch convert the to caf, and use them in the loop browser. Any know if this is possible????
    Thanks,
    CB

    you don't need to convert as .caf
    Logic support .aif .wav .sd2 loops and also .caf!
    No conversion is required... if they are not already apple loop compatible you need to use Apple Loop Utility to add the Logic tags
    G

  • When does oracle use a complete nested loop join?

    Hi!
    Does Oracle Database use a complete nested loop join? I mean, imagine 2 tables without any indexes.. is there any case where for each row in the outer table Oracle does a complete scan in the inner table? I know that this is the original algorithm for the nested loop join, but some data bases prefer to make a temp table to autoindex the inner table and never makes the complete scan in the inner table..
    thanks!!

    user12040235 wrote:
    If the table do not have indexes.. some data bases prefer to scan one time the inner table, to index all values, and than, for every row in the outter loop table, it will do a index search.
    I just like to know oracle does the same thing, or it does the complete scan..If you have two tables without indexes, Oracle may consider scanning one table, extracting the smallest data set it can get away with, and then building a hash table of that data set (rather than creating an in-memory copy with index). At this point Oracle can then do a nested loop join into the in-memory hash table.
    However, this is called a hash join, and the order of tables will appear to be reversed, viz:
    nested loop
        table scan full ABC
        table scan full XYZ
    {code]
    becomeshash join
    table scan full XYZ
    table scan full ABC
    See: http://jonathanlewis.wordpress.com/2010/08/02/joins/ as a starting point if you want to read more on this topic.
    Regards
    Jonathan Lewis                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Why cant we use sy-index in loop and endloop?where exactly we used sy-index

    hi
    can u help me for this

    Hi...
    Genereally Sy-index is used in iterative cases like
    while....endwhile
    and
    Do.... Enddo
    In LOOP ..... Endloop.... We should use SY-TABIX....
    It would be more consistent we use sy-tabix as we loop at internal table so this SY-TABIX points to the current record its reading...
    we can use sy-index but rarely depends on condition.....
    SY-INDEX and SY-TABIX will not be same always in LOOP and ENDLOOP
    Rewards points if satisfied..
    Regards
    Narin Nandivada

Maybe you are looking for

  • IMovies import from camcorder

    Camcorder correctly connected but the program does not start to import into imovies tried for hours and do not understand why. Same Camera had been used before successfully and I have changed nothing in the settings. it asks for event name but thats

  • SCOM Alert Connector - not updating the start time and finish time

    When I am monitoring the status of connectors in service manager console, I found that for SCOM Alert Connector the Start Time and Finish Time are not updating. Previously it was updated daily. As of now, service manager is working fine but would lik

  • Only some pictures are uploading from icloud

    I recently replaced my old iPhone (the top button had been stuck) and when I got my new phone, all the pictures I had from my photostream had been uploaded onto my phone. Recently this new phone has been glitching and all my pictures have been delete

  • Newbie - How do I instantaneity an object from the current Project Library?

    I created an object and placed it into the library. How do I create an instance of it with AS3. Can someone point me to an example? Thank You!

  • Decralation of dynamic data

    Hi, I like to declare data, ranges or field-symbols dynamicaly. is it possible in ABAP? for example : i have table with fieldname, DB table name, variable name etc. variable name       table name    fieldname       TYPE S_MATNR            MARA