You must be logged in to post Login Register
Search 

Menu with XML & Actionscipt – Linking help

User Post

4:14 am
January 13, 2010


kristov

New Member

posts 2

1

I've followed the handy tutorial Colorful Menu with XML and Actionscript 3 – http://tutorials.flashmymind.c…..nscript-3/


What I want to work out is, I'm having the menu system on every page of my website, and I want to know how to change the function to open the links in the same window instead of opening a new tab/window everytime a link is clicked.

4:29 pm
February 2, 2010


Inter-Reality

Member

Netherlands

posts 7

2

Post edited 12:29 am – February 3, 2010 by Inter-Reality
Post edited 12:33 am – February 3, 2010 by Inter-Reality


hi Kristov,

function itemClicked(e:Event):void {

//Get the item that dispatched the event
var item:MenuItem = e.target as MenuItem;

//Navigate to the URL that's assigned to the menu item
var urlRequest:URLRequest = new URLRequest(item.linkTo);
navigateToURL(urlRequest);
}

the damage is done by the navigateToURL. the solution is to add a comma and the html call.
in your case that could be: navigateToURL(request, “_self”);

your itemClicked function would look like so:

function itemClicked(e:Event):void {

//Get the item that dispatched the event
var item:MenuItem = e.target as MenuItem;

//Navigate to the URL that's assigned to the menu item
var urlRequest:URLRequest = new URLRequest(item.linkTo);
navigateToURL(urlRequest, “_self”);
//_parent & _blank are known html instructions.

//See more about this on http://www.w3schools.com/HTML/….._links.asp

}

Happy coding!
Cool


Adjustment

Target Description
_blank Loads the linked document into a new blank window. This window is not named.
_parent Loads the linked document into the immediate parent of the document the link is in.
_search Loads the linked document into the browser's search pane. Available in Internet Explorer 5 or later.
_self Loads the linked document into the same window the link was clicked in (the active window).
_top Loads the linked document into the topmost window.

Inter-Reality – the true art of coding http://www.inter-reality.nl

Topic RSS 
Search