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

  • bgraphic
  • Born
  • Born
  • bgraphic
  • Posts: 4
  • Loc: Dallas, Texas

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

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
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

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:
  • bgraphic
  • Born
  • Born
  • bgraphic
  • Posts: 4
  • Loc: Dallas, Texas

Post 3+ Months Ago

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
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

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.
  • bgraphic
  • Born
  • Born
  • bgraphic
  • Posts: 4
  • Loc: Dallas, Texas

Post 3+ Months Ago

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
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

No relative URL's, eh? I'll have to make a mental note of that. Glad you got it working.
  • bgraphic
  • Born
  • Born
  • bgraphic
  • Posts: 4
  • Loc: Dallas, Texas

Post 3+ Months Ago

Thanks for your help, Spork.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 7 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.