You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by CodeGirl <Mi...@yahoo.com> on 2014/12/10 00:19:57 UTC

Open a new Browser tab from Tab navigator Content

The function is not being called.   what should I do to get this to work?

protected function truckingMenu_clickHandler(event:MouseEvent):void
{
	var connection_request:URLRequest;
	connection_request = new URLRequest("file:///D:/Trucking.html");
	connection_request.method = URLRequestMethod.POST; // setting method type
	navigateToURL(connection_request);  // this is standard function.			
				
}
	


<mx:TabNavigator width="96%" height="90%" borderVisible="false"
horizontalAlign="center" fontSize="12">
		<s:NavigatorContent id="truckingMenu" label="Trucking"
click="truckingMenu_clickHandler(event)" >
		</s:NavigatorContent>
		




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by Tom Chiverton <tc...@extravision.com>.
I'm sorry I wasn't clear, I meant a single simple file that illustrates 
the problem. It may be better to put this on PasteBin or similar.

I assume when you right click the running .swf  that 'Debug' appears in 
the menu and you can select it ?
If so, please confirm you can at least get a breakpoint from a basic 
creationComplete or childAdd event of the TabNavigator.
I ask because I always rule out the obvious first.
I'm always having an automatic security update nuke my debug Player, 
which eventually reminds me to update it :-)

Assuming that works, I expect that listening for clicks on the child 
doesn't work the way you expect because you are clicking the content, 
not the element. I have a memory of this tripping me up before, which is 
why I suggested using an event on the TabNavigator itself, like 
childIndexChange, for instance.

Tom

On 10/12/14 16:30, CodeGirl wrote:
> If you look at my original question, you can see I provided the code.   I am
> using FB 4.5 on a Windows 7 computer.    The browser is Firefox  if not the
> latest version, fairly close since I installed it a month ago.
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9080.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
>


Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
If you look at my original question, you can see I provided the code.   I am
using FB 4.5 on a Windows 7 computer.    The browser is Firefox  if not the
latest version, fairly close since I installed it a month ago.  



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9080.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
Hey, the change event in the TabNavigator does fire.   So I might have an
answer after all



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9086.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
Thank You.   I take it just because an event is available does not mean it
actually works.   Do you know of a way that I can tell when an event is
available that it would work or not so I dont have to ask this type of
question any longer?



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9084.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
Its probably a FB issue.   I was trying to trigger off the Navigator Content.  
I am now triggering off the tabNavigator   Change event.    What I was
trying to do is open a new window with a new set of tabs for a different
group of screens.   Right now, I am using the change event and the newIndex
property.   Though if I ever add a new tab and forget this, the desired
behavior for that tab will mess up.   But at first glance, I didnt see
anything that was better.   Such as newItem so I could compare id names.  
But at least I found something that works.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9090.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by Hordur Thordarson <ho...@lausn.is>.
Check the docs or source if available.  There is no click event listed in the Events section of the NavigatorContent docs.
I think this is an exception though, I use Flash Builder and don’t remember having seen this problem before.
Not sure if this is a FB issue or some other problem.

I’m not clear on what you are trying to do.  Does the Change event not work for you?  Are you not trying to detect that a certain tab was activated?
This works fine for me, ie. I get an Alert window on every tab change:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	
	<fx:Script><![CDATA[
		import mx.events.IndexChangedEvent;
		
		import spark.components.Alert;
		
		protected function truckingMenu_clickHandler(event:MouseEvent):void
		{
			var connection_request:URLRequest;
			connection_request = new URLRequest("file:///D:/Trucking.html");
			connection_request.method = URLRequestMethod.POST; // setting method type
			navigateToURL(connection_request);  // this is standard function.			
			
		}

		protected function tabnavigator1_changeHandler(event:IndexChangedEvent):void
		{
			Alert.show("New tab index: " + event.newIndex);
		}
		
	]]></fx:Script>
	
	<mx:TabNavigator width="96%" height="90%" borderVisible="false"
					 horizontalAlign="center" fontSize="12" change="tabnavigator1_changeHandler(event)">
		<s:NavigatorContent id="truckingMenu1" label="Trucking1">
		</s:NavigatorContent>
		<s:NavigatorContent id="truckingMenu2" label="Trucking2">
		</s:NavigatorContent>
		<s:NavigatorContent id="truckingMenu3" label="Trucking3">
		</s:NavigatorContent>
	</mx:TabNavigator>
	
</s:Application>

Hordur
Lausn

On 10.12.2014, at 17:30, CodeGirl <Mi...@yahoo.com> wrote:

> FYI, even the childindexchange doesnt work as well.   Guess I cant do what I
> was wanting to do.  At least not with the TabNavigator.   Oh, and I did use
> a break point in debug to validate this.
> 
> 			protected function
> tabnavigator1_childIndexChangeHandler(event:IndexChangedEvent):void
> 			{
> 				if (event.newIndex == 4)
> 				{
> 				var connection_request:URLRequest;
> 				connection_request = new
> URLRequest("file:///D:/TruckingFlex/Trucking/bin-debug/Trucking.html");
> 				//				connection_request.data = new URLVariables("param1=" +
> "Prashant"); // to pass any parameter to URL
> 				connection_request.method = URLRequestMethod.POST; // setting method
> type
> 				navigateToURL(connection_request);  // this is standard function.			
> 				Alert.show("This fired");
> 				}
> 			}
> 			
> 
> 
> 
> 
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9085.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
FYI, even the childindexchange doesnt work as well.   Guess I cant do what I
was wanting to do.  At least not with the TabNavigator.   Oh, and I did use
a break point in debug to validate this.

			protected function
tabnavigator1_childIndexChangeHandler(event:IndexChangedEvent):void
			{
				if (event.newIndex == 4)
				{
				var connection_request:URLRequest;
				connection_request = new
URLRequest("file:///D:/TruckingFlex/Trucking/bin-debug/Trucking.html");
				//				connection_request.data = new URLVariables("param1=" +
"Prashant"); // to pass any parameter to URL
				connection_request.method = URLRequestMethod.POST; // setting method
type
				navigateToURL(connection_request);  // this is standard function.			
				Alert.show("This fired");
				}
			}
			




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9085.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by Hordur Thordarson <ho...@lausn.is>.
As far as I know, NavigatorContent isn’t clickable.  It is just a non-visible wrapper that allows Spark components to work within the MX TabNavigator.
If you want your function to be called when the user activates that tab in the TabNavigator, use the events on the TabNavigator object as suggested by Tom, such as the Change event that is dispatched when a new tab is activated.

https://flex.apache.org/asdoc/spark/components/NavigatorContent.html#eventSummary

Hordur
Lausn


On 10.12.2014, at 16:34, CodeGirl <Mi...@yahoo.com> wrote:

> Oh and as for my experience level.   I have been programming for over 35
> years.   I started using Flex in 2010 I think.   Maybe 2011.
> 
> 
> 
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9081.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
Oh and as for my experience level.   I have been programming for over 35
years.   I started using Flex in 2010 I think.   Maybe 2011.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9081.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by Tom Chiverton <tc...@extravision.com>.
Sorry you feel that way, but as you say I did think that - your message 
carried no indication of what you had already tried, and I've no idea on 
your level of experience with Flex.

If you are unable to get even a a simple event like childAdded to pause 
in the debugger, please clarify exactly what you have tried, with full 
(not working) example code so that we can help.
We'll also need details about what Flash version, web browser or AIR 
runtime you are using, as well as how exactly you are trying to debug 
(Flash Builder ? Command line ?)

With out a full set of details, you are not going to get a very useful 
response, and we'll both waste time asking questions back and forth 
trying to see if you are using the wrong event, or there is something 
with up with how you are debugging.

Tom

On 10/12/14 16:03, CodeGirl wrote:
> I think you are completely in appropriate.   I am guessing you think I didnt
> already try to find the answer before I asked the question.   Your first
> response was asking if I knew how to debug or not.   The second made the
> assumption that I hadnt already tried to find a different solution.   I was
> trying to be polite.   But this last one was in excusable.
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9078.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
>


Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
I think you are completely in appropriate.   I am guessing you think I didnt
already try to find the answer before I asked the question.   Your first
response was asking if I knew how to debug or not.   The second made the
assumption that I hadnt already tried to find a different solution.   I was
trying to be polite.   But this last one was in excusable.  



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9078.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by Tom Chiverton <tc...@extravision.com>.
And I was hoping you'd invest some time looking for a solution, but we 
can't both have everything we want :-)

Tom

On 10/12/14 15:49, CodeGirl wrote:
> I am hoping someone who knows how to get this to work will reply to my
> question.
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9076.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
>


Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
I am hoping someone who knows how to get this to work will reply to my
question.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9076.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by Tom Chiverton <tc...@extravision.com>.
Have you tried alternative events, maybe even those on the TabNavigator 
itself ?

Tom

On 10/12/14 14:56, CodeGirl wrote:
> The first indication it didnt work was that a new tab didnt open.   Then yes,
> I placed a break point and it didnt stop.
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9072.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
>


Re: Open a new Browser tab from Tab navigator Content

Posted by CodeGirl <Mi...@yahoo.com>.
The first indication it didnt work was that a new tab didnt open.   Then yes,
I placed a break point and it didnt stop.   



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Open-a-new-Browser-tab-from-Tab-navigator-Content-tp9046p9072.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Open a new Browser tab from Tab navigator Content

Posted by Tom Chiverton <tc...@extravision.com>.
On 09/12/14 23:19, CodeGirl wrote:
> The function is not being called.   what should I do to get this to work?
So you set a breakpoint on the first line, and it doesn't stop ?

You've tried replacing the body with a simple Alert.show() and it 
doesn't appear ?

Tom