AS3: Can't get navigateToURL to load page in bottom frame

  • bgraphic
  • Born
  • Born
  • No Avatar
  • Joined: Nov 14, 2007
  • Posts: 4
  • Loc: Dallas, Texas
  • Status: Offline

Post November 14th, 2007, 9:09 am

On this frames page: http://www.noodlelivetv.com/demo/

I am using the following AS3 Script:

/////////

import flash.net.*;
import flash.display.*;

stop();

btnGames.addEventListener(MouseEvent.CLICK, onClickGames);

function onClickGames(evtObj:MouseEvent):void{
var urlGames:URLRequest = new URLRequest("games.html");
navigateToURL(urlGames,"main");
}

//////////////

The button loads the page in a new window no matter what I do. That same link in straight html works great, but not from Flash.

Please help. I have tried doing this also in AS2 with no luck. I have always been able to code this way in the past with no problems. Is this happening because of the new AC_RunActiveContent.js issue?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 14th, 2007, 9:09 am

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post November 14th, 2007, 9:52 am

Did you try putting the frame request in the new URLRequest? IE
Code: [ Select ]
var urlGames:URLRequest = new URLRequest("games.html","main");
navigateToURL(urlGames);
  1. var urlGames:URLRequest = new URLRequest("games.html","main");
  2. navigateToURL(urlGames);


I'm not positive that will work but navigateToURL doesn't seem like the correct place. I don't have Flash CS3 or Flex in front of me at the moment to check the actual syntax
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6128
  • Loc: Seattle, WA
  • Status: Offline

Post November 14th, 2007, 10:04 am

I do happen to have Flex open at the moment, and the URLRequest idea won't work -- the URLRequest constructor only takes one argument, the URL. The window does go in the call to navigateToURL() as bgraphic has it.

I'm not sure why it's not working for you. I've never had a problem with navigateToURL() before. :scratchhead:
The Beer Monocle. Classy.
  • bgraphic
  • Born
  • Born
  • No Avatar
  • Joined: Nov 14, 2007
  • Posts: 4
  • Loc: Dallas, Texas
  • Status: Offline

Post November 14th, 2007, 10:07 am

I tried that originally and just now, but it is giving me this error:

line 9: 1137: Incorrect number of arguments. Expected no more than 1.

If I keep it the way I have and change "main" to "_blank" or remove it, it works properly. So, I guess it works in this location. I have seen it in both. go figure. :-(
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1828
  • Loc: In the Great White North
  • Status: Offline

Post November 14th, 2007, 10:26 am

Doh... Sorry about the misinformation. I'm glad spork came to the rescue. I was just looking at that again, and I wonder if "main" might be a reserved term in some browsers. Do you have the problem in all browsers? You might also want to try changing the frame name to something that couldn't possibly be reserved.
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • bgraphic
  • Born
  • Born
  • No Avatar
  • Joined: Nov 14, 2007
  • Posts: 4
  • Loc: Dallas, Texas
  • Status: Offline

Post November 14th, 2007, 11:38 am

I tried renaming it to betsy and changed my link to reflect the new frame name. Same problem.

I did get it to work now. OMG. What a relief. It doesn't work with relative URL's, just hard coded with http:// in front. I think the browser's security settings thought it was a virus. Hmmm.
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6128
  • Loc: Seattle, WA
  • Status: Offline

Post November 14th, 2007, 12:57 pm

No relative URL's, eh? I'll have to make a mental note of that. Glad you got it working.
The Beer Monocle. Classy.
  • bgraphic
  • Born
  • Born
  • No Avatar
  • Joined: Nov 14, 2007
  • Posts: 4
  • Loc: Dallas, Texas
  • Status: Offline

Post November 14th, 2007, 3:46 pm

Thanks for your help, Spork.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 58 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.