URLRequest & _self

I'm converting some old AS2 flash elements on a hybrid html/flash elements site to AS3.
The site is document relative in DW CS3.  My .swf files are in a subfolder /Flash and the .swf files themselves are fine on the page.
Simple menu ... 6 button (mc) links ... the mouse event Click calls the URL Request in a function...
Just as an example the code here is for a simple 1 button link (also on the html page with the menu as a separate .swf)
-- but the problem I'm having occurs on all my links.
     clickHere_mc.addEventListener(MouseEvent.CLICK, classesPage);
     function classesPage(e:MouseEvent):void
          { var targetURL:URLRequest = new URLRequest("../classes.html");
             navigateToURL(targetURL, "_self"); }
The above code works fine in Flash (in the .swf) and the html page opens. But...
when the object code (swfObject 2.0)  is 'embedded' in the html page (css div) there is no 'click' action, nor does the linked page open.
If I leave off the "_self" then the link works but opens in a new browser window. [i.e.    navigateToURL(targetURL);   ]
I've tried variations of using "_self", including
     var targetURL:URLRequest = new URLRequest("../classes.html");
     navigateToURL(targetURL, "target = _self");
and
     function classesPage(e:MouseEvent):void
     { navigateToURL(new URLRequest("../classes.html"), "_self"); }
and these also cause the same problem -- no link 'action' on click; no new page. 
This code (and variations of it) inside the function causes no Flash error but does cause a browser error of can't find page
     var targetURL:URLRequest = new URLRequest("../classes.html, target = _self");
          navigateToURL(targetURL);
I've tried putting the .swf file and the html file in the same directory (both in the root dir) and still no mouse action or new page opening.               
I do not want an internal html page opening in a new browser window, but how come I'm not getting the "_self" command to work?
Is there another way to have AS3 open a new html page in the same domain using Flash menu 'button' links instead of the URLRequest?
Thanks -- Susan

Meaning that previewing my DWeaver site/files with the mc 'button' & the (...  "_self" )  on the pages locally in the browser are not working, but once I upload the files to a server they will?  I'll try that. 
But in the meantime....
Could my problem with the "_self" not working be due to the fact that I don't have this code in my AS3?
I'm not using an external AS file, nor have I linked the movie clips 'buttons' for AS export.
(code from Adobe's Actionscript 3 Language-Components Reference URLRequest Class)
import flash.display.Sprite;
    import flash.net.navigateToURL;
    import flash.net.URLRequest;
    import flash.net.URLVariables;
    public class URLVariablesExample extends Sprite {
        public function URLVariablesExample() {
            var url:String = "http://www.[yourDomain].com/application.jsp";
            var request:URLRequest = new URLRequest(url);
            var variables:URLVariables = new URLVariables();
            variables.exampleSessionId = new Date().getTime();
            variables.exampleUserLabel = "guest";
            request.data = variables;
            navigateToURL(request);

Similar Messages

  • LoadmMoive in flash not working when import to Captivate

    I have a empty movie clip loading different swf files by clicking different buttons.
    It works prefect in flash, but when I import it into captive and publish, it shows nothing......
    I am using as3 and captive5.
    It would be wonderful if anyone can help me with this problem.
    Thanks

    Well, the original project is structured a bit differently from the norm. It imports the flv to a playback component, and uses an event listener to navigate to a new URL once the video is finished playing. But I don't know that there's a connection here which would cause the video not to even begin. I don't know if this will help, but FWIW, here's the code:
    import fl.video.*;
    flvPlayer.source="NEWINTRO.flv"
    flvPlayer.addEventListener(VideoEvent.COMPLETE, myHomePage);
    flvPlayer.autoPlay= true;
    var urlRequest=new
    URLRequest("http://www.thewebsite.com/home.htm");
    function myHomePage(eventObject:VideoEvent) :void
    {navigateToURL(urlRequest, '_self');}
    Like I said, locally, it all works flawlessly. Thanks for your help. - Mark

  • To save it in javascript...

    please give me an idea of how to solve this beginnes's error.
    i created a .mxml and a class type .as (\ChartTest\src\generated\webservices\MyArray.as)
    but when i try to debug it i am not able to save it in javascript (AC_OETags.js).
    thanks for your help (soory for my inglés, i am chilean )
    [email protected]

    las .as estan en C:\inetpub\wwwroot\Grafico_Pr01\src\generated\webservices
    este mxml esta en C:\inetpub\wwwroot\Grafico_Pr01\src, descrito a continuación
    importe el web services de impotar wsdl.
    gracias
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="white" viewSourceURL="srcview/index.html">
    <mx:Script>
    <![CDATA[  
    import mx.rpc.events.ResultEvent;  
    import generated.webservices.Accesos;
    import generated.webservices.WSUsuarios;  
    import mx.collections.ArrayCollection; 
    private function Reload():void  
    var urlRequest:URLRequest = new URLRequest(Application.application.url);
    navigateToURL(urlRequest,"_self"); 
    [Bindable]
    private var misUsuarios:ArrayCollection;     
    private function ResultadosUsuarios(event:ResultEvent):void  
    misUsuarios = event.result as ArrayCollection;         
    for (var i:int=0; i<misUsuarios.length; i++)         
      var current:WSUsuarios = new WSUsuarios();             
      current = new WSUsuarios(misUsuarios.getItemAt(i));             
      misUsuarios.setItemAt(current, i);         
    ]]>
    </mx:Script> 
    <mx:WebService id="miWSUsuario" 
    wsdl="http://www.capacitacionlaboral.com/SU2/gerencia/WebServiceEstadistica.asmx?wsdl" 
    load="miWSUsuario.ObtenerUsuarios()" showBusyCursor="true" result="ResultadosUsuarios(event)" />
    <mx:DataGrid id="dataGridAccesos" dataProvider="{misUsuarios}" width="210" height="92" x="10" y="383"
      visible="false"/> 
    </mx:Application>

  • Scripting Download Progress for Multiple Movie Clips?

    I'd like to insert script in the example below that would indicate the download progress of two successive movie clips on a page. Any suggestions would be much appreciated. Thank you.
    import fl.video.FLVPlayback;
    import fl.video.*;
    explainer.source="movie1.flv"
    explainer.addEventListener(VideoEvent.COMPLETE, f);
    explainer.autoPlay= true;
    explainer.volume=1.00;
    function f(e:Event){
    var myVideo:FLVPlayback = new FLVPlayback();
    myVideo.source = "movie2.flv";
    myVideo.addEventListener(VideoEvent.COMPLETE, myHomePage);
    myVideo.autoPlay=true;
    myVideo.volume=1.00;
    myVideo.skin="SkinUnderPlaySeekStop.swf";
    myVideo.skinAutoHide=true;
    myVideo.skinBackgroundColor=0x000000;
    myVideo.skinBackgroundAlpha=0.1;
    myVideo.height=405;
    myVideo.width=720;
    myVideo.x=141.2;
    myVideo.y=115.4;
    stage.addChild(myVideo);
    var urlRequest=new URLRequest("ATRMAIN.html");
    function myHomePage(eventObject:VideoEvent):void
    { navigateToURL(urlRequest, '_self');}

    the flvplayback component has bytesLoaded and bytesTotal properties.

  • Play Video then load SWF?

    Hello all. I'd like to have a flash page play a video and, at its completion, load a new swf file. I have the code working fine for getting an html page (below), but would like to substitute it for loading the swf file aforementioned. I assume it's a basic modification to load the swf file instead. Thanks for any suggestions.
    import fl.video.*;
    musicintrovid.source="INTRO FILM.flv"
    musicintrovid.autoPlay=true;
    musicintrovid.volume=1.00;
    musicintrovid.autoRewind=true;
    musicintrovid.addEventListener(VideoEvent.COMPLETE, myHomePage);
    var urlRequest=new URLRequest("music_arrival.html");
    function myHomePage(eventObject:VideoEvent):void
    { navigateToURL(urlRequest, '_self');}

    Just load your swf into one that has video with Loader class:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html

  • Restart the application on air

    Hello,
    I'm doing a game on air 2.5 for Android and I would like to know how can I restart the whole application in action script 3. I was looking for that information but I just found that:
    var urlRequest:URLRequest = new URLRequest(Application.application.url);
    navigateToURL(urlRequest,"_self");
    But it does not work on Android. I want to restart from scratch the game. Does anyone know a way?
    Thanks in advance.

    I want to restart the whole application when the user tries to login on Facebook in order to load all the information about Friends and other.
    I was just wondering if it is possible to load again the application from itself.
    Thank you very much.

  • SWF links won't open in Dreamweaver preview

    Hi,
    I'm kinda new to flash and feeling my way around things, but I've run into a snag and haven't found an answer on any forums yet.
    I've created a navigation bar for a website using movie clips with nested animation and I made those movie clips links to different pages in my website.
    When I preview the file in Flash CS3, the links work fine. However, when I preview the SWF file in the the webpage built in dreamweaver, the links won't act like links anymore.
    This is my code to handle the link:
    var urlRequest:URLRequest =
        new URLRequest('iengine.html');
    ielink.addEventListener
        (MouseEvent.MOUSE_UP, gotoLinkHandler);
    function gotoLinkHandler(evt:MouseEvent):void{
        navigateToURL(urlRequest,'_self');
    Am I making a common mistake? Or is there something else I need to help flash integrate with dreamweaver?
    Thanks so much for any help!

    You need to name the links in the Flash file as if it were living in the same folder as the html file that holds it... essentially because when you load it into that file, that file becomes its relative reference for loading/targeting.

  • 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");

  • _self doesn't work when Flash is embedded into iWeb

    I am currently building a site for a client who requested that all the pages be built in in iWeb so that she could easily manipulate them without my further involvement.  She also requested that the site contain Flash elements such as a drop-down navbar.
    I embedded the Flash elements with this code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html><head><title></title></head><body><object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/ flash/swflash.cab#version=6,0,40,0" border="0" width="1000" height="525"><param name="movie" value="URL OF FLASH FILE"><param name="quality" value="High"><param name=wmode value=transparent><embed src="URL OF FLASH FILE" type="application/x-shockwave-flash" name="obj1" width="1200" height="700" wmode="transparent"></object></body></html>
    And used the HTML insert function in iWeb to place the Flash .swfs.
    The problem is, for some reason, iWeb—as expected—is very particular as to the action script it will accept.  In terms of the navbar links, I couldn't use variables.  The only URLRequest function I could use was:
    Button_mc.addEventListener(MouseEvent.CLICK, callLink);
    function callLink(event:MouseEvent):void{
    navigateToURL(new URLRequest("http://web.me.com/samuelwagreich/Muel_Wagreich/Test_2.html"));
    Yet, when I add the _self, like this:
    navigateToURL(new URLRequest("http://web.me.com/samuelwagreich/Muel_Wagreich/Test_2.html"), "_self");
    For some reason the link no longer works when I add the _self, even when it manages to work in the Flash viewer or even if I display the file from my GoDaddy FTP.  I've been researching the problem for days, and I just can't seem to find a solution.  I can't make the code any more complex, because then iWeb won't accept the link at all.  I was wondering if anyone has solved the problem—a rather obscure one—and if not, I was hoping someone had a workaround I haven't seen or another way to work around iWeb's stupidity.
    Thanks.

    CVI indeed attaches to the debug output. Since it is the first to get a chance to do that for its own process it will effectivly disconnect any other debugger from that output for anything that is executed in CVI. Windows has some serious limitations in terms of piping streams in comparison to Unix systems, and this is one of them.
    But what is wrong about the CVI Debug Window? You do get the information in there so it seems possible to do debugging of your LabVIEW DLL in CVI.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Issue with urlrequest opening in different tab

    so I have been working on this code for a few days now and cant seem to get it to work properly. it opens in new tab or window instead of the same tab or window.
    /* Mouse Click Event
    Clicking on the specified symbol instance executes a function in which you can add your own custom code.
    Instructions:
    1. Add your custom code on a new line after the line that says "// Start your custom code" below.
    The code will execute when the symbol instance is clicked.
    general.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_1);
    function fl_MouseClickHandler_1(event:MouseEvent):void
        gotoAndPlay(128)
    var myDelay:Timer = new Timer(1000,1);
    myDelay.addEventListener(TimerEvent.TIMER, showMessage);
    myDelay.start();
    function showMessage(event:TimerEvent):void{
        navigateToURL(new URLRequest("http://www.swicc-alliance.com/generalinfo.htm"), "_same")
        stop()
    I have used _same, _self, _blank, _parent or just nothing at all.... i dont get it. this is an issue both in ie and firefox. I have tried testing it in flash browser test and also on server... any ideas?
    animation is located at www.swicc-alliance.com/home.htm

    its action code 3
    general.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_1);
    function fl_MouseClickHandler_1(event:MouseEvent):void
        gotoAndPlay(128)
    var myDelay:Timer = new Timer(1000,1);
    myDelay.addEventListener(TimerEvent.TIMER, showMessage);
    myDelay.start();
    function showMessage(event:TimerEvent):void{
        navigateToURL(new URLRequest("http://www.swicc-alliance.com/generalinfo.htm"), "_same")
        stop()

  • Link to url, "_self" is opening a new page...

    I am trying to get my button to navigate to _self and the link is opening a new page. Is there something wrong in my code?
    my_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
    function mouseDownHandler(event:MouseEvent):void {
        navigateToURL(new URLRequest("myurl"), "_self");
    Thank you in advance for any help!

    both parameters are strings or string variables.  you're using a variable (which shouldn't be in quotes).
    here's a sample:  http://www.kglad.com/Files/forums/Untitled-2.html
    and, assuming that works for you:  http://www.kglad.com/Files/forums/Untitled-2.fla

  • NavigateToURL(new URLRequest) with mailTo tag

    Hello,
    I am using the following code to send an email message, which works in development.
    sendMe_mc.addEventListener(MouseEvent.CLICK,fl_ClickToGoToWebPage);
    function fl_ClickToGoToWebPage(event:MouseEvent):void
    navigateToURL(new URLRequest("mailTo:"+confirmTi.text+"?subject=Notes to self from HFHI Values in Action &body="+values_t.text+""), "_blank");
    It still works when loaded and launched from the swf embedded in a swf, but it also first tries to navigate to a new url by openign a new window/tab in IE7. Is there something better than the mailTo: tag to use?
    Also, I tried removing the targwt parameter, it does nto work without it being identified....
    thanks
    s

    you can user server-side code if you don't want to rely on the user having a default email program.  and you can use "_self" instead of "_blank" if you want to use the user's default email program but don't want to open another window.

  • URLRequest param set question

    i application URLRequest to post a new html page,which have
    some question for IE
    program:
    var url:URLRequest=new
    URLRequest("vodplay.html?name=22222");
    navigateToURL(url,"_self");
    when i apply ie to run this page,this param is null.
    when i app firefox to run this page ,this param is 22222.
    why it is so?

    They are individual ...

  • Major Problems with _self in AS3

    Okay, so I'm pretty much a self-taught Flash newb, so please bear with me if this question has an obvious answer.  I've searched different fixes, and none of them have worked.
    I am making a simple button in Flash CS4 with AS3.  The button has a hover effect and that's it.  I am wanting the button to link to a different webpage when clicked on in the same window.  I am using this code:
    Button.addEventListener(MouseEvent.CLICK, onMouseClick);
    function onMouseClick(e:MouseEvent):void
        var request:URLRequest = new URLRequest("http://www.mysite.com);
        navigateToURL(request, "_self");
    When I test the movie in Flash, it works fine.  It takes me to the webpage.  However, when embedded online, it does nothing.  I can click on it, and I will remain there on the same page.  Like it's just a pretty image with a hover effect and no link.  I've tested the button in both IE and Firefox, and it does not work in either.
    Now here's the funny thing....when I use _blank instead of _self, it works just fine in both Firefox and Explorer.  Any ideas of what I am doing wrong?
    Thank you.

    why you are adding the event listener to Button it is one of the cless names flash provides.
    Make sure
    You have the code where you have your button.
    you have named your button instance properly.
    and you attach your event listener to the instance with the same name.

  • AS3 stop(); not working w/ Multi URLRequest

    When I place one link in AS3 with a stop everything works great!
         stop();
         import flash.events.MouseEvent;
         //---link1
         var getLink1:URLRequest = new URLRequest("http://www.google.com");
         link1btn.addEventListener(MouseEvent.CLICK, onClick);
         function onClick(event:MouseEvent):void{
             navigateToURL(getLink1, "_self");
    but when I add more links my stop(); fails to work - like the example below.
              stop();
              import flash.events.MouseEvent;         
              //---link1
              var getLink1:URLRequest = new URLRequest("http://www.google.com");
              link1btn.addEventListener(MouseEvent.CLICK, onClick);
              function onClick(event:MouseEvent):void{
                  navigateToURL(getLink1, "_self");
              //---link2
              var getLink2:URLRequest = new URLRequest("http://www.yahoo.com");
              link2btn.addEventListener(MouseEvent.CLICK, onClick);
              function onClick(event:MouseEvent):void{
             navigateToURL(getLink2, "_self");
    link1btn and link2btn are instance names.
    Any ideas?

      stop();
      import flash.events.MouseEvent;        
    var getLink1:URLRequest = new URLRequest("http://www.google.com");
    var getLink2:URLRequest = new URLRequest("http://www.yahoo.com");
       link1btn.addEventListener(MouseEvent.CLICK, onClick);
    link2btn.addEventListener(MouseEvent.CLICK, onClick);
    function onClick(event:MouseEvent):void{
    if (event.target.name=="link1btn")
             navigateToURL(getLink1, "_self");
    else (event.target.name=="link2btn")
             navigateToURL(getLink2, "_self");
    IF NOT WORKS, change event.target.name to event.currentTarget.name

Maybe you are looking for

  • Configuration Error Message when I try to update a users account in a portal OR Create a new user!

    Hi, Please take a look at the word doc and if anyone has any ideas how I should go about getting rid of this error. I have basically created a new web application which is an exact copy of the sampleportal(avitek). Thanks Ramy P.S: I have not changed

  • Where did I get System 10.2.8?

    This has me completely baffled. I have two CRT iMacs, a Dalmation, and another much older machine. both are running system 10.2.8. Where the heck did I get that system? I need to completely erase and reload the HD in the Dalmation. It was horribly ab

  • Vendor Ageing Items

    Dear Experts, The due dates for our supplier items are already passed and the suppliers did not claim them and there are many items like that in 2011. We don't know if the supplier will claim them again or not, some of them may be out of business. Bu

  • Crazy disk usage + frequent crashes after update

    After updating to version 35, Firefox has become almost unusable. No other change was made to my system, which worked fine up until the update. The browser starts and works fine for a few (not consistent) minutes, then starts using the hard drive hea

  • Looping audio after capture

    I'm capturing into CS3 premiere pro - Cannon Vixia HV30 and HV40 cameras, HDV 1080i30 (i60) project settings. When playing the video in the timeline after capture, the audio in many spots loops and repeats on itself.  The raw captured video when play