Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-04-2008, 10:54 AM   PM User | #1
nickyfraggle
Regular Coder

 
Join Date: Mar 2006
Posts: 197
Thanks: 27
Thanked 2 Times in 2 Posts
nickyfraggle is an unknown quantity at this point
getURL - does it need a full path?

Hello,

I am writing a flash application to go into a Ruby on Rails site. I'm only learning both languages, so I'm just messing around with things.

I was getting Ruby to create an xml file with images and a url in it. I've written a script (by following a few tutorials) to show the images. When someone clicks on an image, I want it to go to a url.

This is my code:

Code:
//when clicked on screen go to URL
listen  = new  Object();
Key.addListener(listen);
    btn.onRelease = function() {
        gotoUrl();
    };

    function gotoUrl() {
        getURL(url[i]);   
  }
i is a counter so it knows which url the image is related to. A url is passed to getURL ok, but it doesn't go anywhere. Does it need a full path? The path I am sending to the file is relative, and if I type it into a browser then it takes me right to the page I want to go to.

I guess a simple solution would be to add the base part of the url to the (url[i]) bit automatically - how would I do this? I'm not sure of the exact syntax.

Thanks!

Nicky

Last edited by nickyfraggle; 09-04-2008 at 10:55 AM.. Reason: title incorrect
nickyfraggle is offline   Reply With Quote
Old 09-04-2008, 04:25 PM   PM User | #2
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Try this. It shouldn't require a full URL, but it sometimes helps. Also, I added a second parameter to the getURL function, which tells the browser to use the same window for the link.
Code:
//when clicked on screen go to URL
listen  = new  Object();
Key.addListener(listen);
    btn.onRelease = function() {
        gotoUrl();
    };

    function gotoUrl() {
        getURL("http://www.somewhere.com/"+url[i], "_self");   
  }
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Users who have thanked gnomeontherun for this post:
nickyfraggle (09-04-2008)
Old 09-04-2008, 10:05 PM   PM User | #3
nickyfraggle
Regular Coder

 
Join Date: Mar 2006
Posts: 197
Thanks: 27
Thanked 2 Times in 2 Posts
nickyfraggle is an unknown quantity at this point
Thanks Jeremy! I'm going to have a go tomorrow but thanks again for all your help!

Nicky
nickyfraggle is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:48 AM.


Advertisement
Log in to turn off these ads.