Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » problem loading correct dynamic url using getURL


problem loading correct dynamic url using getURL

Reply
  #1 (permalink)  
Old 04-12-07, 07:53 PM
method method is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy problem loading correct dynamic url using getURL

I usedd this code but it never loads the correct webpage. Could any one help me fix this problem. It pops up window with localhost/undefined. I checked the url using trace and it has correct url but when it opens the window the url is not passed corectly and it pops up localhost/undefined instead.



actionscript Code:
  1. myData = new LoadVars()
  2.         myData.ref = this
  3.         myData.load("http://localhost/script.php")
  4.         myData.onLoad = function(succes){
  5.             if(succes){
  6.            
  7. getURL ("javascript:NewWindow=window.open(this.url,'newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();      void(0);");
  8.  
  9.            trace(this.url);
  10.             } else trace("Error loading data")
  11.            
  12.         }
  13.  
  14. }

Last edited by Nico; 04-12-07 at 08:01 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 04-14-07, 04:56 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
try this:
Actionscript Code:
  1. getURL ("javascript:NewWindow=window.open("+this.url+",'newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();      void(0);");
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 04-14-07, 04:08 PM
method method is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
ureaded thanks . I keep getting http://localhost/+this.url+
in the popup window instead of passed url!! Using trace.url i see the url crectly but for some odd reason it does not load that url corectly in the browser!!! I tried all these and non worked:

this.url
'this.url'
"this.url"

'+this.url+'
"+this.url+"

\""+this.url+"\"

I even used echo "url=".$url; instead of echo "url=$url"; in php side and still didn't work!!

Last edited by method; 04-14-07 at 04:13 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 04-15-07, 04:26 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
just a quick thought, but isn't url a reserved keyword (i just looked at the highlighted code, and it ended up in blue, instead of black). Try renaming the variable (inphp and flash) url2 will do, and see what happens.
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 04-15-07, 09:50 AM
method method is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
unrealed i even tried url2 in both php and flash still same erro. Error shown in image

http://img224.imageshack.us/my.php?i...rgeturlyh1.jpg

Last edited by method; 04-15-07 at 09:52 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 04-15-07, 09:46 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
I just tested your code on my pc, and it worked just fine, the only thing i changed was adding single quotes around the url:
ActionScript Code:
  1. mybtn.onRelease = function (){
  2.     var url:String = "http://www.google.com";
  3.     getURL ("javascript:NewWindow=window.open('"+url+"','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
  4. };
I tested this in Mozilla Firefox, and mozilla gave me the "the website tries to open a popup" notification

Cheers

PS: are you dutch speaking? cause i found the same code on a Dutch forum, named Flashfocus. This is the url of the thread: http://www.flashfocus.nl/forum/showt...+nieuwe+window
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 04-16-07, 03:05 AM
method method is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
Unreal. Thanks for testing the code. My main goal is to load dynamic url from db and opens it up in a new web browser every few seconds . i don't want to create buttons to load url!!

I followed your example and non of them work. could you look at these 2 version of the code and let me know what i am doing wrong. i keep getting this error:


Code:
internet explorer cannont download. 
Unspecified error
ok
This is the hardcoded version of url but still does't load the google in the browser
ActionScript Code:
  1. function loadData(){
  2. myData = new LoadVars()
  3.         myData.ref = this
  4.         myData.load("http://localhost/geturlfromdb.php")
  5.         myData.onLoad = function(succes){
  6.             if(succes){
  7.        
  8.             var url:String = "http://www.google.com";
  9.            
  10.    
  11. getURL ("javascript:NewWindow=window.open('"+url+"','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();      void(0);");
  12.  
  13.        
  14.             } else trace("Error loading data")
  15.            
  16.         }
  17.  
  18. }
  19. a = setInterval(loadData, 9000) //1000 = 1 second
  20.  


This version gets url form mysql via php. this.url holds the url .I used trace and saw that url get passed corectly to flash but flash can't load the url in the browser!!
i tried both var url:String = "this.url2"; and var url:String = this.url2;

ActionScript Code:
  1. function loadData(){
  2. myData = new LoadVars()
  3.         myData.ref = this
  4.         myData.load("http://localhost/geturlfromdb.php")
  5.         myData.onLoad = function(succes){
  6.             if(succes){
  7.        
  8.             var url:String = "this.url2";
  9.             //trace(this.url2);
  10.    
  11. getURL ("javascript:NewWindow=window.open('"+url+"','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();      void(0);");
  12.  
  13.        
  14.             } else trace("Error loading data")
  15.            
  16.         }
  17.  
  18. }
  19. a = setInterval(loadData, 9000) //1000 = 1 second
  20.  

Last edited by UnrealEd; 04-16-07 at 04:00 AM. Reason: please use the [highlight=ActionScript] wrapper when posting ActionScript code
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 04-16-07, 04:06 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
i'm not sure for 100%, but i think i've found the problem:
Javascript Code:
  1. "javascript:NewWindow=window.open('"+url+"','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();      void(0);"
In firefox it might work like this, but in IE i think you have to give the same name to the window as you pass in the second parameter of the window.open function

so this might work i think:
Javascript Code:
  1. "javascript:newWin=window.open('"+url+"','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  newWin.focus();      void(0);"

If the first code isn't working either, i think the problem is in IE and not in Flash or PHP.

in your second code:
ActionScript Code:
  1. var url:String = "this.url2";
will only pass this.url2 to the url variable, and not the value of this.url2.
ActionScript Code:
  1. var url:String = this.url2;
this should do it (by default the returned variable is a string, so you don't have to cast it to string, like you do in php)

UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX problem with php dynamic url scott2500uk PHP 3 10-28-06 11:33 AM
Change this AJAX script to accomidate dynamic url arandlett JavaScript 3 06-14-06 04:01 AM
Need Your HelP! Loading Multiple External Text into Multiple Dynamic Text Fields Flash_Boi Flash & ActionScript 2 03-30-06 04:27 PM
CGI problem - Script only allows a small number of digits in my customers site url??? Ireland Perl 6 10-09-05 08:09 PM
Caching Problem w/ Dynamic Pages Monarch JavaScript 0 08-09-05 09:32 AM


All times are GMT -5. The time now is 11:00 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.