Another question on Lostinbeta's XML driven Navigation

Ok here’s the thing. I want some of my links to point to an IFrame. But there are some links that I want to open in a new window. I modified the code to open all links in my IFrame. But what about the ones I want to open in a new window.

Here’s my code:
[AS]
myButton.onRelease = function() {
getURL(this.myUrl,target=“myFrame”);
trace(this.buttonLabel.text+" : "+this.myURL);
[/AS]

is there anyway to detect what the item name is, and link it appropriatly. also please don’t think im just shooting questions at you, i have tried this and honestly am kind of lost

thank you

Well looks, like I answered my own question. the script already detects if a button has a subnav. if it does i targeted it to my IFrame, if not it opens a new window. woOt!

Well glad you fixed your own problem, but there is still a problem with your script…

[AS]getURL(this.myUrl,target=“myFrame”);[/AS] that is executed wrong. It should be [AS]getURL(this.myUrl, “myFrame”);[/AS]

=)

that code works fine, lost… :-\

here’s my proof. :stuck_out_tongue:

// 1
this.onMouseDown = function() {
	trace(myVar="Hello!");
};
// 2
myVar ="Hello!";
this.onMouseDown = function() {
	trace(myVar);
};
// 3
this.onMouseDown = function() {
	trace("Hello!");
};

three different methods, same result. :wink:

Yeah, it may work, but I don’t see the point in setting it in a variable if he isn’t going to use that variable in the future.

So that leaves me to believe it is inefficient coding, unless he is indeed using that variable for something else.

ok… you said it was wrong, i said it was fine. :stuck_out_tongue:

now things are different, so i totally agree with you. :wink:

*Originally posted by lostinbeta *
**Well glad you fixed your own problem, but there is still a problem with your script…

[AS]getURL(this.myUrl,target=“myFrame”);[/AS] that is executed wrong. It should be [AS]getURL(this.myUrl, “myFrame”);[/AS]

=) **

yes you are correct. thank you

*Originally posted by kax *
**ok… you said it was wrong, i said it was fine. :stuck_out_tongue:

now things are different, so i totally agree with you. :wink: **

lol… what? that makes no sense! :trout:

yeah, i know… :stuck_out_tongue:

now that you’ve explained why you said it was wrong, i said i agree.

bah! forget it… that makes no sense either. :stuck_out_tongue:

Ohhh, I get it now :slight_smile:

:trout: (to me)

:trout: to you. :sigh:

ok it turns out i didnt fix it. here’s the issue. the way my code is constructed now is all links that do not have sub links open s is a new window. that is not the way it should be. i need to specify which inks need to opne in my IFrame, and which should open in a new window. how can i go about doing this?

thanks

Ok, you know how in the code you have a line like this [AS]myButton.myUrl = menuItem*.attributes.URL;[/AS] and [AS]mySubButton.myUrl = this.subMenuItem[j].attributes.URL;[/AS]

Well these pull the attributes from the XML tag. To make custom targets for each you would need to add another attribute into the XML tag in the XML file and pull that in. First let is deal with the AS…

Add [AS]myButton.myTarget = menuItem*.attributes.TARGET;[/AS] under [AS]myButton.myUrl = menuItem*.attributes.URL;[/AS]

Add [AS]mySubButton.myTarget = this.subMenuItem[j].attributes.TARGET;[/AS] under [AS]mySubButton.myUrl = this.subMenuItem[j].attributes.URL;[/AS]

Now change both getURLs in the script to read [AS]getURL(this.myUrl, this.myTarget);[/AS]

Now let us move onto the XML file. We will now add an attribute called “TARGET” to each of the tags. An example would be as follows…

<SUBITEM NAME="Submenu Link 1" URL="sublink1.html" TARGET="_blank" />

or

<SUBITEM NAME="Submenu Link 1" URL="sublink1.html" TARGET="frameName" />

wow okay thanks man, imma get at this right now, ill let you knwo the outcome

LIB, works beautifully. Thank you for guiding me through this somewhat complicated navigation system. First time working with XML and Flash. I go to learn a lot from this.

Upmost props and respect
Digital

Glad it works :slight_smile:

Yes, the navigation system is quite complex, I studied the subnav code sen added in there a billion times to understand how it all works.

XML in Flash actually isn’t TOO hard to learn, but it can be a daunting task at times, but that pretty much goes for anything :stuck_out_tongue: