PDA

View Full Version : "_self" not opening URL in same window



bmills
July 13th, 2009, 05:26 PM
Hello,

I'm not very fluent with AS3, however, I have successfully changed the following script from AS1 to AS3. All is working with the exception of the "target". When I use "_self", nothing happens. However, when I remove _self and click on the button (image), it opens a new window.

All of the tut's I have followed have suggested the same thing, but it is not working for me. Any assistance with resolving this issue is greatly appreciated.

Here is the URL in question: http://design.1105media.com/sitecore/sites/THE_Journal/govConn/stimulus.aspx.htm l (http://design.1105media.com/sitecore/sites/THE_Journal/govConn/stimulus.aspx.html)

And, the AS (below) I'm using. The first block of code is another attempt at correcting this, however, you'll see that it is commented out.

Thanks again,

B

--------------

stop();

//actions to redirect user to new page in same window
/*var link:URLRequest = new URLRequest("http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx"); (http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx%22%29;)
thumbsdown_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent) :void
{
navigateToURL(link);
}*/

thumbsdown_btn.addEventListener(MouseEvent.MOUSE_D OWN, thumbDownHandler);
function thumbDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx"), (http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx%22%29,) "_self");
}

// triggers animation on mouseOut
thumbsdown_btn.addEventListener(MouseEvent.MOUSE_O UT, mouseDownHandler2);
function mouseDownHandler2(event:MouseEvent):void {
gotoAndPlay(16);
}

snickelfritz
July 13th, 2009, 05:44 PM
I believe _self is an optional parameter that should be included in the parenthesis.

navigateToURL(new URLRequest("http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx", "_self");

theCodeBot
July 13th, 2009, 10:35 PM
I believe _self is an optional parameter that should be included in the parenthesis.
ActionScript Code:

navigateToURL(new URLRequest("http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx", "_self");




You missed a parenthesis. Should be:


navigateToURL( new URLRequest("http://something.com"), "_self");


You can see documentation on the navigateToURL function here (http://livedocs.adobe.com/flex/2/langref/flash/net/package.html#navigateToURL()).

manish_raj
December 22nd, 2010, 06:14 AM
I also face same kind of problem and not find full proof solution.. if you got solution pls send me mail also manishsingh_friendly.co.in

appolozy for not given solution

Thanks :)


Hello,

I'm not very fluent with AS3, however, I have successfully changed the following script from AS1 to AS3. All is working with the exception of the "target". When I use "_self", nothing happens. However, when I remove _self and click on the button (image), it opens a new window.

All of the tut's I have followed have suggested the same thing, but it is not working for me. Any assistance with resolving this issue is greatly appreciated.

Here is the URL in question: http://design.1105media.com/sitecore/sites/THE_Journal/govConn/stimulus.aspx.htm l (http://design.1105media.com/sitecore/sites/THE_Journal/govConn/stimulus.aspx.html)

And, the AS (below) I'm using. The first block of code is another attempt at correcting this, however, you'll see that it is commented out.

Thanks again,

B

--------------

stop();

//actions to redirect user to new page in same window
/*var link:URLRequest = new URLRequest("http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx"); (http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx%22%29;)
thumbsdown_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent) :void
{
navigateToURL(link);
}*/

thumbsdown_btn.addEventListener(MouseEvent.MOUSE_D OWN, thumbDownHandler);
function thumbDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx"), (http://thejournal.com/microsites/govconnection/21st-century-classroom.aspx%22%29,) "_self");
}

// triggers animation on mouseOut
thumbsdown_btn.addEventListener(MouseEvent.MOUSE_O UT, mouseDownHandler2);
function mouseDownHandler2(event:MouseEvent):void {
gotoAndPlay(16);
}