geturl_1

Moving From Flash AS2 to Flash AS3: getURL

Tags: ,

What ever happened to getURL within Actionscript 3.0?

If you wanted to create a link to another website in ActionScript 2.0, here’s what it would have looked like:

The command getURL used to a be very easy way to create an outbound link within Flash. This one line of code code easily fitted perfectly within a button onRelease event. Not so easy anymore.

URL Navigation in AS2

getURL("http://www.google.com/", "target", "method");

URL Navigation in AS3

import flash.net.*;
var url:String = "http://www.google.com/";
var request:URLRequest = new URLRequest(url);
navigateToURL(request, 'target');

Along with many other easy Actionscript 2.0 calls, getUrl has changed. It uses a couple more lines of code and has changed to navigateToURL. You might be asking why would the amount of lines increase for such a simple task.  It is what it is, but if this is the price we have to pay for a vast improvements to the language then bring it on.  :)

Related Posts

ActionScript 3 Logo

Moving From AS2 to AS3: A Handy List of Resources

Welcome to ActionScript 3.0

ActionScript 1:1 – Getting Intimate With ActionScript 3.0

SWF Framerate Optimization

Smart SWF Optimization with Custom Framerates

ActionScript 3 Migration Cookbook

ActionScript 3 Migration Cookbook

4 Comments

  1. Reyco1

    04.25.2008

    Reply

    Hi, I myself am writing an AS2 to AS3 series which already has 6 parts. My first part had to exactly with this very same topic!

    http://www.reynaldocolumna.com/blog/archives/category/flash/as2-to-as3-baby-steps-series/page/2

  2. Anil

    03.24.2009

    Reply

    I want to get URl on the end of the SWF file. For that i m using geturl(“http://mypage.com/default.aspx”, “_blank”); it is working when i am using CTRL+ENTER for creating the SWF file from Flash. but when i mam going to run the swf file directly its not working & asking for Macromedia Flash Player has stopped potentailly unsafe operation.The folloeing local application on your computer or network:and also asking for the setting

    • Angel

      03.25.2009

      Reply

      Hey Anil, that happens due to the Flash Player security. You can bypass that by adding the directory that stores the SWF file into the trusted category or simply run the SWF in the browser.

  3. Anil

    03.25.2009

    Reply

    Pls Help
    Thanx

Leave a Reply









Latest Theme From WooThemes

Unsigned

By WooThemes

Unsigned is a hugely powerful, cleverly developed, yet super easy theme to use for musicians and bands looking to showcase their music, tours, photos, videos and band members all from within WordPress. It even allows you to sell your albums and merchandise thanks to the WooCommerce integration. It truly is a massive theme that will cover your every need.

Theme Categories: Multimedia, Responsive

Latest Tweets