header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Chris
Points:0
Posts:0

9/5/2010 8:04:11 PM

Title: opening a page in a browser when a choice is selected from the Menu


The choice item is defined in MXML as

<menuitem label="Help">
<menuitem label="Documentation" data="documentation.swf" />
</menuitem>


Code on what to do when it is selected is

<mx:ApplicationControlBar id="appBar" x="0" y="0" dock="false" visible="false" width="100%">
		<mx:MenuBar id="appNavigation" dataProvider="{appNavigation_dp}" labelField="@label" iconField="@icon" itemClick="menuBarButtons(event);" />
	
	</mx:ApplicationControlBar>

//Function called menuBarButtons is 

private function menuBarButtons(event:MenuEvent):void{
				var pageName:String = event.item.@data;
				
				switch(pageName){

case 'Documentation':
					var url:URLRequest = new URLRequest('http://www.mydocumentation.com');   
                        navigateToURL(url,'_blank');


					break;

}

//I have done the required imports such as

import flash.net.navigateToURL;
            import flash.net.URLRequest;
            import flash.net.URLVariables;

When I click on the Documentation option from the menu, no new URL opens while I am expecting a page with a URL http://www.mydocumentation.com to be opened What am I missing? Any suggestions would be appreciated.



1
Veer
Points: 480
Posts:0
9/5/2010 10:48:35 PM



Hello Chris

I have tried same code at my side, Code working fine.

I would suggest to check your browser setting may be pop-up is blocked in your window.

or debug the code and go step by step in function might be you will solve it.

Regards,
Virat Patel

2
Chris
Points: 0
Posts:0
9/6/2010 1:16:13 PM



Hi Virat,

Thanks for the reply, but the code I had was wrong. How did it work properly at your side?

I changed the data = "documentation.swf" to data = "helpdoc"
and changed case 'Documentation' to case 'helpdoc' and it worked fine.

After then only it worked fine.


3
Veer
Points: 480
Posts:0
9/6/2010 11:07:33 PM



Hi...

Code working fine at my side it means the code syntax is right like

var pageName:String = event.item.@data;
switch(pageName){
case 'Documentation':
var url:URLRequest = new URLRequest('http://www.mydocumentation.com');
navigateToURL(url,'_blank');
break;

i have forcefully set variable pageName to 'Documentation' than it work fine.
that's what i mean to say in my above answer. but is condition may fall wrong in your case than definitely a problem in data or code.

Regards,
Veerat


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 4+4 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions