Step 1
Create a flash project and set the Publish Settings’ ActionScript version as 2.
Step 2
Create two dynamic texts, named as txtFullUrl and txtBaseUrl.

Step 3
Create another layer; in first frame of that layer write the following ActionScript code.
Action Script 2 Code

function GetTheBaseUrl() { var RootFullUrl = _root._url; txtFullUrl.text = RootFullUrl; var lastSlashIndex:Number = RootFullUrl.lastIndexOf("/"); var DriveIndex:Number = RootFullUrl.indexOf("|"); if (DriveIndex>=0) { baseUrl = RootFullUrl.substring(0, DriveIndex); baseUrl += ":"; } else { baseUrl = ""; } baseUrl += RootFullUrl.substring(DriveIndex+1, lastSlashIndex+1); txtBaseUrl.text = baseUrl; return baseUrl; } var BaseURL:String= GetTheBaseUrl();
Action Script 3 Code

txtFullUrl.text = this.loaderInfo.url; var FullUrl:String = this.root.loaderInfo.url; var lastSlashIndex:Number = FullUrl.lastIndexOf("/"); var DriveSepIndex:Number = FullUrl.indexOf("|"); var baseUrl:String; if (DriveSepIndex >= 0) { baseUrl = FullUrl.substring(0, DriveSepIndex); baseUrl += ":"; } else { baseUrl = ""; } baseUrl += FullUrl.substring(DriveSepIndex + 1, lastSlashIndex + 1); txtBaseUrl.text = baseUrl;
Step 4
Press Ctrl + Enter to run the application.
Popularity: 15% [?]

October 21st, 2009
praveen
Posted in
Tags:

